effective_events 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_event_notifications_datatable.rb +10 -3
- data/app/models/effective/event_notification.rb +12 -10
- data/app/views/admin/event_notifications/_form.html.haml +2 -21
- data/db/migrate/101_create_effective_events.rb +4 -0
- data/lib/effective_events/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: aeed000b9c4ccbe02f6fcc29eb381caf0612cb8c7caa35155e3b122299dcddd9
         | 
| 4 | 
            +
              data.tar.gz: d4556b21e76cdb1484a315d4f9b74cdaea405f9fc569c0794b1f0946d8c6a54f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a744ca3b393c87820ed2aa100bf9ea01e92d41688cbbd6c84412d5eafae3f74d8e3ea7af7900f45e7e6f810f47b51f34e6335a89983a39100948fdba21a2db32
         | 
| 7 | 
            +
              data.tar.gz: e9f1bbe0bc3931f7f41c761eb502f50913259bb2f7dd22b315573d7c7c5e92fcf8b6260de7e631f36e9ab0f9ea6797a1687ae8c96fed065b6076bce7a0ef0337
         | 
| @@ -12,7 +12,10 @@ class Admin::EffectiveEventNotificationsDatatable < Effective::Datatable | |
| 12 12 |  | 
| 13 13 | 
             
                col :event
         | 
| 14 14 | 
             
                col :category
         | 
| 15 | 
            -
             | 
| 15 | 
            +
             | 
| 16 | 
            +
                col :from, visible: false do |notification|
         | 
| 17 | 
            +
                  ERB::Util.html_escape_once(notification.from)
         | 
| 18 | 
            +
                end
         | 
| 16 19 |  | 
| 17 20 | 
             
                # col :reminder do |poll_notification|
         | 
| 18 21 | 
             
                #   case poll_notification.category
         | 
| @@ -37,8 +40,12 @@ class Admin::EffectiveEventNotificationsDatatable < Effective::Datatable | |
| 37 40 | 
             
                  simple_format(notification.body)
         | 
| 38 41 | 
             
                end
         | 
| 39 42 |  | 
| 40 | 
            -
                 | 
| 41 | 
            -
                 | 
| 43 | 
            +
                col :cc, visible: false
         | 
| 44 | 
            +
                col :bcc, visible: false
         | 
| 45 | 
            +
                col :content_type, visible: false
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                col :started_at, visible: false
         | 
| 48 | 
            +
                col :completed_at
         | 
| 42 49 |  | 
| 43 50 | 
             
                actions_col
         | 
| 44 51 | 
             
              end
         | 
| @@ -2,6 +2,7 @@ module Effective | |
| 2 2 | 
             
              class EventNotification < ActiveRecord::Base
         | 
| 3 3 | 
             
                self.table_name = (EffectiveEvents.event_notifications_table_name || :event_notifications).to_s
         | 
| 4 4 |  | 
| 5 | 
            +
                acts_as_email_notification # effective_resources
         | 
| 5 6 | 
             
                log_changes(to: :event) if respond_to?(:log_changes)
         | 
| 6 7 |  | 
| 7 8 | 
             
                belongs_to :event
         | 
| @@ -54,6 +55,10 @@ module Effective | |
| 54 55 | 
             
                  subject           :string
         | 
| 55 56 | 
             
                  body              :text
         | 
| 56 57 |  | 
| 58 | 
            +
                  cc                :string
         | 
| 59 | 
            +
                  bcc               :string
         | 
| 60 | 
            +
                  content_type      :string
         | 
| 61 | 
            +
             | 
| 57 62 | 
             
                  # Tracking background jobs email send out
         | 
| 58 63 | 
             
                  started_at        :datetime
         | 
| 59 64 | 
             
                  completed_at      :datetime
         | 
| @@ -72,13 +77,6 @@ module Effective | |
| 72 77 |  | 
| 73 78 | 
             
                validates :category, presence: true, inclusion: { in: CATEGORIES }
         | 
| 74 79 |  | 
| 75 | 
            -
                validates :from, presence: true, email: true
         | 
| 76 | 
            -
                validates :subject, presence: true
         | 
| 77 | 
            -
                validates :body, presence: true
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                validates :body, liquid: true
         | 
| 80 | 
            -
                validates :subject, liquid: true
         | 
| 81 | 
            -
             | 
| 82 80 | 
             
                # validates :reminder, if: -> { reminder? || upcoming_reminder? || before_event_ends? },
         | 
| 83 81 | 
             
                #   presence: true, uniqueness: { scope: [:event_id, :category], message: 'already exists' }
         | 
| 84 82 |  | 
| @@ -147,10 +145,14 @@ module Effective | |
| 147 145 |  | 
| 148 146 | 
             
                  update_column(:started_at, Time.zone.now)
         | 
| 149 147 |  | 
| 150 | 
            -
                  opts = { from: from, subject: subject, body: body }
         | 
| 151 | 
            -
             | 
| 152 148 | 
             
                  event_registrants.each do |event_registrant|
         | 
| 153 | 
            -
                     | 
| 149 | 
            +
                    begin
         | 
| 150 | 
            +
                      EffectiveEvents.send_email(email_template, event_registrant, email_notification_params)
         | 
| 151 | 
            +
                    rescue => e
         | 
| 152 | 
            +
                      EffectiveLogger.error(e.message, associated: event_registrant) if defined?(EffectiveLogger)
         | 
| 153 | 
            +
                      ExceptionNotifier.notify_exception(e, data: { event_registrant_id: event_registrant.id, event_notification_id: id }) if defined?(ExceptionNotifier)
         | 
| 154 | 
            +
                      raise(e) if Rails.env.test? || Rails.env.development?
         | 
| 155 | 
            +
                    end
         | 
| 154 156 | 
             
                  end
         | 
| 155 157 |  | 
| 156 158 | 
             
                  update_column(:completed_at, Time.zone.now)
         | 
| @@ -12,26 +12,7 @@ | |
| 12 12 | 
             
                - template = 'event_' + category.parameterize.underscore
         | 
| 13 13 |  | 
| 14 14 | 
             
                = f.show_if :category, category do
         | 
| 15 | 
            -
                  = render "/admin/event_notifications/form_#{template}", f: f
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  - if f.object.category == category && f.object.persisted?
         | 
| 18 | 
            -
                    = f.select :from, mailer_froms_collection(), label: 'From'
         | 
| 19 | 
            -
                    = f.text_field :subject
         | 
| 20 | 
            -
                    = f.text_area :body, rows: 10
         | 
| 21 | 
            -
                  - else
         | 
| 22 | 
            -
                    - email_template = Effective::EmailTemplate.where(template_name: template).first!
         | 
| 23 | 
            -
                    - from_value = email_template.from || EffectiveResources.mailer_froms.first
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                    = f.select :from, mailer_froms_collection(), label: 'From', value: from_value
         | 
| 26 | 
            -
                    = f.text_field :subject, value: email_template.subject
         | 
| 27 | 
            -
                    = f.text_area :body, rows: 10, value: email_template.body
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                    %p The available variables are:
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                    %ul
         | 
| 32 | 
            -
                      - Effective::EventNotification::EMAIL_TEMPLATE_VARIABLES.each do |variable|
         | 
| 33 | 
            -
                        %li {{ #{variable} }}
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                    %small.text-muted Please contact us to add additional variables
         | 
| 15 | 
            +
                  .my-3= render "/admin/event_notifications/form_#{template}", f: f
         | 
| 16 | 
            +
                  = email_notification_fields(f, template, variables: Effective::EventNotification::EMAIL_TEMPLATE_VARIABLES)
         | 
| 36 17 |  | 
| 37 18 | 
             
              = effective_submit(f)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: effective_events
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.15.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Code and Effect
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-06- | 
| 11 | 
            +
            date: 2024-06-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |