Class: Smithy::PermittedParams
- Inherits:
-
Struct
- Object
- Struct
- Smithy::PermittedParams
- Defined in:
- app/models/smithy/permitted_params.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #asset_attributes ⇒ Object
- #asset_source_attributes ⇒ Object
- #content_attributes ⇒ Object
- #content_block_attributes ⇒ Object
- #content_block_template_attributes ⇒ Object
- #image_attributes ⇒ Object
- #page_attributes ⇒ Object
- #page_content_attributes ⇒ Object
- #page_list_attributes ⇒ Object
- #params_for(param) ⇒ Object
- #setting_attributes ⇒ Object
- #template_attributes ⇒ Object
- #template_container_attributes ⇒ Object
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params
2 3 4 |
# File 'app/models/smithy/permitted_params.rb', line 2 def params @params end |
#user ⇒ Object
Returns the value of attribute user
2 3 4 |
# File 'app/models/smithy/permitted_params.rb', line 2 def user @user end |
Instance Method Details
#asset_attributes ⇒ Object
15 16 17 |
# File 'app/models/smithy/permitted_params.rb', line 15 def asset_attributes [ :name, :file, :file_name, :file_url, :retained_file, :uploaded_file_url ] end |
#asset_source_attributes ⇒ Object
19 20 21 |
# File 'app/models/smithy/permitted_params.rb', line 19 def asset_source_attributes [ :name, assets_files: [] ] end |
#content_attributes ⇒ Object
23 24 25 |
# File 'app/models/smithy/permitted_params.rb', line 23 def content_attributes [ :content ] end |
#content_block_attributes ⇒ Object
27 28 29 30 |
# File 'app/models/smithy/permitted_params.rb', line 27 def content_block_attributes # [ :name, templates_attributes: [ :id, :name, :content, :_destroy ] ] :all end |
#content_block_template_attributes ⇒ Object
32 33 34 |
# File 'app/models/smithy/permitted_params.rb', line 32 def content_block_template_attributes [ :content, :name ] end |
#image_attributes ⇒ Object
36 37 38 |
# File 'app/models/smithy/permitted_params.rb', line 36 def image_attributes [ :alternate_text, :asset_id, :height, :html_attributes, :image_scaling, :link_url, :width, :content ] end |
#page_attributes ⇒ Object
40 41 42 |
# File 'app/models/smithy/permitted_params.rb', line 40 def page_attributes [ :browser_title, :cache_length, :description, :external_link, :keywords, :permalink, :publish, :published_at, :show_in_navigation, :title, :parent_id, :template_id ] end |
#page_content_attributes ⇒ Object
44 45 46 47 |
# File 'app/models/smithy/permitted_params.rb', line 44 def page_content_attributes # [ :label, :container, :content_block_type, :content_block_template_id, :position ] :all end |
#page_list_attributes ⇒ Object
49 50 51 |
# File 'app/models/smithy/permitted_params.rb', line 49 def page_list_attributes [ :count, :page_template_id, :parent_id, :include_children, :sort ] end |
#params_for(param) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/models/smithy/permitted_params.rb', line 3 def params_for(param) param = param.to_sym attributes = send("#{param.to_s}_attributes".to_sym) if attributes == :all params.fetch(param, {}).permit! elsif attributes.respond_to? :call attributes.call else params.fetch(param, {}).permit( *attributes ) end end |
#setting_attributes ⇒ Object
53 54 55 |
# File 'app/models/smithy/permitted_params.rb', line 53 def setting_attributes [ :name, :value ] end |
#template_attributes ⇒ Object
57 58 59 |
# File 'app/models/smithy/permitted_params.rb', line 57 def template_attributes [ :name, :content, :template_type ] end |
#template_container_attributes ⇒ Object
61 62 63 |
# File 'app/models/smithy/permitted_params.rb', line 61 def template_container_attributes [ :name, :position ] end |