diff --git a/app/models/issue.rb b/app/models/issue.rb
index 7f2996f..2d9228b 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -134,6 +134,11 @@ class Issue < ActiveRecord::Base
end
end
+ # Returns true if user or current user is allowed to edit or add a note to the issue
+ def editable?(user=User.current)
+ user.allowed_to?(:edit_issues, project) || user.allowed_to?(:add_issue_notes, project)
+ end
+
def initialize(attributes=nil, *args)
super
if new_record?
diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb
index 69c0e2c..aade339 100644
--- a/app/views/issues/_action_menu.html.erb
+++ b/app/views/issues/_action_menu.html.erb
@@ -1,7 +1,7 @@
-<%= link_to_if_authorized(l(:button_update), {:controller => 'issues', :action => 'edit', :id => @issue }, :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
+<%= link_to l(:button_update), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
<%= watcher_tag(@issue, User.current) %>
-<%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, :class => 'icon icon-copy' %>
+<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %>
<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
diff --git a/app/views/issues/_list_simple.html.erb b/app/views/issues/_list_simple.html.erb
index ae34000..0e4aa07 100644
--- a/app/views/issues/_list_simple.html.erb
+++ b/app/views/issues/_list_simple.html.erb
@@ -12,12 +12,12 @@
<% end %>
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb
index c41b7b7..83b4f56 100644
--- a/app/views/issues/show.html.erb
+++ b/app/views/issues/show.html.erb
@@ -61,7 +61,7 @@
end
end
if User.current.allowed_to?(:view_time_entries, @project)
- rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? (link_to l_hours(@issue.total_spent_hours), {:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}) : "-"), :class => 'spent-time'
+ rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? link_to(l_hours(@issue.total_spent_hours), project_issue_time_entries_path(@project, @issue)) : "-"), :class => 'spent-time'
end
end %>
<%= render_custom_fields_rows(@issue) %>
@@ -73,11 +73,7 @@ end %>
<% if @issue.description? %>
- <%= link_to l(:button_quote),
- {:controller => 'journals', :action => 'new', :id => @issue},
- :remote => true,
- :method => 'post',
- :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
+ <%= link_to l(:button_quote), quoted_issue_path(@issue), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %>
<%=l(:field_description)%>
@@ -130,7 +126,7 @@ end %>
<%= render :partial => 'action_menu' %>
-<% if authorize_for('issues', 'edit') %>
+<% if @issue.editable? %>
<%= l(:button_update) %>
<%= render :partial => 'edit' %>