RE: Show/Hide history of issues ยป redmine-history-collapse.patch
app/controllers/issues_controller.rb (working copy) | ||
---|---|---|
43 | 43 |
helper :timelog |
44 | 44 |
include Redmine::Export::PDF |
45 | 45 | |
46 |
verify :method => :post, |
|
47 |
:only => :destroy, |
|
48 |
:render => { :nothing => true, :status => :method_not_allowed } |
|
49 |
|
|
46 | 50 |
def index |
47 | 51 |
retrieve_query |
48 | 52 |
sort_init 'id', 'desc' |
... | ... | |
102 | 106 |
@edit_allowed = User.current.allowed_to?(:edit_issues, @project) |
103 | 107 |
@priorities = Enumeration::get_values('IPRI') |
104 | 108 |
@time_entry = TimeEntry.new |
109 |
@show_history = params[:show_history] == 'true' |
|
105 | 110 |
respond_to do |format| |
106 | 111 |
format.html { render :template => 'issues/show.rhtml' } |
107 | 112 |
format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' } |
108 |
format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") } |
|
113 |
format.pdf { send_data(issue_to_pdf(@issue, @show_history), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
|
|
109 | 114 |
end |
110 | 115 |
end |
111 | 116 | |
... | ... | |
147 | 152 |
attach_files(@issue, params[:attachments]) |
148 | 153 |
flash[:notice] = l(:notice_successful_create) |
149 | 154 |
Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added') |
155 |
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) |
|
150 | 156 |
redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } : |
151 | 157 |
{ :action => 'show', :id => @issue }) |
152 | 158 |
return |
... | ... | |
194 | 200 |
flash[:notice] = l(:notice_successful_update) |
195 | 201 |
Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') |
196 | 202 |
end |
203 |
call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => journal}) |
|
197 | 204 |
redirect_to(params[:back_to] || {:action => 'show', :id => @issue}) |
198 | 205 |
end |
199 | 206 |
end |
app/views/issues/show.rhtml (working copy) | ||
---|---|---|
5 | 5 |
<%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-copy' %> |
6 | 6 |
<%= link_to_if_authorized l(:button_move), {:controller => 'issues', :action => 'move', :id => @issue }, :class => 'icon icon-move' %> |
7 | 7 |
<%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
8 |
<% if @show_history %> |
|
9 |
<%= link_to l(:button_hide_history), {:show_history => 'false'}, :class => 'icon icon-hide_history' %> |
|
10 |
<% else %> |
|
11 |
<%= link_to l(:button_show_history), {:show_history => 'true'}, :class => 'icon icon-show_history' %> |
|
12 |
<% end %> |
|
8 | 13 |
</div> |
9 | 14 | |
10 | 15 |
<h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> |
... | ... | |
95 | 100 |
</div> |
96 | 101 |
<% end %> |
97 | 102 | |
103 |
<% if @show_history %> |
|
98 | 104 |
<% if @journals.any? %> |
99 | 105 |
<div id="history"> |
100 | 106 |
<h3><%=l(:label_history)%></h3> |
101 | 107 |
<%= render :partial => 'history', :locals => { :journals => @journals } %> |
102 | 108 |
</div> |
103 | 109 |
<% end %> |
110 |
<% end %> |
|
111 | ||
104 | 112 |
<div style="clear: both;"></div> |
105 | 113 | |
106 | 114 |
<% if authorize_for('issues', 'edit') %> |
... | ... | |
113 | 121 |
<p class="other-formats"> |
114 | 122 |
<%= l(:label_export_to) %> |
115 | 123 |
<span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span> |
116 |
<span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span> |
|
124 |
<span><%= link_to 'PDF', {:format => 'pdf',:show_history => @show_history == true ? 'true' : 'false'}, :class => 'pdf' %></span>
|
|
117 | 125 |
</p> |
118 | 126 | |
119 | 127 |
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
lib/redmine/export/pdf.rb (working copy) | ||
---|---|---|
153 | 153 |
end |
154 | 154 |
|
155 | 155 |
# Returns a PDF string of a single issue |
156 |
def issue_to_pdf(issue) |
|
156 |
def issue_to_pdf(issue, show_history)
|
|
157 | 157 |
pdf = IFPDF.new(current_language) |
158 | 158 |
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}") |
159 | 159 |
pdf.AliasNbPages |
... | ... | |
244 | 244 |
end |
245 | 245 |
end |
246 | 246 |
|
247 |
pdf.SetFontStyle('B',9) |
|
248 |
pdf.Cell(190,5, l(:label_history), "B") |
|
249 |
pdf.Ln |
|
250 |
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") |
|
251 |
pdf.SetFontStyle('B',8) |
|
252 |
pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name) |
|
253 |
pdf.Ln |
|
254 |
pdf.SetFontStyle('I',8) |
|
255 |
for detail in journal.details |
|
256 |
pdf.Cell(190,5, "- " + show_detail(detail, true)) |
|
247 |
if show_history |
|
248 |
pdf.SetFontStyle('B',9) |
|
249 |
pdf.Cell(190,5, l(:label_history), "B") |
|
250 |
pdf.Ln |
|
251 |
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") |
|
252 |
pdf.SetFontStyle('B',8) |
|
253 |
pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name) |
|
257 | 254 |
pdf.Ln |
255 |
pdf.SetFontStyle('I',8) |
|
256 |
for detail in journal.details |
|
257 |
pdf.Cell(190,5, "- " + show_detail(detail, true)) |
|
258 |
pdf.Ln |
|
259 |
end |
|
260 |
if journal.notes? |
|
261 |
pdf.SetFontStyle('',8) |
|
262 |
pdf.MultiCell(190,5, journal.notes) |
|
263 |
end |
|
264 |
pdf.Ln |
|
258 | 265 |
end |
259 |
if journal.notes? |
|
260 |
pdf.SetFontStyle('',8) |
|
261 |
pdf.MultiCell(190,5, journal.notes) |
|
262 |
end |
|
263 |
pdf.Ln |
|
264 | 266 |
end |
265 | 267 |
|
266 | 268 |
if issue.attachments.any? |
public/stylesheets/application.css (working copy) | ||
---|---|---|
76 | 76 |
a:hover, a:active{ color: #c61a1a; text-decoration: underline;} |
77 | 77 |
a img{ border: 0; } |
78 | 78 | |
79 |
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { text-decoration: line-through; } |
|
79 |
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
|
|
80 | 80 | |
81 | 81 |
/***** Tables *****/ |
82 | 82 |
table.list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; } |
... | ... | |
619 | 619 |
.icon-details { background-image: url(../images/zoom_in.png); } |
620 | 620 |
.icon-report { background-image: url(../images/report.png); } |
621 | 621 |
.icon-comment { background-image: url(../images/comment.png); } |
622 |
.icon-show_history { background-image: url(../images/show_history.png); } |
|
623 |
.icon-hide_history { background-image: url(../images/hide_history.png); } |
|
622 | 624 | |
623 | 625 |
.icon22-projects { background-image: url(../images/22x22/projects.png); } |
624 | 626 |
.icon22-users { background-image: url(../images/22x22/users.png); } |