RE: Show/Hide history of issues ยป redmine-history-collapse.patch
| app/controllers/issues_controller.rb (working copy) | ||
|---|---|---|
|
helper :timelog
|
||
|
include Redmine::Export::PDF
|
||
|
verify :method => :post,
|
||
|
:only => :destroy,
|
||
|
:render => { :nothing => true, :status => :method_not_allowed }
|
||
|
|
||
|
def index
|
||
|
retrieve_query
|
||
|
sort_init 'id', 'desc'
|
||
| ... | ... | |
|
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||
|
@priorities = Enumeration::get_values('IPRI')
|
||
|
@time_entry = TimeEntry.new
|
||
|
@show_history = params[:show_history] == 'true'
|
||
|
respond_to do |format|
|
||
|
format.html { render :template => 'issues/show.rhtml' }
|
||
|
format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
|
||
|
format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
|
||
|
format.pdf { send_data(issue_to_pdf(@issue, @show_history), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
attach_files(@issue, params[:attachments])
|
||
|
flash[:notice] = l(:notice_successful_create)
|
||
|
Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added')
|
||
|
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
|
||
|
redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } :
|
||
|
{ :action => 'show', :id => @issue })
|
||
|
return
|
||
| ... | ... | |
|
flash[:notice] = l(:notice_successful_update)
|
||
|
Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated')
|
||
|
end
|
||
|
call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => journal})
|
||
|
redirect_to(params[:back_to] || {:action => 'show', :id => @issue})
|
||
|
end
|
||
|
end
|
||
| app/views/issues/show.rhtml (working copy) | ||
|---|---|---|
|
<%= link_to_if_authorized l(:button_copy), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-copy' %>
|
||
|
<%= link_to_if_authorized l(:button_move), {:controller => 'issues', :action => 'move', :id => @issue }, :class => 'icon icon-move' %>
|
||
|
<%= 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' %>
|
||
|
<% if @show_history %>
|
||
|
<%= link_to l(:button_hide_history), {:show_history => 'false'}, :class => 'icon icon-hide_history' %>
|
||
|
<% else %>
|
||
|
<%= link_to l(:button_show_history), {:show_history => 'true'}, :class => 'icon icon-show_history' %>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<h2><%= @issue.tracker.name %> #<%= @issue.id %></h2>
|
||
| ... | ... | |
|
</div>
|
||
|
<% end %>
|
||
|
<% if @show_history %>
|
||
|
<% if @journals.any? %>
|
||
|
<div id="history">
|
||
|
<h3><%=l(:label_history)%></h3>
|
||
|
<%= render :partial => 'history', :locals => { :journals => @journals } %>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
<div style="clear: both;"></div>
|
||
|
<% if authorize_for('issues', 'edit') %>
|
||
| ... | ... | |
|
<p class="other-formats">
|
||
|
<%= l(:label_export_to) %>
|
||
|
<span><%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
||
|
<span><%= link_to 'PDF', {:format => 'pdf'}, :class => 'pdf' %></span>
|
||
|
<span><%= link_to 'PDF', {:format => 'pdf',:show_history => @show_history == true ? 'true' : 'false'}, :class => 'pdf' %></span>
|
||
|
</p>
|
||
|
<% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %>
|
||
| lib/redmine/export/pdf.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
|
||
|
# Returns a PDF string of a single issue
|
||
|
def issue_to_pdf(issue)
|
||
|
def issue_to_pdf(issue, show_history)
|
||
|
pdf = IFPDF.new(current_language)
|
||
|
pdf.SetTitle("#{issue.project} - ##{issue.tracker} #{issue.id}")
|
||
|
pdf.AliasNbPages
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
|
||
|
pdf.SetFontStyle('B',9)
|
||
|
pdf.Cell(190,5, l(:label_history), "B")
|
||
|
pdf.Ln
|
||
|
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
|
||
|
pdf.SetFontStyle('B',8)
|
||
|
pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name)
|
||
|
pdf.Ln
|
||
|
pdf.SetFontStyle('I',8)
|
||
|
for detail in journal.details
|
||
|
pdf.Cell(190,5, "- " + show_detail(detail, true))
|
||
|
if show_history
|
||
|
pdf.SetFontStyle('B',9)
|
||
|
pdf.Cell(190,5, l(:label_history), "B")
|
||
|
pdf.Ln
|
||
|
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
|
||
|
pdf.SetFontStyle('B',8)
|
||
|
pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name)
|
||
|
pdf.Ln
|
||
|
pdf.SetFontStyle('I',8)
|
||
|
for detail in journal.details
|
||
|
pdf.Cell(190,5, "- " + show_detail(detail, true))
|
||
|
pdf.Ln
|
||
|
end
|
||
|
if journal.notes?
|
||
|
pdf.SetFontStyle('',8)
|
||
|
pdf.MultiCell(190,5, journal.notes)
|
||
|
end
|
||
|
pdf.Ln
|
||
|
end
|
||
|
if journal.notes?
|
||
|
pdf.SetFontStyle('',8)
|
||
|
pdf.MultiCell(190,5, journal.notes)
|
||
|
end
|
||
|
pdf.Ln
|
||
|
end
|
||
|
|
||
|
if issue.attachments.any?
|
||
| public/stylesheets/application.css (working copy) | ||
|---|---|---|
|
a:hover, a:active{ color: #c61a1a; text-decoration: underline;}
|
||
|
a img{ border: 0; }
|
||
|
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { text-decoration: line-through; }
|
||
|
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
|
||
|
/***** Tables *****/
|
||
|
table.list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; }
|
||
| ... | ... | |
|
.icon-details { background-image: url(../images/zoom_in.png); }
|
||
|
.icon-report { background-image: url(../images/report.png); }
|
||
|
.icon-comment { background-image: url(../images/comment.png); }
|
||
|
.icon-show_history { background-image: url(../images/show_history.png); }
|
||
|
.icon-hide_history { background-image: url(../images/hide_history.png); }
|
||
|
.icon22-projects { background-image: url(../images/22x22/projects.png); }
|
||
|
.icon22-users { background-image: url(../images/22x22/users.png); }
|
||