Class: Decidim::ActionDelegator::SettingPresenter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
TranslationsHelper
Defined in:
app/presenters/decidim/action_delegator/setting_presenter.rb

Instance Method Summary collapse

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_descriptionObject



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_listObject



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_titleObject



14
15
16
# File 'app/presenters/decidim/action_delegator/setting_presenter.rb', line 14

def translated_title
  translated_attribute(__getobj__.title).html_safe
end