<%= subscription.key %>

<%= link_to "Notifications", notifications_path_for(subscription.target, option_params.merge(filtered_by_key: subscription.key)) %>

<% if subscription.subscribing? %> <%= link_to unsubscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false);$(this).parent().parent().parent().next().slideUp();;$(this).parent().parent().parent().next().next().slideUp();', method: :put, remote: true do %> <%= check_box :subscribing, "", { checked: true }, 'true', 'false' %>
<% end %> <% else %> <% if ActivityNotification.config.subscribe_as_default %> <%= link_to subscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().find("input").prop("checked", true);$(this).parent().parent().parent().next().next().slideDown();$(this).parent().parent().parent().next().next().find("input").prop("checked", true);', method: :put, remote: true do %> <%= check_box :subscribing, "", { checked: false }, 'true', 'false' %>
<% end %> <% else %> <%= link_to subscribe_path_for(subscription, option_params.merge(with_email_subscription: false)), onclick: '$(this).find("input").prop("checked", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().next().slideDown();', method: :put, remote: true do %> <%= check_box :subscribing, "", { checked: false }, 'true', 'false' %>
<% end %> <% end %> <% end %>
<% if subscription.subscribing_to_email? %> <%= link_to unsubscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false)', method: :put, remote: true do %> <% end %> <% else %> <%= link_to subscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true)', method: :put, remote: true do %> <% end %> <% end %>
<% subscription.optional_target_names.each do |optional_target_name| %>
<% if subscription.subscribing_to_optional_target?(optional_target_name) %> <%= link_to unsubscribe_to_optional_target_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", false)', method: :put, remote: true do %> <% end %> <% else %> <%= link_to subscribe_to_optional_target_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", true)', method: :put, remote: true do %> <% end %> <% end %>
<% end %>
<%#= link_to "Show", subscription_path_for(subscription, option_params), class: "button" %> <%= link_to "Destroy", subscription_path_for(subscription, option_params), method: :delete, remote: true, data: { confirm: 'Are you sure?' }, class: "button" %>