Class: Hyrax::PresenterRenderer
- Inherits:
-
Object
- Object
- Hyrax::PresenterRenderer
- Includes:
- ActionView::Helpers::TranslationHelper
- Defined in:
- app/presenters/hyrax/presenter_renderer.rb
Instance Method Summary collapse
-
#initialize(presenter, view_context) ⇒ PresenterRenderer
constructor
A new instance of PresenterRenderer.
- #label(field) ⇒ Object
-
#value(field_name, locals = {}) ⇒ ActiveSupport::SafeBuffer
Renders a collection field partial.
Constructor Details
#initialize(presenter, view_context) ⇒ PresenterRenderer
Returns a new instance of PresenterRenderer.
6 7 8 9 |
# File 'app/presenters/hyrax/presenter_renderer.rb', line 6 def initialize(presenter, view_context) @presenter = presenter @view_context = view_context end |
Instance Method Details
#label(field) ⇒ Object
19 20 21 22 23 |
# File 'app/presenters/hyrax/presenter_renderer.rb', line 19 def label(field) t(:"#{model_name.param_key}.#{field}", scope: label_scope, default: [:"defaults.#{field}", field.to_s.humanize]).presence end |
#value(field_name, locals = {}) ⇒ ActiveSupport::SafeBuffer
Renders a collection field partial
15 16 17 |
# File 'app/presenters/hyrax/presenter_renderer.rb', line 15 def value(field_name, locals = {}) render_show_field_partial(field_name, locals) end |