<% @actives.each_with_index do |active, index| %>
<tr id="dashboard-<%= u active.name -%>" class="<%= cycle('even', 'odd', :name => 'dashboard') -%>">
<td>
- <%= link_to active.name(true), {:controller => :dashboard, :action => :index, :did => active.dashboard_id, :id => (params[:resource] unless active.global?)} -%>
+ <%= active.name(true) -%>
<div class="description"><%= h active.dashboard.description -%></div>
</td>
<% if is_admin %>
<% end %>
<td>
<% if index > 0 %>
- <%= link_to image_tag('blue-up.png'), {:action => 'up', :id => active.id, :resource => params[:resource]}, :method => :post, :id => "up-#{u active.name}" %>
+ <%= link_to image_tag('blue-up.png'), {:action => :up, :id => active.id, :resource => params[:resource]}, :method => :post, :id => "up-#{u active.name}" %>
<% else %>
<%= image_tag('transparent_16.gif') %>
<% end %>
<% if index < @actives.size-1 %>
- <%= link_to image_tag('blue-down.png'), {:action => 'down', :id => active.id, :resource => params[:resource]}, :method => :post, :id => "down-#{u active.name}" %>
+ <%= link_to image_tag('blue-down.png'), {:action => :down, :id => active.id, :resource => params[:resource]}, :method => :post, :id => "down-#{u active.name}" %>
<% end %>
</td>
<td class="thin nowrap right">
- <% if active.owner?(current_user) %>
+ <% if active.editable_by?(current_user) %>
<%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => :configure, :did => active.dashboard_id, :id => (params[:resource] unless active.global?)},
:id => "configure-#{u active.name}", :class => 'link-action' %>
|
<%= link_to_remote message('edit'), {:update => "create_dashboard", :url => {:action => :edit, :id => active.dashboard_id, :resource => params[:resource]}},
{:id => "edit-#{u active.name}", :method => :get, :class => 'link-action'} %>
<% if @actives.size() > 1 %>
- |
- <%= link_to message('delete'), {:action => :delete, :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
- :confirm => message('dashboard.do_you_want_to_delete_dashboard'), :id => "delete-#{u active.name}", :class => 'link-action' %>
+ |
+ <% if active.owner?(current_user) %>
+ <%= link_to message('delete'), {:action => :delete, :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
+ :confirm => message('dashboard.do_you_want_to_delete_dashboard'), :id => "delete-#{u active.name}", :class => 'link-action' %>
+ <% else %>
+ <%= link_to message('unfollow'), {:action => :unfollow, :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
+ :id => "unfollow-#{u active.name}", :class => 'link-action' %>
+ <% end %>
<% end %>
- <% elsif @actives.size() > 1 %>
+ <% elsif !active.owner?(current_user) && (@actives.size() > 1) %>
<%= link_to message('unfollow'), {:action => :unfollow, :id => active.dashboard_id, :resource => params[:resource]}, :method => :post,
:id => "unfollow-#{u active.name}", :class => 'link-action' %>
<% end %>
@shared_dashboards.each do |dashboard| %>
<tr id="shared-dashboard-<%= u dashboard.name -%>" class="<%= cycle('even', 'odd', :name => 'shared') -%>">
<td>
- <%= link_to dashboard.name(true), {:controller => :dashboard, :action => :index, :id => params[:resource], :did => dashboard.id} -%>
- <% if dashboard.description.present? %>
- <p class="small"><%= h dashboard.description -%></p>
- <% end %>
+ <%= dashboard.name(true) -%>
+ <div class="description"><%= h dashboard.description -%></div>
</td>
<td>
<%= dashboard.user_name -%>