Module: Golden::Setting::SettingsHelper
- Defined in:
- app/helpers/golden/setting/settings_helper.rb
Instance Method Summary collapse
- #setting_field_types ⇒ Object
- #setting_field_values(collection) ⇒ Object
- #setting_groups ⇒ Object
- #setting_name(name) ⇒ Object
- #setting_selectable?(field_type) ⇒ Boolean
- #settings_nav_tab(name, default) ⇒ Object
- #settings_tab_pane(name, default, &block) ⇒ Object
- #skip_setting?(setting) ⇒ Boolean
- #skip_setting_group?(group) ⇒ Boolean
Instance Method Details
#setting_field_types ⇒ Object
8 9 10 11 12 13 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 8 def setting_field_types Golden::Setting.field_types.map do |key, value| next if key.nil? or value.nil? [I18n.t(key, scope: 'golden.setting.field_types'), value.to_sym] end end |
#setting_field_values(collection) ⇒ Object
15 16 17 18 19 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 15 def setting_field_values collection return unless collection.present? return collection unless collection.respond_to? :id (collection, :id, :to_s, object.value) end |
#setting_groups ⇒ Object
21 22 23 24 25 26 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 21 def setting_groups Golden::Setting.groups.map do |key, value| next if key.nil? or value.nil? [I18n.t(key, scope: 'golden.setting.groups'), value.to_s] end end |
#setting_name(name) ⇒ Object
28 29 30 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 28 def setting_name name I18n.t(name, scope: 'golden.setting.names') end |
#setting_selectable?(field_type) ⇒ Boolean
4 5 6 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 4 def setting_selectable? field_type !%w{string boolean}.include? field_type end |
#settings_nav_tab(name, default) ⇒ Object
32 33 34 35 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 32 def settings_nav_tab name, default text = I18n.t(name, scope: 'golden.setting.groups') nav_tab text, "settings-#{name}", "settings-#{default}" end |
#settings_tab_pane(name, default, &block) ⇒ Object
37 38 39 |
# File 'app/helpers/golden/setting/settings_helper.rb', line 37 def settings_tab_pane name, default, &block tab_pane "settings-#{name}", "settings-#{default}", &block end |