Module: Avo::Fields::FieldExtensions::VisibleOnDifferentViews
- Included in:
- Avo::Fields::Field
- Defined in:
- lib/avo/app/fields/field_extensions/visible_in_different_views.rb
Instance Attribute Summary collapse
-
#show_on_create ⇒ Object
Returns the value of attribute show_on_create.
-
#show_on_edit ⇒ Object
Returns the value of attribute show_on_edit.
-
#show_on_index ⇒ Object
Returns the value of attribute show_on_index.
-
#show_on_show ⇒ Object
Returns the value of attribute show_on_show.
Instance Method Summary collapse
- #except_on(*where) ⇒ Object
- #hide_on(*where) ⇒ Object
- #initialize(id, **args, &block) ⇒ Object
- #only_on(*where) ⇒ Object
- #show_on(*where) ⇒ Object
Instance Attribute Details
#show_on_create ⇒ Object
Returns the value of attribute show_on_create.
7 8 9 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 7 def show_on_create @show_on_create end |
#show_on_edit ⇒ Object
Returns the value of attribute show_on_edit.
8 9 10 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 8 def show_on_edit @show_on_edit end |
#show_on_index ⇒ Object
Returns the value of attribute show_on_index.
5 6 7 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 5 def show_on_index @show_on_index end |
#show_on_show ⇒ Object
Returns the value of attribute show_on_show.
6 7 8 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 6 def show_on_show @show_on_show end |
Instance Method Details
#except_on(*where) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 36 def except_on(*where) show_on_all normalize_views(where).flatten.each do |view| show_on_view view end end |
#hide_on(*where) ⇒ Object
23 24 25 26 27 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 23 def hide_on(*where) normalize_views(where).flatten.each do |view| hide_on_view view end end |
#initialize(id, **args, &block) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 10 def initialize(id, **args, &block) @show_on_index = @show_on_index.nil? ? true : @show_on_index @show_on_show = @show_on_show.nil? ? true : @show_on_show @show_on_create = @show_on_create.nil? ? true : @show_on_create @show_on_edit = @show_on_edit.nil? ? true : @show_on_edit end |
#only_on(*where) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 29 def only_on(*where) hide_on_all normalize_views(where).flatten.each do |view| show_on_view view end end |
#show_on(*where) ⇒ Object
17 18 19 20 21 |
# File 'lib/avo/app/fields/field_extensions/visible_in_different_views.rb', line 17 def show_on(*where) normalize_views(where).flatten.each do |view| show_on_view view end end |