Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/models/product_role.rb | 5 +++++
app/views/items/_list.html.erb | 17 +++++++----------
app/views/products/_list.html.erb | 2 +-
app/views/projects/index.html.erb | 2 +-
app/views/roles/_list.html.erb | 11 ++++++-----
app/views/sprints/_list.html.erb | 2 +-
app/views/stories/_list.html.erb | 2 +-
app/views/tasks/_list.html.erb | 2 +-
app/views/users/_list.html.erb | 2 +-
9 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/app/models/product_role.rb b/app/models/product_role.rb
index 69e1e68..77104e7 100644
--- a/app/models/product_role.rb
+++ b/app/models/product_role.rb
@@ -49,4 +49,9 @@ class ProductRole < ActiveRecord::Base
def active?
!self.pending && self.approved
end
+
+ # Returns whether the user can delete this role.
+ def can_delete?(user)
+ user && user.id == product.owner_id
+ end
end
diff --git a/app/views/items/_list.html.erb b/app/views/items/_list.html.erb
index d9ec7ea..41fd9f2 100644
--- a/app/views/items/_list.html.erb
+++ b/app/views/items/_list.html.erb
@@ -1,7 +1,6 @@
<table class="list">
<colgroup>
<col class="row_id" />
- <col class="number" />
<col class="description" />
<% unless @this_user %>
@@ -19,11 +18,10 @@
<thead>
<tr>
- <th class="title" colspan="<%= 8 - (@sprint ? 1 : 0) -
(@this_user ? 1 : 0) %>">Backlog Items</th>
+ <th class="title" colspan="<%= 7 - (@sprint ? 1 : 0) -
(@this_user ? 1 : 0) %>">Backlog Items</th>
</tr>
<tr>
<th>#</th>
- <th>US#</th>
<th>Title</th>
<% unless @this_user %>
@@ -43,7 +41,7 @@
<tbody>
<% if @backlog_items.empty? %>
<tr>
- <td colspan="<%= @sprint ? 7 : 8 %>">No backlog items
found...</td>
+ <td colspan="<%= @sprint ? 6 : 7 %>">No backlog items
found...</td>
</tr>
<% else %>
<% @backlog_items.each_with_index do |item, index| %>
@@ -52,12 +50,7 @@
<% product = sprint.product %>
<tr class="<%= row_class %>">
- <td>
- <%= link_to "#{item.id}",
- product_sprint_item_path(product, sprint, item) %>
- </td>
- <td><%= link_to "#{item.user_story.id}",
- product_story_path(item.user_story.product, item.user_story)
%></td>
+ <td><%= "#{item.id}" %></td>
<td><%= "#{item.user_story.title}" %></td>
<% unless @this_user %>
@@ -76,6 +69,10 @@
<td><%= item.state_text %></td>
<td><%= show_hours_as_ear(item) %>
<td>
+ <%= link_to(image_tag("icons/view.png", :title => "View
this item..."),
+ product_sprint_item_path(product, sprint, item)) %>
+ <%= link_to(image_tag("icons/story_view.png", :title =>
"View the user story..."),
+ product_story_path(product, item.user_story)) %>
<%= link_to(image_tag("icons/item_accept.png"),
accept_product_sprint_item_path(product, sprint, item,
:source => request.request_uri)) if item.can_accept?(@user) %>
diff --git a/app/views/products/_list.html.erb b/app/views/products/_list.html.erb
index a7e181d..a71f794 100644
--- a/app/views/products/_list.html.erb
+++ b/app/views/products/_list.html.erb
@@ -44,7 +44,7 @@
<% @products.each_with_index do |product, index| %>
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td><%= link_to "#{product.id}", product_path(product)
%></td>
+ <td><%= "#{product.id}" %></td>
<% if @project == nil %>
<td>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index d091f66..36d2405 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -37,7 +37,7 @@
<% row_class = i%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td class="row_id"><%= link_to "#{project.id}",
project_path(project) %></td>
+ <td class="row_id"><%= "#{project.id}"
%></td>
<td><%= project.name %></td>
<td><%= get_first_sentence project.description %></td>
<td><%= link_to project.owner.display_name, user_path(project.owner)
%></td>
diff --git a/app/views/roles/_list.html.erb b/app/views/roles/_list.html.erb
index d94e1c3..f4295c5 100644
--- a/app/views/roles/_list.html.erb
+++ b/app/views/roles/_list.html.erb
@@ -46,7 +46,7 @@
<% @product_roles.each_with_index do |role, index| %>
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td><%= link_to "#{role.id}", product_role_path(role.product,
role) %>
+ <td><%= "#{role.id}" %>
<% unless @this_user %>
<td><%= link_to role.user.display_name,roles_user_path(role.user)
%></td>
@@ -60,6 +60,8 @@
<td><%= show_date role.created_at %></td>
<% if @product && @product.can_approve_roles?(@user) %>
<td>
+ <%= link_to(image_tag("icons/view.png", :title => "View
this role..."),
+ product_role_path(role.product, role)) %>
<% if role.pending %>
<% form_for(:product_role, role, :url =>
product_role_path(role.product,role),
:html => {:method => :put}) do |form| %>
@@ -68,10 +70,9 @@
<%= submit_tag "Update" %>
<% end %>
<% else %>
- <% form_for(:product_role, role, :url =>
product_role_path(role.product,role),
- :html => {:method => :delete}) do |form| %>
- <%= submit_tag "Delete", :confirm => "Are you
sure?" %>
- <% end %>
+ <%= link_to(image_tag("icons/delete.png", :title =>
"Delete this role..."),
+ product_role_path(role.product, role), :method => :delete,
+ :confirm => "Delete? Are you sure?") if
role.can_delete?(@user) %>
<% end %>
<% end %>
</td>
diff --git a/app/views/sprints/_list.html.erb b/app/views/sprints/_list.html.erb
index a66ad21..d89a613 100644
--- a/app/views/sprints/_list.html.erb
+++ b/app/views/sprints/_list.html.erb
@@ -32,7 +32,7 @@
<% @sprints.each_with_index do |sprint, index| %>
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td><%= link_to "#{sprint.id}",
product_sprint_path(@product, sprint) %></td>
+ <td><%= "#{sprint.id}" %></td>
<td><%= sprint.title %></td>
<td><%= sprint.status_text %></td>
<td><%= show_date(sprint.start) %></td>
diff --git a/app/views/stories/_list.html.erb b/app/views/stories/_list.html.erb
index 964c892..09edc9f 100644
--- a/app/views/stories/_list.html.erb
+++ b/app/views/stories/_list.html.erb
@@ -28,7 +28,7 @@
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td><%= link_to "#{story.id}",
product_story_path(story.product, story) %></td>
+ <td><%= "#{story.id}" %></td>
<td><%= story.priority %></td>
<td><%= story.title %></td>
<td>
diff --git a/app/views/tasks/_list.html.erb b/app/views/tasks/_list.html.erb
index 31f5a8c..17829cc 100644
--- a/app/views/tasks/_list.html.erb
+++ b/app/views/tasks/_list.html.erb
@@ -28,7 +28,7 @@
<% @tasks.each_with_index do |task, index| %>
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td><%= link_to "#{task.id}", user_task_path(task.primary,
task) %></td>
+ <td><%= "#{task.id}" %></td>
<td><%= show_date(task.when_entered) %></td>
<td><%= simple_format task.description %></td>
<td><%= link_to(task.primary.display_name, user_path(task.primary)) if
task.primary %></td>
diff --git a/app/views/users/_list.html.erb b/app/views/users/_list.html.erb
index d4bb89f..8c0382c 100644
--- a/app/views/users/_list.html.erb
+++ b/app/views/users/_list.html.erb
@@ -28,7 +28,7 @@
<% row_class = index%2 == 0 ? 'even' : 'odd' %>
<tr class="<%= row_class %>">
- <td><%= link_to "#{user.id}", user_path(user)
%></td>
+ <td><%= "#{user.id}" %></td>
<td><%= user.display_name %></td>
<td><%= simple_format user.introduction %></td>
<td><%= mail_to user.email, user.display_name %></td>
--
1.6.0.2