Class: LinkedRails::Actions::List
- Inherits:
-
Object
- Object
- LinkedRails::Actions::List
- Includes:
- ActiveModel::Model, Model
- Defined in:
- app/models/linked_rails/actions/list.rb
Constant Summary
Constants included from Model::Collections
Model::Collections::COLLECTION_CUSTOMIZABLE_OPTIONS, Model::Collections::COLLECTION_OPTIONS, Model::Collections::COLLECTION_STATIC_OPTIONS
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#user_context ⇒ Object
Returns the value of attribute user_context.
Class Method Summary collapse
- .collection_actions ⇒ Object
- .defined_actions ⇒ Object
- .resource_actions ⇒ Object
- .singular_actions ⇒ Object
Instance Method Summary collapse
Methods included from Model
Methods included from Model::Singularable
#root_relative_iri, #root_relative_singular_iri, #singular_iri, #singular_iri?, #singular_iri_opts, #singular_iri_template, #singular_resource?
Methods included from Model::Serialization
#preview_includes, #show_includes
Methods included from Model::Menuable
Methods included from Model::IRI
#anonymous_iri, #anonymous_iri?, #iri, #iri_elements, #iri_opts, #rdf_type, #reload, #root_relative_iri, #route_fragment
Methods included from Model::Enhancements
Methods included from Model::Dirty
Methods included from Model::Collections
#collection_for, #collection_iri, #collection_options_for, #collection_root_relative_iri, #parent_collections
Methods included from Model::Actionable
#action_list, #action_triples, #collection_actions, #favorite_actions
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
11 12 13 |
# File 'app/models/linked_rails/actions/list.rb', line 11 def resource @resource end |
#user_context ⇒ Object
Returns the value of attribute user_context.
11 12 13 |
# File 'app/models/linked_rails/actions/list.rb', line 11 def user_context @user_context end |
Class Method Details
.collection_actions ⇒ Object
53 54 55 |
# File 'app/models/linked_rails/actions/list.rb', line 53 def collection_actions defined_actions[:collection] end |
.defined_actions ⇒ Object
57 58 59 60 |
# File 'app/models/linked_rails/actions/list.rb', line 57 def defined_actions initialize_actions _defined_actions || initial_defined_actions end |
.resource_actions ⇒ Object
62 63 64 |
# File 'app/models/linked_rails/actions/list.rb', line 62 def resource_actions defined_actions[:resource] end |
.singular_actions ⇒ Object
66 67 68 |
# File 'app/models/linked_rails/actions/list.rb', line 66 def singular_actions defined_actions[:singular] end |
Instance Method Details
#action(tag) ⇒ Object
18 19 20 |
# File 'app/models/linked_rails/actions/list.rb', line 18 def action(tag) action_item(tag, defined_actions[tag].dup) if defined_actions.key?(tag) end |
#actions ⇒ Object
14 15 16 |
# File 'app/models/linked_rails/actions/list.rb', line 14 def actions @actions ||= defined_actions.map { |tag, opts| action_item(tag, opts.dup) }.select(&:available?) end |
#defined_actions ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/models/linked_rails/actions/list.rb', line 22 def defined_actions if resource.is_a?(LinkedRails.collection_class) self.class.collection_actions elsif resource.try(:singular_resource?) self.class.singular_actions else self.class.resource_actions end end |