diff options
Diffstat (limited to 'app/models/concerns/sidebars')
-rw-r--r-- | app/models/concerns/sidebars/container_with_html_options.rb | 42 | ||||
-rw-r--r-- | app/models/concerns/sidebars/has_active_routes.rb | 16 | ||||
-rw-r--r-- | app/models/concerns/sidebars/has_hint.rb | 16 | ||||
-rw-r--r-- | app/models/concerns/sidebars/has_icon.rb | 27 | ||||
-rw-r--r-- | app/models/concerns/sidebars/has_pill.rb | 21 | ||||
-rw-r--r-- | app/models/concerns/sidebars/positionable_list.rb | 37 | ||||
-rw-r--r-- | app/models/concerns/sidebars/renderable.rb | 12 |
7 files changed, 0 insertions, 171 deletions
diff --git a/app/models/concerns/sidebars/container_with_html_options.rb b/app/models/concerns/sidebars/container_with_html_options.rb deleted file mode 100644 index 12ea366c66a..00000000000 --- a/app/models/concerns/sidebars/container_with_html_options.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module Sidebars - module ContainerWithHtmlOptions - # The attributes returned from this method - # will be applied to helper methods like - # `link_to` or the div containing the container. - def container_html_options - { - aria: { label: title } - }.merge(extra_container_html_options) - end - - # Classes will override mostly this method - # and not `container_html_options`. - def extra_container_html_options - {} - end - - # Attributes to pass to the html_options attribute - # in the helper method that sets the active class - # on each element. - def nav_link_html_options - {} - end - - def title - raise NotImplementedError - end - - # The attributes returned from this method - # will be applied right next to the title, - # for example in the span that renders the title. - def title_html_options - {} - end - - def link - raise NotImplementedError - end - end -end diff --git a/app/models/concerns/sidebars/has_active_routes.rb b/app/models/concerns/sidebars/has_active_routes.rb deleted file mode 100644 index e7a153f067a..00000000000 --- a/app/models/concerns/sidebars/has_active_routes.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Sidebars - module HasActiveRoutes - # This method will indicate for which paths or - # controllers, the menu or menu item should - # be set as active. - # - # The returned values are passed to the `nav_link` helper method, - # so the params can be either `path`, `page`, `controller`. - # Param 'action' is not supported. - def active_routes - {} - end - end -end diff --git a/app/models/concerns/sidebars/has_hint.rb b/app/models/concerns/sidebars/has_hint.rb deleted file mode 100644 index 21dca39dca0..00000000000 --- a/app/models/concerns/sidebars/has_hint.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -# This module has the necessary methods to store -# hints for menus. Hints are elements displayed -# when the user hover the menu item. -module Sidebars - module HasHint - def show_hint? - false - end - - def hint_html_options - {} - end - end -end diff --git a/app/models/concerns/sidebars/has_icon.rb b/app/models/concerns/sidebars/has_icon.rb deleted file mode 100644 index d1a87918285..00000000000 --- a/app/models/concerns/sidebars/has_icon.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# This module has the necessary methods to show -# sprites or images next to the menu item. -module Sidebars - module HasIcon - def sprite_icon - nil - end - - def sprite_icon_html_options - {} - end - - def image_path - nil - end - - def image_html_options - {} - end - - def icon_or_image? - sprite_icon || image_path - end - end -end diff --git a/app/models/concerns/sidebars/has_pill.rb b/app/models/concerns/sidebars/has_pill.rb deleted file mode 100644 index ad7064fe63d..00000000000 --- a/app/models/concerns/sidebars/has_pill.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# This module introduces the logic to show the "pill" element -# next to the menu item, indicating the a count. -module Sidebars - module HasPill - def has_pill? - false - end - - # In this method we will need to provide the query - # to retrieve the elements count - def pill_count - raise NotImplementedError - end - - def pill_html_options - {} - end - end -end diff --git a/app/models/concerns/sidebars/positionable_list.rb b/app/models/concerns/sidebars/positionable_list.rb deleted file mode 100644 index 30830d547f3..00000000000 --- a/app/models/concerns/sidebars/positionable_list.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -# This module handles elements in a list. All elements -# must have a different class -module Sidebars - module PositionableList - def add_element(list, element) - list << element - end - - def insert_element_before(list, before_element, new_element) - index = index_of(list, before_element) - - if index - list.insert(index, new_element) - else - list.unshift(new_element) - end - end - - def insert_element_after(list, after_element, new_element) - index = index_of(list, after_element) - - if index - list.insert(index + 1, new_element) - else - add_element(list, new_element) - end - end - - private - - def index_of(list, element) - list.index { |e| e.is_a?(element) } - end - end -end diff --git a/app/models/concerns/sidebars/renderable.rb b/app/models/concerns/sidebars/renderable.rb deleted file mode 100644 index a3976af8515..00000000000 --- a/app/models/concerns/sidebars/renderable.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -module Sidebars - module Renderable - # This method will control whether the menu or menu_item - # should be rendered. It will be overriden by specific - # classes. - def render? - true - end - end -end |