Class: ActionAdmin::ShortcodePresenter
- Inherits:
-
Object
- Object
- ActionAdmin::ShortcodePresenter
- Includes:
- Presentable
- Defined in:
- app/presenters/action_admin/shortcode_presenter.rb
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(shortcode, context) ⇒ ShortcodePresenter
constructor
A new instance of ShortcodePresenter.
- #render_field(form, field, options = {}) ⇒ Object
- #render_fields(form) ⇒ Object
Constructor Details
#initialize(shortcode, context) ⇒ ShortcodePresenter
5 6 7 8 |
# File 'app/presenters/action_admin/shortcode_presenter.rb', line 5 def initialize(shortcode, context) @shortcode = shortcode @context = context end |
Instance Method Details
#fields ⇒ Object
10 11 12 |
# File 'app/presenters/action_admin/shortcode_presenter.rb', line 10 def fields self.record_fields end |
#render_field(form, field, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/presenters/action_admin/shortcode_presenter.rb', line 14 def render_field(form, field, ={}) = Hash() [:input_html] ||= {} [:input_html][:data] ||= {} [:input_html][:data][:attribute] = field [:input_html][:include_hidden] = false form.input field, end |
#render_fields(form) ⇒ Object
26 27 28 |
# File 'app/presenters/action_admin/shortcode_presenter.rb', line 26 def render_fields(form) fields.map { |f, o| render_field(form, f, o) }.join.html_safe end |