Class: TinyAdmin::Actions::Show
- Inherits:
-
BasicAction
- Object
- BasicAction
- TinyAdmin::Actions::Show
- Defined in:
- lib/tiny_admin/actions/show.rb
Instance Method Summary collapse
Methods inherited from BasicAction
Methods included from Utils
#humanize, #params_to_s, #prepare_page, #to_class
Instance Method Details
#call(app:, context:, options:) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tiny_admin/actions/show.rb', line 6 def call(app:, context:, options:) = ([:attributes]) repository = context.repository record = repository.find(context.reference) prepare_record = ->(record_data) { repository.show_record_attrs(record_data, fields: ) } attributes = { actions: context.actions, fields: repository.fields(options: ), prepare_record: prepare_record, record: record, reference: context.reference, slug: context.slug, title: repository.show_title(record), widgets: [:widgets] } prepare_page(Views::Actions::Show, slug: context.slug, attributes: attributes) rescue Plugins::BaseRepository::RecordNotFound => _e prepare_page([:record_not_found_page] || Views::Pages::RecordNotFound) end |