Class: Decidim::ActionDelegator::SettingPresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Decidim::ActionDelegator::SettingPresenter
- Includes:
- TranslationsHelper
- Defined in:
- app/presenters/decidim/action_delegator/setting_presenter.rb
Instance Method Summary collapse
-
#initialize(setting) ⇒ SettingPresenter
constructor
A new instance of SettingPresenter.
- #path_for(resource) ⇒ Object
- #translated_description ⇒ Object
- #translated_resources_list ⇒ Object
- #translated_title ⇒ Object
Constructor Details
#initialize(setting) ⇒ SettingPresenter
Returns a new instance of SettingPresenter.
8 9 10 11 12 |
# File 'app/presenters/decidim/action_delegator/setting_presenter.rb', line 8 def initialize(setting) @setting = setting super end |
Instance Method Details
#path_for(resource) ⇒ Object
26 27 28 29 30 |
# File 'app/presenters/decidim/action_delegator/setting_presenter.rb', line 26 def path_for(resource) return nil unless resource Decidim::ResourceLocatorPresenter.new(resource).path end |
#translated_description ⇒ Object
18 19 20 |
# File 'app/presenters/decidim/action_delegator/setting_presenter.rb', line 18 def translated_description ActionView::Base.full_sanitizer.sanitize(translated_attribute(__getobj__.description)).html_safe end |
#translated_resources_list ⇒ Object
22 23 24 |
# File 'app/presenters/decidim/action_delegator/setting_presenter.rb', line 22 def translated_resources_list Decidim::ActionDelegator::AuthorizedResources.new(setting: self).query.map(&:presenter) end |
#translated_title ⇒ Object
14 15 16 |
# File 'app/presenters/decidim/action_delegator/setting_presenter.rb', line 14 def translated_title translated_attribute(__getobj__.title).html_safe end |