Module: SettingsHelper
- Defined in:
- app/helpers/settings_helper.rb
Overview
Redmine - project management software Copyright © 2006-2009 Jean-Philippe Lang
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Instance Method Summary collapse
- #administration_settings_tabs ⇒ Object
-
#notification_field(notifiable) ⇒ Object
Renders a notification field for a Redmine::Notifiable option.
- #setting_check_box(setting, options = {}) ⇒ Object
- #setting_label(setting, options = {}) ⇒ Object
- #setting_multiselect(setting, choices, options = {}) ⇒ Object
- #setting_select(setting, choices, options = {}) ⇒ Object
- #setting_text_area(setting, options = {}) ⇒ Object
- #setting_text_field(setting, options = {}) ⇒ Object
Instance Method Details
#administration_settings_tabs ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/helpers/settings_helper.rb', line 19 def administration_settings_tabs tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general}, {:name => 'display', :partial => 'settings/display', :label => :label_display}, {:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication}, {:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural}, {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking}, {:name => 'notifications', :partial => 'settings/notifications', :label => :field_mail_notification}, {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => :label_incoming_emails}, {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} ] end |
#notification_field(notifiable) ⇒ Object
Renders a notification field for a Redmine::Notifiable option
76 77 78 79 80 81 82 83 |
# File 'app/helpers/settings_helper.rb', line 76 def notification_field(notifiable) return content_tag(:label, check_box_tag('settings[notified_events][]', notifiable.name, Setting.notified_events.include?(notifiable.name)) + l_or_humanize(notifiable.name, :prefix => 'label_'), :class => notifiable.parent.present? ? "parent" : '') end |
#setting_check_box(setting, options = {}) ⇒ Object
64 65 66 67 68 |
# File 'app/helpers/settings_helper.rb', line 64 def setting_check_box(setting, ={}) setting_label(setting, ) + hidden_field_tag("settings[#{setting}]", 0) + check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), ) end |
#setting_label(setting, options = {}) ⇒ Object
70 71 72 73 |
# File 'app/helpers/settings_helper.rb', line 70 def setting_label(setting, ={}) label = .delete(:label) label != false ? content_tag("label", l(label || "setting_#{setting}")) : '' end |
#setting_multiselect(setting, choices, options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/helpers/settings_helper.rb', line 39 def setting_multiselect(setting, choices, ={}) setting_values = Setting.send(setting) setting_values = [] unless setting_values.is_a?(Array) setting_label(setting, ) + hidden_field_tag("settings[#{setting}][]", '') + choices.collect do |choice| text, value = (choice.is_a?(Array) ? choice : [choice, choice]) content_tag('label', check_box_tag("settings[#{setting}][]", value, Setting.send(setting).include?(value)) + text.to_s, :class => 'block' ) end.join end |
#setting_select(setting, choices, options = {}) ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/helpers/settings_helper.rb', line 31 def setting_select(setting, choices, ={}) if blank_text = .delete(:blank) choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices end setting_label(setting, ) + select_tag("settings[#{setting}]", (choices, Setting.send(setting).to_s), ) end |
#setting_text_area(setting, options = {}) ⇒ Object
59 60 61 62 |
# File 'app/helpers/settings_helper.rb', line 59 def setting_text_area(setting, ={}) setting_label(setting, ) + text_area_tag("settings[#{setting}]", Setting.send(setting), ) end |
#setting_text_field(setting, options = {}) ⇒ Object
54 55 56 57 |
# File 'app/helpers/settings_helper.rb', line 54 def setting_text_field(setting, ={}) setting_label(setting, ) + text_field_tag("settings[#{setting}]", Setting.send(setting), ) end |