Class: Decidim::NotificationActions::ButtonsCell

Inherits:
BaseCell show all
Defined in:
app/cells/decidim/notification_actions/buttons_cell.rb

Instance Method Summary collapse

Methods inherited from BaseCell

#data

Methods inherited from Decidim::NotificationCell

#action_cell, #action_class, #notification_title, #participatory_space_link

Instance Method Details

#buttonsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/cells/decidim/notification_actions/buttons_cell.rb', line 14

def buttons
  @buttons ||= data.map do |item|
    [
      label_for(item),
      item[:url],
      {
        class: "button button__sm #{class_for(item)}",
        remote: true,
        data: { controller: "notification-action", action: "click->notification-action#click" }
      }
    ].tap do |button|
      button[2][:method] = item[:method] if item[:method].in?(%w(get patch put delete post))
    end
  end
end

#showObject



8
9
10
11
12
# File 'app/cells/decidim/notification_actions/buttons_cell.rb', line 8

def show
  return unless data.present? && data.respond_to?(:map)

  render :show
end