<table class="data" id="dashboards">
  <thead>
  <tr>
    <th class="name"><%= message('name') -%></th>
    <th class="shared"><%= message('shared') -%></th>
    <th class="owner"><%= message('owner') -%></th>
    <th class="order"><%= message('order') -%></th>
    <th class="operations"><%= message('operations') -%></th>
  </tr>
  </thead>
  <tbody>
  <% if @actives.nil? || @actives.empty? %>
    <tr class="even">
      <td colspan="5" class="empty"><%= message('dashboard.no_dashboard') -%></td>
    </tr>
  <% else %>
    <% @actives.map(&:dashboard).each_with_index do |dashboard, index| %>
      <% resource_id = @resource.id if @resource %>
      <tr id="dashboard-<%= dashboard.id -%>" class="<%= cycle('even', 'odd', :name => 'dashboard') -%>">
        <td>
          <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id, :id => (resource_id unless dashboard.global?)},
                      :id => "view-#{u dashboard.name}" %>
          <div class="description"><%= h dashboard.description -%></div>
          <% if index == 0 %>
            <div class="note spacer-top"><%= h message('dashboard.default_dashboard') -%></div>
          <% end %>
        </td>
        <td class="shared">
          <% if (dashboard.shared) %><i class="icon-check" id='<%= "dashboard-#{index}-shared" -%>'></i><% end %>
        </td>
        <td class="owner">
          <%= h(dashboard.user_name || message('dashboard.username.default')) -%>
        </td>
        <td class="order">
          <% if index > 0 %>
            <%= link_to '', {:action => :up, :id => dashboard.id, :resource => resource_id}, :method => :post, :id => "up-#{u dashboard.name}", :class => "icon-move-up" %>
          <% else %>
            <%= image_tag('transparent_16.gif') %>
          <% end %>
          <% if index < @actives.size-1 %>
            <%= link_to '', {:action => :down, :id => dashboard.id, :resource => resource_id}, :method => :post, :id => "down-#{u dashboard.name}", :class => "icon-move-down" %>
          <% else %>
            <%= image_tag('transparent_16.gif') %>
        <% end %>
        </td>
        <%= render :partial => 'dashboard_operations', :locals => {:dashboard => dashboard, :can_be_disabled => @actives.length > 1, :subscription_action => 'unfollow'} %>
      </tr>
    <% end
       end
    %>
  </tbody>
</table>
