app/presenters/hyrax/collapsable_section_presenter.rb in hyrax-5.0.0.rc2 vs app/presenters/hyrax/collapsable_section_presenter.rb in hyrax-5.0.0.rc3

- old
+ new

@@ -1,18 +1,21 @@ # frozen_string_literal: true module Hyrax # Draws a collapsable list widget using the Bootstrap 3 / Collapse.js plugin class CollapsableSectionPresenter - def initialize(view_context:, text:, id:, icon_class:, open:) + # rubocop:disable Metrics/ParameterLists + def initialize(view_context:, text:, id:, icon_class:, open:, title: nil) @view_context = view_context @text = text @id = id @icon_class = icon_class @open = open + @title = title end + # rubocop:enable Metrics/ParameterLists - attr_reader :view_context, :text, :id, :icon_class, :open + attr_reader :view_context, :text, :id, :icon_class, :open, :title delegate :content_tag, :safe_join, :tag, to: :view_context def render(&block) button_tag + list_tag(&block) end @@ -24,10 +27,11 @@ class: "#{button_class}collapse-toggle nav-link", data: { toggle: 'collapse' }, href: "##{id}", onclick: "toggleCollapse(this)", 'aria-expanded' => open, - 'aria-controls' => id) do + 'aria-controls' => id, + title: title) do safe_join([tag.span('', class: icon_class, 'aria-hidden': true), tag.span(text)], ' ') end end