Class: Decidim::Newsletter
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::Newsletter
- Includes:
- Loggable, Traceable, TranslatableResource
- Defined in:
- decidim-core/app/models/decidim/newsletter.rb
Overview
This model holds all the data needed to send a newsletter.
Class Method Summary collapse
Instance Method Summary collapse
- #notifications_settings_url ⇒ Object
- #organization_official_url ⇒ Object
-
#sent? ⇒ Boolean
Returns true if this newsletter was already sent.
- #sent_to_all_users? ⇒ Boolean
- #sent_to_followers? ⇒ Boolean
- #sent_to_participants? ⇒ Boolean
- #sent_to_participatory_spaces ⇒ Object
- #sent_to_private_members? ⇒ Boolean
- #sent_to_users_with_verification_types ⇒ Object
- #sent_to_verified_users? ⇒ Boolean
- #template ⇒ Object
- #unsubscribe_newsletters_url ⇒ Object
- #url ⇒ Object
Class Method Details
.log_presenter_class_for(_log) ⇒ Object
18 19 20 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 18 def self.log_presenter_class_for(_log) Decidim::AdminLog::NewsletterPresenter end |
Instance Method Details
#notifications_settings_url ⇒ Object
67 68 69 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 67 def notifications_settings_url(**) proxy_url(__method__, **) end |
#organization_official_url ⇒ Object
75 76 77 78 79 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 75 def organization_official_url return "#" unless sent? organization.official_url || proxy_url(:root_url) end |
#sent? ⇒ Boolean
Returns true if this newsletter was already sent.
Returns a Boolean.
25 26 27 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 25 def sent? sent_at.present? end |
#sent_to_all_users? ⇒ Boolean
29 30 31 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 29 def sent_to_all_users? extended_data["send_to_all_users"] end |
#sent_to_followers? ⇒ Boolean
41 42 43 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 41 def sent_to_followers? extended_data["send_to_followers"] end |
#sent_to_participants? ⇒ Boolean
45 46 47 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 45 def sent_to_participants? extended_data["send_to_participants"] end |
#sent_to_participatory_spaces ⇒ Object
49 50 51 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 49 def sent_to_participatory_spaces extended_data["participatory_space_types"] end |
#sent_to_private_members? ⇒ Boolean
53 54 55 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 53 def sent_to_private_members? extended_data["send_to_private_members"] end |
#sent_to_users_with_verification_types ⇒ Object
37 38 39 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 37 def sent_to_users_with_verification_types extended_data["verification_types"] end |
#sent_to_verified_users? ⇒ Boolean
33 34 35 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 33 def sent_to_verified_users? extended_data["send_to_verified_users"] end |
#template ⇒ Object
57 58 59 60 61 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 57 def template @template ||= Decidim::ContentBlock .for_scope(:newsletter_template, organization:) .find_by(scoped_resource_id: id) end |
#unsubscribe_newsletters_url ⇒ Object
71 72 73 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 71 def (**) proxy_url(__method__, **) end |
#url ⇒ Object
63 64 65 |
# File 'decidim-core/app/models/decidim/newsletter.rb', line 63 def url(**) proxy_url(:newsletter_url, id:, **) end |