denny/ShinyCMS-ruby

View on GitHub
plugins/ShinyLists/app/views/shiny_lists/subscriptions/index.html.erb

Summary

Maintainability
Test Coverage
<% @page_title = t( '.title' ) %>

<section>
  <header>
    <h2>
      <%= @page_title %>
    </h2>
  </header>

  <% if @subscriptions.present? %>
  <p>
    You are managing subscriptions for <strong><%= @subscriptions.first.subscriber.obfuscated_email %></strong>.
    If this is not you, please <% if user_signed_in? %>log out<% else %>check the link you used<% end %>!
  </p>

  <table>
    <% @subscriptions.each do |subscription| %>
    <tr>
      <td class="no-left-padding larger">
        <%= subscription.list.name %>
      </td>
      <td>
        <% if user_signed_in? %>
        <%= link_to t( '.unsubscribe' ), shiny_lists.user_list_unsubscribe_path( subscription.list.slug ), method: :put, class: 'button white-text' %>
        <% else %>
        <%= link_to t( '.unsubscribe' ), shiny_lists.token_list_unsubscribe_path( subscription.list.slug, params[:token] ), method: :put, class: 'button white-text' %>
        <% end %>
      </td>
    </tr>
    <% end %>
  </table>

  <% else %>

  <p class="pager-info">
    <%= t( 'shinycms.empty_list', items: 'subscriptions' ) %>
  </p>
  <% end %>
</section>