Class: Georgia::PageActionsPresenter
- Defined in:
- app/presenters/georgia/page_actions_presenter.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#page ⇒ Object
Returns the value of attribute page.
-
#revision ⇒ Object
Returns the value of attribute revision.
Attributes inherited from Presenter
Instance Method Summary collapse
- #action_list ⇒ Object
-
#initialize(view, page, revision, options = {}) ⇒ PageActionsPresenter
constructor
A new instance of PageActionsPresenter.
- #to_s ⇒ Object
Constructor Details
#initialize(view, page, revision, options = {}) ⇒ PageActionsPresenter
Returns a new instance of PageActionsPresenter.
6 7 8 9 10 11 |
# File 'app/presenters/georgia/page_actions_presenter.rb', line 6 def initialize view, page, revision, ={} @page = (page.decorated? ? page.object : page) @revision = (revision.decorated? ? revision.object : revision) @options = super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Georgia::Presenter
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'app/presenters/georgia/page_actions_presenter.rb', line 4 def @options end |
#page ⇒ Object
Returns the value of attribute page.
4 5 6 |
# File 'app/presenters/georgia/page_actions_presenter.rb', line 4 def page @page end |
#revision ⇒ Object
Returns the value of attribute revision.
4 5 6 |
# File 'app/presenters/georgia/page_actions_presenter.rb', line 4 def revision @revision end |
Instance Method Details
#action_list ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/presenters/georgia/page_actions_presenter.rb', line 20 def action_list html = ActiveSupport::SafeBuffer.new html << content_tag(:li, link_to_edit) if can?(:edit, page) # html << content_tag(:li, link_to_settings) if can?(:settings, page) html << content_tag(:li, link_to_preview) if can?(:preview, page) html << content_tag(:li, link_to_copy) if can?(:copy, page) html << content_tag(:li, link_to_publish) if can?(:publish, page) and !page.published? html << content_tag(:li, link_to_unpublish) if can?(:unpublish, page) and page.published? html << content_tag(:li, link_to_flush_cache) if can?(:flush_cache, page) html << content_tag(:li, link_to_revisions) if can?(:index, Revision) html end |
#to_s ⇒ Object
13 14 15 16 17 18 |
# File 'app/presenters/georgia/page_actions_presenter.rb', line 13 def to_s content_tag :div, class: 'dropdown' do link_to("Actions #{caret_tag}".html_safe, '#', role: :button, class: 'btn btn-warning', data: {toggle: 'dropdown'}) + content_tag(:ul, action_list, class: 'dropdown-menu', role: :menu) end end |