Sha256: 10f935e47b003c30e1875d8fbad25aa2637cc6ac3e6e013ed8c7457d923523c2

Contents?: true

Size: 1.3 KB

Versions: 13

Compression:

Stored size: 1.3 KB

Contents

include_set Abstract::ToolbarSplitButton

format :html do
  view :core, cache: :never do
    subject.toolbar_split_button("rules", view: :edit_rules, icon: :list) do
      dropdown_items
    end
  end

  def dropdown_items
    button_hash = {
      common_rules:  edit_rules_link("common",   :common_rules),
      grouped_rules: edit_rules_link("by group", :grouped_rules),
      all_rules:     edit_rules_link("by name",  :all_rules)
    }
    recently_edited_rules_link button_hash
    # nest_rules_link button_hash
    button_hash
  end

  def recently_edited_rules_link button_hash
    return unless recently_edited_settings?
    button_hash[:recent_rules] = edit_rules_link "recent", :recent_rules
  end

  def edit_rules_link text, rule_view
    subject.link_to_view :edit_rules, text,
                         path: { rule_view: rule_view },
                         class: "dropdown-item"
  end

  # FIXME: edit_nest_rules removed because of recursion
  #
  # def nest_rules_link button_hash
  #   return unless nested_fields.present?
  #   button_hash[:separator] = separator
  #   button_hash[:edit_nest_rules] = edit_nest_rules_link "nests"
  # end
  #
  # def edit_nest_rules_link text
  #   subject.link_to_view :edit_nest_rules, text,
  #                        path: { rule_view: :field_related_rules }
  # end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-1.96.8 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.7 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.6 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.5 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.4 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.3 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.2 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.1 mod/standard/set/self/rules_toolbar_button.rb
card-1.96.0 mod/standard/set/self/rules_toolbar_button.rb
card-1.95.3 mod/standard/set/self/rules_toolbar_button.rb
card-1.95.2 mod/standard/set/self/rules_toolbar_button.rb
card-1.95.1 mod/standard/set/self/rules_toolbar_button.rb
card-1.95.0 mod/standard/set/self/rules_toolbar_button.rb