Class: Storefront::Configuration
- Inherits:
-
Object
- Object
- Storefront::Configuration
- Defined in:
- lib/storefront/configuration.rb
Instance Attribute Summary collapse
-
#active_class ⇒ Object
Returns the value of attribute active_class.
-
#add_label ⇒ Object
Returns the value of attribute add_label.
-
#all_fields_required_by_default ⇒ Object
Returns the value of attribute all_fields_required_by_default.
-
#always_include_error_tag ⇒ Object
Returns the value of attribute always_include_error_tag.
-
#always_include_hint_tag ⇒ Object
Returns the value of attribute always_include_hint_tag.
-
#auto_id_form ⇒ Object
Returns the value of attribute auto_id_form.
-
#auto_id_nav ⇒ Object
Returns the value of attribute auto_id_nav.
-
#breadcrumb ⇒ Object
Returns the value of attribute breadcrumb.
-
#collection_label_methods ⇒ Object
Returns the value of attribute collection_label_methods.
-
#component_suffix ⇒ Object
Returns the value of attribute component_suffix.
-
#content_class ⇒ Object
Returns the value of attribute content_class.
-
#cycle_fields ⇒ Object
Returns the value of attribute cycle_fields.
-
#default_component_header_level ⇒ Object
Returns the value of attribute default_component_header_level.
-
#default_header_level ⇒ Object
Returns the value of attribute default_header_level.
-
#default_text_area_width ⇒ Object
Returns the value of attribute default_text_area_width.
-
#default_text_field_size ⇒ Object
Returns the value of attribute default_text_field_size.
-
#definition_list_partial ⇒ Object
Returns the value of attribute definition_list_partial.
-
#error_class ⇒ Object
Returns the value of attribute error_class.
-
#error_tag ⇒ Object
Returns the value of attribute error_tag.
-
#field ⇒ Object
Returns the value of attribute field.
-
#field_class ⇒ Object
Returns the value of attribute field_class.
-
#field_list_tag ⇒ Object
Returns the value of attribute field_list_tag.
-
#fieldset_class ⇒ Object
Returns the value of attribute fieldset_class.
-
#form_class ⇒ Object
Returns the value of attribute form_class.
-
#header_class ⇒ Object
Returns the value of attribute header_class.
-
#hint_class ⇒ Object
Returns the value of attribute hint_class.
-
#hint_is_popup ⇒ Object
Returns the value of attribute hint_is_popup.
-
#hint_tag ⇒ Object
Returns the value of attribute hint_tag.
-
#i18n_lookups_by_default ⇒ Object
Returns the value of attribute i18n_lookups_by_default.
-
#id_enabled_on ⇒ Object
Returns the value of attribute id_enabled_on.
-
#include_aria ⇒ Object
Returns the value of attribute include_aria.
-
#include_blank_for_select_by_default ⇒ Object
Returns the value of attribute include_blank_for_select_by_default.
-
#inline_validations ⇒ Object
Returns the value of attribute inline_validations.
-
#label_attribute ⇒ Object
Returns the value of attribute label_attribute.
-
#label_class ⇒ Object
Returns the value of attribute label_class.
-
#label_method ⇒ Object
Returns the value of attribute label_method.
-
#legend_class ⇒ Object
Returns the value of attribute legend_class.
-
#list_class ⇒ Object
Returns the value of attribute list_class.
-
#list_partial ⇒ Object
Returns the value of attribute list_partial.
-
#list_tag ⇒ Object
Returns the value of attribute list_tag.
-
#localize_with_inheritance ⇒ Object
Returns the value of attribute localize_with_inheritance.
-
#localize_with_namespace ⇒ Object
Returns the value of attribute localize_with_namespace.
-
#localize_with_nested_model ⇒ Object
Returns the value of attribute localize_with_nested_model.
-
#meta_tags ⇒ Object
Returns the value of attribute meta_tags.
-
#nav_class ⇒ Object
Returns the value of attribute nav_class.
-
#nav_tag ⇒ Object
Returns the value of attribute nav_tag.
-
#optional_abbr ⇒ Object
Returns the value of attribute optional_abbr.
-
#optional_class ⇒ Object
Returns the value of attribute optional_class.
-
#optional_title ⇒ Object
Returns the value of attribute optional_title.
-
#page_header_id ⇒ Object
Returns the value of attribute page_header_id.
-
#page_subtitle_id ⇒ Object
Returns the value of attribute page_subtitle_id.
-
#page_title_id ⇒ Object
Returns the value of attribute page_title_id.
-
#remove_label ⇒ Object
Returns the value of attribute remove_label.
-
#rename_nested_attributes ⇒ Object
Returns the value of attribute rename_nested_attributes.
-
#require_if_validates_presence ⇒ Object
Returns the value of attribute require_if_validates_presence.
-
#required_abbr ⇒ Object
Returns the value of attribute required_abbr.
-
#required_class ⇒ Object
Returns the value of attribute required_class.
-
#required_title ⇒ Object
Returns the value of attribute required_title.
-
#rich_input ⇒ Object
Returns the value of attribute rich_input.
-
#separator ⇒ Object
Returns the value of attribute separator.
-
#submit_fieldset_class ⇒ Object
Returns the value of attribute submit_fieldset_class.
-
#subtitle_class ⇒ Object
Returns the value of attribute subtitle_class.
-
#term_class ⇒ Object
Returns the value of attribute term_class.
-
#term_key_class ⇒ Object
Returns the value of attribute term_key_class.
-
#term_separator ⇒ Object
Returns the value of attribute term_separator.
-
#term_value_class ⇒ Object
Returns the value of attribute term_value_class.
-
#terms_tag ⇒ Object
Returns the value of attribute terms_tag.
-
#title_class ⇒ Object
Returns the value of attribute title_class.
-
#valid_class ⇒ Object
Returns the value of attribute valid_class.
-
#validate_class ⇒ Object
Returns the value of attribute validate_class.
-
#validation_max_limit ⇒ Object
Returns the value of attribute validation_max_limit.
-
#widget_class ⇒ Object
Returns the value of attribute widget_class.
-
#widgets_path ⇒ Object
Returns the value of attribute widgets_path.
Instance Method Summary collapse
- #configure_action_controller ⇒ Object
- #configure_action_view ⇒ Object
- #current_scope ⇒ Object
- #current_scope=(value) ⇒ Object
- #get(key) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/storefront/configuration.rb', line 88 def initialize @component_suffix = "widget" @hint_class = "hint" @hint_tag = :figure @label_class = "label" @required_class = "required" @required_abbr = "*" @required_title = "Required" @error_class = "error" @error_tag = :output @valid_class = nil @optional_class = "optional" @optional_abbr = "" @optional_title = "Optional" @label_method = :humanize @label_attribute = :to_label @validation_max_limit = 255 @default_text_field_size = nil @default_text_area_width = 300 @all_fields_required_by_default = true @field_list_tag = :ol @list_class = "field-list" @separator = "-" @breadcrumb = " - " @include_blank_for_select_by_default = true @collection_label_methods = %w(to_label display_name full_name name title to_s) @i18n_lookups_by_default = true @escape_html_entities_in_hints_and_labels = false @rename_nested_attributes = true @inline_validations = true @auto_id_form = true @fieldset_class = "fieldset" @field_class = "field" @validate_class = "validate" @legend_class = "legend" @form_class = "form" @id_enabled_on = ["input"] # %w(field label error hint) @widgets_path = "shared/widgets" @nav_class = "list-item" @include_aria = true @active_class = "active" @nav_tag = :li @terms_tag = :dl @term_class = "term" @term_key_class = "key" @term_value_class = "value" @hint_is_popup = false @list_tag = :ul @page_header_id = "header" @page_title_id = "title" @auto_id_nav = false @page_subtitle_id = "subtitle" @widget_class = "widget" @header_class = "header" @title_class = "title" @subtitle_class = "subtitle" @content_class = "content" @default_header_level = 3 @term_separator = ":" @rich_input = false @submit_fieldset_class = "submit-fieldset" @add_label = "+" @remove_label = "-" @cycle_fields = false @always_include_hint_tag = false @always_include_error_tag = true @require_if_validates_presence = true @localize_with_namespace = false @localize_with_nested_model = false @localize_with_inheritance = true @default_component_header_level = 3 @meta_tags = [ :description, :keywords, :author, :copyright, :category, :robots ] end |
Instance Attribute Details
#active_class ⇒ Object
Returns the value of attribute active_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def active_class @active_class end |
#add_label ⇒ Object
Returns the value of attribute add_label.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def add_label @add_label end |
#all_fields_required_by_default ⇒ Object
Returns the value of attribute all_fields_required_by_default.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def all_fields_required_by_default @all_fields_required_by_default end |
#always_include_error_tag ⇒ Object
Returns the value of attribute always_include_error_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def always_include_error_tag @always_include_error_tag end |
#always_include_hint_tag ⇒ Object
Returns the value of attribute always_include_hint_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def always_include_hint_tag @always_include_hint_tag end |
#auto_id_form ⇒ Object
Returns the value of attribute auto_id_form.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def auto_id_form @auto_id_form end |
#auto_id_nav ⇒ Object
Returns the value of attribute auto_id_nav.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def auto_id_nav @auto_id_nav end |
#breadcrumb ⇒ Object
Returns the value of attribute breadcrumb.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def @breadcrumb end |
#collection_label_methods ⇒ Object
Returns the value of attribute collection_label_methods.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def collection_label_methods @collection_label_methods end |
#component_suffix ⇒ Object
Returns the value of attribute component_suffix.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def component_suffix @component_suffix end |
#content_class ⇒ Object
Returns the value of attribute content_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def content_class @content_class end |
#cycle_fields ⇒ Object
Returns the value of attribute cycle_fields.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def cycle_fields @cycle_fields end |
#default_component_header_level ⇒ Object
Returns the value of attribute default_component_header_level.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def default_component_header_level @default_component_header_level end |
#default_header_level ⇒ Object
Returns the value of attribute default_header_level.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def default_header_level @default_header_level end |
#default_text_area_width ⇒ Object
Returns the value of attribute default_text_area_width.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def default_text_area_width @default_text_area_width end |
#default_text_field_size ⇒ Object
Returns the value of attribute default_text_field_size.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def default_text_field_size @default_text_field_size end |
#definition_list_partial ⇒ Object
Returns the value of attribute definition_list_partial.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def definition_list_partial @definition_list_partial end |
#error_class ⇒ Object
Returns the value of attribute error_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def error_class @error_class end |
#error_tag ⇒ Object
Returns the value of attribute error_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def error_tag @error_tag end |
#field ⇒ Object
Returns the value of attribute field.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def field @field end |
#field_class ⇒ Object
Returns the value of attribute field_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def field_class @field_class end |
#field_list_tag ⇒ Object
Returns the value of attribute field_list_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def field_list_tag @field_list_tag end |
#fieldset_class ⇒ Object
Returns the value of attribute fieldset_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def fieldset_class @fieldset_class end |
#form_class ⇒ Object
Returns the value of attribute form_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def form_class @form_class end |
#header_class ⇒ Object
Returns the value of attribute header_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def header_class @header_class end |
#hint_class ⇒ Object
Returns the value of attribute hint_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def hint_class @hint_class end |
#hint_is_popup ⇒ Object
Returns the value of attribute hint_is_popup.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def hint_is_popup @hint_is_popup end |
#hint_tag ⇒ Object
Returns the value of attribute hint_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def hint_tag @hint_tag end |
#i18n_lookups_by_default ⇒ Object
Returns the value of attribute i18n_lookups_by_default.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def i18n_lookups_by_default @i18n_lookups_by_default end |
#id_enabled_on ⇒ Object
Returns the value of attribute id_enabled_on.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def id_enabled_on @id_enabled_on end |
#include_aria ⇒ Object
Returns the value of attribute include_aria.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def include_aria @include_aria end |
#include_blank_for_select_by_default ⇒ Object
Returns the value of attribute include_blank_for_select_by_default.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def include_blank_for_select_by_default @include_blank_for_select_by_default end |
#inline_validations ⇒ Object
Returns the value of attribute inline_validations.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def inline_validations @inline_validations end |
#label_attribute ⇒ Object
Returns the value of attribute label_attribute.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def label_attribute @label_attribute end |
#label_class ⇒ Object
Returns the value of attribute label_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def label_class @label_class end |
#label_method ⇒ Object
Returns the value of attribute label_method.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def label_method @label_method end |
#legend_class ⇒ Object
Returns the value of attribute legend_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def legend_class @legend_class end |
#list_class ⇒ Object
Returns the value of attribute list_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def list_class @list_class end |
#list_partial ⇒ Object
Returns the value of attribute list_partial.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def list_partial @list_partial end |
#list_tag ⇒ Object
Returns the value of attribute list_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def list_tag @list_tag end |
#localize_with_inheritance ⇒ Object
Returns the value of attribute localize_with_inheritance.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def localize_with_inheritance @localize_with_inheritance end |
#localize_with_namespace ⇒ Object
Returns the value of attribute localize_with_namespace.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def localize_with_namespace @localize_with_namespace end |
#localize_with_nested_model ⇒ Object
Returns the value of attribute localize_with_nested_model.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def localize_with_nested_model @localize_with_nested_model end |
#meta_tags ⇒ Object
Returns the value of attribute meta_tags.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def @meta_tags end |
#nav_class ⇒ Object
Returns the value of attribute nav_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def nav_class @nav_class end |
#nav_tag ⇒ Object
Returns the value of attribute nav_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def nav_tag @nav_tag end |
#optional_abbr ⇒ Object
Returns the value of attribute optional_abbr.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def optional_abbr @optional_abbr end |
#optional_class ⇒ Object
Returns the value of attribute optional_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def optional_class @optional_class end |
#optional_title ⇒ Object
Returns the value of attribute optional_title.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def optional_title @optional_title end |
#page_header_id ⇒ Object
Returns the value of attribute page_header_id.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def page_header_id @page_header_id end |
#page_subtitle_id ⇒ Object
Returns the value of attribute page_subtitle_id.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def page_subtitle_id @page_subtitle_id end |
#page_title_id ⇒ Object
Returns the value of attribute page_title_id.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def page_title_id @page_title_id end |
#remove_label ⇒ Object
Returns the value of attribute remove_label.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def remove_label @remove_label end |
#rename_nested_attributes ⇒ Object
Returns the value of attribute rename_nested_attributes.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def rename_nested_attributes @rename_nested_attributes end |
#require_if_validates_presence ⇒ Object
Returns the value of attribute require_if_validates_presence.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def require_if_validates_presence @require_if_validates_presence end |
#required_abbr ⇒ Object
Returns the value of attribute required_abbr.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def required_abbr @required_abbr end |
#required_class ⇒ Object
Returns the value of attribute required_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def required_class @required_class end |
#required_title ⇒ Object
Returns the value of attribute required_title.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def required_title @required_title end |
#rich_input ⇒ Object
Returns the value of attribute rich_input.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def rich_input @rich_input end |
#separator ⇒ Object
Returns the value of attribute separator.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def separator @separator end |
#submit_fieldset_class ⇒ Object
Returns the value of attribute submit_fieldset_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def submit_fieldset_class @submit_fieldset_class end |
#subtitle_class ⇒ Object
Returns the value of attribute subtitle_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def subtitle_class @subtitle_class end |
#term_class ⇒ Object
Returns the value of attribute term_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def term_class @term_class end |
#term_key_class ⇒ Object
Returns the value of attribute term_key_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def term_key_class @term_key_class end |
#term_separator ⇒ Object
Returns the value of attribute term_separator.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def term_separator @term_separator end |
#term_value_class ⇒ Object
Returns the value of attribute term_value_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def term_value_class @term_value_class end |
#terms_tag ⇒ Object
Returns the value of attribute terms_tag.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def terms_tag @terms_tag end |
#title_class ⇒ Object
Returns the value of attribute title_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def title_class @title_class end |
#valid_class ⇒ Object
Returns the value of attribute valid_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def valid_class @valid_class end |
#validate_class ⇒ Object
Returns the value of attribute validate_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def validate_class @validate_class end |
#validation_max_limit ⇒ Object
Returns the value of attribute validation_max_limit.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def validation_max_limit @validation_max_limit end |
#widget_class ⇒ Object
Returns the value of attribute widget_class.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def @widget_class end |
#widgets_path ⇒ Object
Returns the value of attribute widgets_path.
13 14 15 |
# File 'lib/storefront/configuration.rb', line 13 def @widgets_path end |
Instance Method Details
#configure_action_controller ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/storefront/configuration.rb', line 190 def configure_action_controller base = "#{File.(File.dirname(__FILE__))}/helpers" Dir["#{base}/*"].each do |path| next if File.directory?(path) || File.basename(path) =~ /(form|table|dashboard)/ # need to do these as traditional helper declarations somehow constant_name = File.basename(path, File.extname(path)).gsub("/", "::").camelize ActionController::Base.send :include, "Storefront::Helpers::#{constant_name}".constantize end ActionController::Base.send :before_filter, :configure_storefront end |
#configure_action_view ⇒ Object
181 182 183 184 185 186 187 188 |
# File 'lib/storefront/configuration.rb', line 181 def configure_action_view base = "#{File.(File.dirname(__FILE__))}/helpers" Dir["#{base}/*"].each do |path| next if File.directory?(path) constant_name = File.basename(path, File.extname(path)).gsub("/", "::").camelize ActionView::Base.send :include, "Storefront::Helpers::#{constant_name}".constantize end end |
#current_scope ⇒ Object
173 174 175 |
# File 'lib/storefront/configuration.rb', line 173 def current_scope Thread.current[:storefront] end |
#current_scope=(value) ⇒ Object
177 178 179 |
# File 'lib/storefront/configuration.rb', line 177 def current_scope=(value) Thread.current[:storefront] = value end |
#get(key) ⇒ Object
169 170 171 |
# File 'lib/storefront/configuration.rb', line 169 def get(key) send(key).respond_to?(:call) ? send(key).call : send(key) end |