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
- #promotes_something? ⇒ Boolean
- #promotion_choice ⇒ Object
- #promotion_choice=(value) ⇒ Object
- #promotion_choice_key ⇒ Object
- #promotion_choice_url ⇒ Object
- #promotion_choice_url=(value) ⇒ Object
Instance Method Details
#promotes_something? ⇒ Boolean
23 24 25 |
# File 'lib/govuk_content_models/presentation_toggles.rb', line 23 def promotes_something? promotion_choice != 'none' end |
#promotion_choice ⇒ Object
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_key ⇒ Object
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_url ⇒ Object
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 |