@@ -134,6 +134,11 class Issue < ActiveRecord::Base | |||||
134 | end |
|
134 | end | |
135 | end |
|
135 | end | |
136 |
|
136 | |||
|
137 | # Returns true if user or current user is allowed to edit or add a note to the issue | |||
|
138 | def editable?(user=User.current) | |||
|
139 | user.allowed_to?(:edit_issues, project) || user.allowed_to?(:add_issue_notes, project) | |||
|
140 | end | |||
|
141 | ||||
137 | def initialize(attributes=nil, *args) |
|
142 | def initialize(attributes=nil, *args) | |
138 | super |
|
143 | super | |
139 | if new_record? |
|
144 | if new_record? |
@@ -1,7 +1,7 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 |
<%= link_to |
|
2 | <%= 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? %> | |
3 | <%= 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) %> |
|
3 | <%= 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) %> | |
4 | <%= watcher_tag(@issue, User.current) %> |
|
4 | <%= watcher_tag(@issue, User.current) %> | |
5 | <%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue}, :class => 'icon icon-copy' %> |
|
5 | <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %> | |
6 | <%= 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) %> |
|
6 | <%= 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) %> | |
7 | </div> |
|
7 | </div> |
@@ -12,12 +12,12 | |||||
12 | <tr id="issue-<%= h(issue.id) %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>"> |
|
12 | <tr id="issue-<%= h(issue.id) %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>"> | |
13 | <td class="id"> |
|
13 | <td class="id"> | |
14 | <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;', :id => nil) %> |
|
14 | <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;', :id => nil) %> | |
15 |
<%= link_to |
|
15 | <%= link_to issue.id, issue_path(issue) %> | |
16 | </td> |
|
16 | </td> | |
17 | <td class="project"><%= link_to_project(issue.project) %></td> |
|
17 | <td class="project"><%= link_to_project(issue.project) %></td> | |
18 | <td class="tracker"><%=h issue.tracker %></td> |
|
18 | <td class="tracker"><%=h issue.tracker %></td> | |
19 | <td class="subject"> |
|
19 | <td class="subject"> | |
20 |
<%= link_to |
|
20 | <%= link_to truncate(issue.subject, :length => 60), issue_path(issue) %> (<%=h issue.status %>) | |
21 | </td> |
|
21 | </td> | |
22 | </tr> |
|
22 | </tr> | |
23 | <% end %> |
|
23 | <% end %> |
@@ -61,7 +61,7 | |||||
61 | end |
|
61 | end | |
62 | end |
|
62 | end | |
63 | if User.current.allowed_to?(:view_time_entries, @project) |
|
63 | if User.current.allowed_to?(:view_time_entries, @project) | |
64 |
rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? |
|
64 | 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' | |
65 | end |
|
65 | end | |
66 | end %> |
|
66 | end %> | |
67 | <%= render_custom_fields_rows(@issue) %> |
|
67 | <%= render_custom_fields_rows(@issue) %> | |
@@ -73,11 +73,7 end %> | |||||
73 | <% if @issue.description? %> |
|
73 | <% if @issue.description? %> | |
74 | <div class="description"> |
|
74 | <div class="description"> | |
75 | <div class="contextual"> |
|
75 | <div class="contextual"> | |
76 | <%= link_to l(:button_quote), |
|
76 | <%= link_to l(:button_quote), quoted_issue_path(@issue), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> | |
77 | {:controller => 'journals', :action => 'new', :id => @issue}, |
|
|||
78 | :remote => true, |
|
|||
79 | :method => 'post', |
|
|||
80 | :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> |
|
|||
81 | </div> |
|
77 | </div> | |
82 |
|
78 | |||
83 | <p><strong><%=l(:field_description)%></strong></p> |
|
79 | <p><strong><%=l(:field_description)%></strong></p> | |
@@ -130,7 +126,7 end %> | |||||
130 | <%= render :partial => 'action_menu' %> |
|
126 | <%= render :partial => 'action_menu' %> | |
131 |
|
127 | |||
132 | <div style="clear: both;"></div> |
|
128 | <div style="clear: both;"></div> | |
133 | <% if authorize_for('issues', 'edit') %> |
|
129 | <% if @issue.editable? %> | |
134 | <div id="update" style="display:none;"> |
|
130 | <div id="update" style="display:none;"> | |
135 | <h3><%= l(:button_update) %></h3> |
|
131 | <h3><%= l(:button_update) %></h3> | |
136 | <%= render :partial => 'edit' %> |
|
132 | <%= render :partial => 'edit' %> |
General Comments 0
You need to be logged in to leave comments.
Login now