<!--Descriptive page name, messages and instructions-->
<h2 class="heading">
  <% if @subscribable_type %>
    <%= t(".page_heading.#{@subscribable_type}") %>
  <% else %>
    <%= t(".page_heading.all") %>
  <% end %>
</h2>
<!--/descriptions-->

<!--subnav-->
<h3 class="landmark heading"><%= t("a11y.navigation") %></h3>
<ul class="navigation actions" role="navigation">
  <li>
    <%= span_if_current(t(".navigation.all"),
          user_subscriptions_path(@user),
          @subscribable_type.blank?) %>
  </li>
  <li>
    <%= span_if_current(t(".navigation.series"),
          user_subscriptions_path(@user, type: "series"),
          @subscribable_type == "series") %>
  </li>
  <li>
    <%= span_if_current(t(".navigation.user"),
          user_subscriptions_path(@user, type: "users"),
          @subscribable_type == "users") %>
  </li>
  <li>
    <%= span_if_current(t(".navigation.work"),
          user_subscriptions_path(@user, type: "works"),
          @subscribable_type == "works") %>
  </li>
  <li>
    <% if @subscribable_type %>
      <%= link_to t(".navigation.delete_all.#{@subscribable_type}"),
            confirm_delete_all_user_subscriptions_path(@user, type: @subscribable_type) %>
    <% else %>
      <%= link_to t(".navigation.delete_all.all"),
            confirm_delete_all_user_subscriptions_path(@user) %>
    <% end %>
  </li>
</ul>
<!--/subnav-->

<!--main content-->
<%= will_paginate @subscriptions %>

<h3 class="landmark heading"><%= t(".heading.landmark.list") %></h3>
<dl class="subscription index group">
  <% @subscriptions.each do |subscription| %>
    <dt>
      <% if subscription.subscribable %>
        <%= link_to(subscription.name, subscription.subscribable) %>
        <% case subscription.subscribable_type %>
        <% when "Work" %>
          <%= t(".work") if @subscribable_type.blank? %>
          <%= t(".byline_html", creators: byline(subscription.subscribable)) %>
        <% when "Series" %>
          <%= t(".series") if @subscribable_type.blank? %>
          <%= t(".byline_html", creators: byline(subscription.subscribable)) %>
        <% end %>
      <% else %>
        <%= subscription.name %>
      <% end %>
    </dt>
    <dd>
      <%= form_for [current_user, subscription], :html => {:method => :delete} do |f| %>
        <%= f.submit t(".button_html", name: subscription.name) %>
      <% end %>
    </dd>
  <% end %>
</dl>

<%= will_paginate @subscriptions %>
<!--/content-->
