Class: ViewablePresenter

Inherits:
BasePresenter show all
Defined in:
app/presenters/viewable_presenter.rb

Instance Attribute Summary

Attributes inherited from BasePresenter

#context, #model

Instance Method Summary collapse

Methods inherited from BasePresenter

#initialize, #method_missing, #respond_to?

Constructor Details

This class inherits a constructor from BasePresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BasePresenter

Instance Method Details



2
3
4
5
6
7
8
9
10
# File 'app/presenters/viewable_presenter.rb', line 2

def edit_link(name = nil)
  return unless h.cms_edit_mode?

  h.link_to edit_path, class: "cms-edit cms-edit-#{dashed_name}", 'data-no-turbolink' => true do
    h.concat h.(:span, h.t('cms.edit'), class: "cms-edit-action")
    h.concat " "
    h.concat h.(:span, name, class: "cms-edit-name")
  end
end

#li_sortable_tag(options = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'app/presenters/viewable_presenter.rb', line 12

def li_sortable_tag(options = nil)
  options ||= {}
  if h.cms_edit_mode?
    options = h.cms_data_js('cms-sortable-id', m.unique_key.id, options)
  end
  h. :li, options do
    yield
  end
end