Module: RateUsersHelperPatch::InstanceMethods
- Defined in:
- lib/rate_users_helper_patch.rb
Instance Method Summary collapse
-
#project_options_for_select_with_selected(projects, selected = nil) ⇒ Object
Similar to
project_options_for_select
but allows selecting the active value. -
#user_settings_tabs_with_rate_tab ⇒ Object
Adds a rates tab to the user administration page.
Instance Method Details
#project_options_for_select_with_selected(projects, selected = nil) ⇒ Object
Similar to project_options_for_select
but allows selecting the active value
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rate_users_helper_patch.rb', line 18 def (projects, selected = nil) = content_tag('option', "--- #{l(:rate_label_default)} ---", :value => '') projects_by_root = projects.group_by(&:root) projects_by_root.keys.sort.each do |root| root_selected = (root == selected) ? 'selected' : nil << content_tag('option', h(root.name), :value => root.id, :disabled => (!projects.include?(root)), :selected => root_selected) projects_by_root[root].sort.each do |project| next if project == root child_selected = (project == selected) ? 'selected' : nil << content_tag('option', '» ' + h(project.name), :value => project.id, :selected => child_selected) end end end |
#user_settings_tabs_with_rate_tab ⇒ Object
Adds a rates tab to the user administration page
11 12 13 14 15 |
# File 'lib/rate_users_helper_patch.rb', line 11 def user_settings_tabs_with_rate_tab tabs = user_settings_tabs_without_rate_tab tabs << { :name => 'rates', :partial => 'users/rates', :label => :rate_label_rate_history} return tabs end |