def __init__ (self, props_={}): props = props_.copy() if 'class' in props: props['class'] += " carousel" else: props['class'] = "carousel" Box.__init__ (self, props.copy()) self.images = List ({'class': 'overview'}) self.pager = List ({'class': 'pager'}) self.controls = None Box.__iadd__ (self, self.images)
def __init__ (self, props_={}): props = props_.copy() if 'class' in props: props['class'] += " carousel" else: props['class'] = "carousel" Box.__init__ (self, props.copy()) self.images = List ({'class': 'overview'}) self.pager = List ({'class': 'pager'}) Box.__iadd__ (self, self.images) arrows = Box({'class':'arrows'}) arrows += Link (None, RawHTML("%s"%(_('left'))), {'class': "buttons prev"}) arrows += Link (None, RawHTML("%s"%(_('right'))), {'class': "buttons next"}) controls = Box({'class':'controls'}) controls += arrows controls += self.pager Box.__iadd__ (self, controls)
def Render (self): # Add pager and arrows if there is more than 1 item if len(self.pager) > 1 and not self.controls: arrows = Box({'class':'arrows'}) arrows += Link (None, RawHTML("%s"%(_('left'))), {'class': "buttons prev"}) arrows += Link (None, RawHTML("%s"%(_('right'))), {'class': "buttons next"}) self.controls = Box({'class':'controls'}) self.controls += arrows self.controls += self.pager Box.__iadd__ (self, self.controls) # Render render = Box.Render (self) render.headers += HEADERS render.js += JS_INIT %({'id': self.id}) return render