Пример #1
0
 def add_html_for_item(self, item):
     li = super().add_html_for_item(item)
     li.append_class('nav-item')
     item.a.append_class('nav-link')
     item.a.add_attribute_source(
         ActiveStateAttributes(item, active_value='active'))
     item.a.add_attribute_source(
         AccessRightAttributes(item.a, disabled_class='disabled'))
     return li
Пример #2
0
 def add_html_for_item(self, item):
     self.html_representation.add_child(item.a)
     item.a.append_class('dropdown-item')
     item.a.add_attribute_source(
         ActiveStateAttributes(item, active_value='active'))
     item.a.add_attribute_source(
         AccessRightAttributes(item.a, disabled_class='disabled'))
     item.set_html_representation(item.a)
     return item.a
Пример #3
0
    def add_bordering_link_for(self, menu, short_description, long_description, start_page_number, disabled):
        link = A.from_bookmark(self.view, self.get_bookmark(start_page_number=start_page_number, 
                                                            disabled=disabled))

        link.add_child(Span(self.view, text=short_description)).set_attribute('aria-hidden', 'true');
        link.add_child(Span(self.view, text=long_description)).append_class('sr-only');
        link.set_attribute('aria-label', long_description);
        link.set_active(not disabled)
        item = menu.add_a(link)
        item.html_representation.add_attribute_source(AccessRightAttributes(link))
        self.add_styling_to_menu_item(item)