Module: PresentationToggles

Extended by:
ActiveSupport::Concern
Included in:
CompletedTransactionEdition
Defined in:
lib/govuk_content_models/presentation_toggles.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#promotes_something?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/govuk_content_models/presentation_toggles.rb', line 23

def promotes_something?
  promotion_choice != 'none'
end

#promotion_choiceObject



18
19
20
21
# File 'lib/govuk_content_models/presentation_toggles.rb', line 18

def promotion_choice
  choice = promotion_choice_key["choice"]
  choice.empty? ? "none" : choice
end

#promotion_choice=(value) ⇒ Object



10
11
12
# File 'lib/govuk_content_models/presentation_toggles.rb', line 10

def promotion_choice=(value)
  promotion_choice_key["choice"] = value
end

#promotion_choice_keyObject



31
32
33
34
35
36
# File 'lib/govuk_content_models/presentation_toggles.rb', line 31

def promotion_choice_key
  unless presentation_toggles.key? 'promotion_choice'
    presentation_toggles['promotion_choice'] = self.class.default_presentation_toggles['promotion_choice']
  end
  presentation_toggles['promotion_choice']
end

#promotion_choice_urlObject



27
28
29
# File 'lib/govuk_content_models/presentation_toggles.rb', line 27

def promotion_choice_url
  promotion_choice_key["url"]
end

#promotion_choice_url=(value) ⇒ Object



14
15
16
# File 'lib/govuk_content_models/presentation_toggles.rb', line 14

def promotion_choice_url=(value)
  promotion_choice_key['url'] = value
end