Sha256: 0d5c9eaf6dd5caf42bea6ac6312f777c20da1d36ec732759566844e06c484dfc

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 KB

Contents

module Marty
  module Notifications
    class DeliveriesView < Marty::Grid
      ROLES_WITH_ACCESS = [:admin, :dev]

      has_marty_permissions read: ROLES_WITH_ACCESS,
                            create: nil,
                            update: nil,
                            delete: ROLES_WITH_ACCESS

      def configure(c)
        super

        c.header = false
        c.model = 'Marty::Notifications::Delivery'
        c.attributes = [:created_at, :notification__event_type, :recipient__name,
                        :state, :delivery_type, :text, :error_text]
        c.store_config.merge!(
          sorters: [{ property: :id, direction: 'DESC' }],
          page_size: 30
        )

        c.scope = ->(arel) { arel.includes(:notification).includes(:recipient) }
      end

      attribute :notification__event_type do |config|
        config.width = 150
        config.label = 'Event'
      end

      attribute :recipient__name do |config|
        config.width = 150
        config.label = 'Recipient'
      end

      attribute :text do |config|
        config.width = 400

        config.getter = lambda do |record|
          [record.notification.text, record.text].join(', ')
        end
      end

      attribute :error_text do |config|
        config.width = 300
        config.label = 'Error'
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
marty-14.3.0 app/components/marty/notifications/deliveries_view.rb
marty-14.0.0 app/components/marty/notifications/deliveries_view.rb
marty-13.0.2 app/components/marty/notifications/deliveries_view.rb
marty-11.0.0 app/components/marty/notifications/deliveries_view.rb
marty-10.0.3 app/components/marty/notifications/deliveries_view.rb
marty-10.0.2 app/components/marty/notifications/deliveries_view.rb
marty-10.0.0 app/components/marty/notifications/deliveries_view.rb
marty-9.5.1 app/components/marty/notifications/deliveries_view.rb
marty-9.5.0 app/components/marty/notifications/deliveries_view.rb
marty-9.3.3 app/components/marty/notifications/deliveries_view.rb
marty-9.3.2 app/components/marty/notifications/deliveries_view.rb
marty-9.3.0 app/components/marty/notifications/deliveries_view.rb
marty-8.5.0 app/components/marty/notifications/deliveries_view.rb
marty-8.4.1 app/components/marty/notifications/deliveries_view.rb
marty-8.3.1 app/components/marty/notifications/deliveries_view.rb
marty-8.2.0 app/components/marty/notifications/deliveries_view.rb