Commit 9cebc1f8 authored by Yorick Peterse's avatar Yorick Peterse

Backport some EE helper changes

This backports some EE changes made to DropdownsHelper and
SelectsHelper. These changes can not easily be moved into an EE specific
module, as doing so would require reimplementing all modified methods.
Since there is no harm in including these changes in CE directly, we
just backport them.
parent b4146c70
......@@ -11,6 +11,10 @@ module DropdownsHelper
dropdown_output = dropdown_toggle(toggle_text, data_attr, options)
if options.key?(:toggle_link)
dropdown_output = dropdown_toggle_link(toggle_text, data_attr, options)
end
dropdown_output << content_tag(:div, class: "dropdown-menu dropdown-select #{options[:dropdown_class] if options.key?(:dropdown_class)}") do
output = []
......@@ -49,6 +53,11 @@ module DropdownsHelper
end
end
def dropdown_toggle_link(toggle_text, data_attr, options = {})
output = content_tag(:a, toggle_text, class: "dropdown-toggle-text #{options[:toggle_class] if options.key?(:toggle_class)}", id: (options[:id] if options.key?(:id)), data: data_attr)
output.html_safe
end
def dropdown_title(title, options: {})
content_tag :div, class: "dropdown-title" do
title_output = []
......
......@@ -29,6 +29,11 @@ module SelectsHelper
classes = Array.wrap(opts[:class])
classes << 'ajax-groups-select'
# EE requires this line to be present, but there is no easy way of injecting
# this into EE without causing merge conflicts. Given this line is very
# simple and not really EE specific on its own, we just include it in CE.
classes << 'multiselect' if opts[:multiple]
opts[:class] = classes.join(' ')
select2_tag(id, opts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment