Class: Decidim::Admin::FakeNewsletter
- Inherits:
-
Object
- Object
- Decidim::Admin::FakeNewsletter
- Defined in:
- app/models/decidim/admin/fake_newsletter.rb
Overview
This class is used to generate fake newsletters and data to preview newsletter templates.
Instance Method Summary collapse
- #draft? ⇒ Boolean
- #id ⇒ Object
-
#initialize(organization, manifest) ⇒ FakeNewsletter
constructor
A new instance of FakeNewsletter.
- #notifications_settings_url(**_) ⇒ Object
- #organization_official_url ⇒ Object
- #sent_at ⇒ Object
- #subject ⇒ Object
- #template ⇒ Object
- #unsubscribe_newsletters_url(**_) ⇒ Object
- #url(**_) ⇒ Object
Constructor Details
#initialize(organization, manifest) ⇒ FakeNewsletter
Returns a new instance of FakeNewsletter.
8 9 10 11 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 8 def initialize(organization, manifest) @organization = organization @manifest = manifest end |
Instance Method Details
#draft? ⇒ Boolean
44 45 46 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 44 def draft? true end |
#id ⇒ Object
13 14 15 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 13 def id 1 end |
#notifications_settings_url(**_) ⇒ Object
52 53 54 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 52 def notifications_settings_url(**_) "#" end |
#organization_official_url ⇒ Object
60 61 62 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 60 def organization_official_url "#" end |
#sent_at ⇒ Object
40 41 42 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 40 def sent_at nil end |
#subject ⇒ Object
34 35 36 37 38 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 34 def subject organization.available_locales.inject({}) do |acc, locale| acc.update(locale => "Lorem ipsum") end end |
#template ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 17 def template @template ||= Decidim::ContentBlock.new( in_preview: true, manifest_name: manifest.name, scope_name: :newsletter_template, settings: manifest.settings.attributes.inject({}) do |acc, (name, attrs)| value = if attrs.preview.respond_to?(:call) attrs.preview.call else attrs.preview end acc.update(name => value) end ) end |
#unsubscribe_newsletters_url(**_) ⇒ Object
56 57 58 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 56 def (**_) "#" end |
#url(**_) ⇒ Object
48 49 50 |
# File 'app/models/decidim/admin/fake_newsletter.rb', line 48 def url(**_) "#" end |