Skip to content

Commit

Permalink
Update comments in tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
den-plugins committed Jan 4, 2012
1 parent a9d32db commit 944525e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion app/controllers/task_boards_controller.rb
Expand Up @@ -152,6 +152,7 @@ def update_issue
@issue.init_journal(User.current, '')
@issue.update_attributes(params[:issue])
@selected_resource = params[:selected_resource] ? params[:selected_resource] : ""
@journals = get_journals(@issue)

parents = @issue.update_parents
@status_grouped = (params[:board].to_i.eql?(1) ? IssueStatusGroup::TASK_GROUPED : IssueStatusGroup::BUG_GROUPED)
Expand Down Expand Up @@ -212,9 +213,10 @@ def ordered_keys(values)

def render_comment
@journals = get_journals(@issue)
@loaded = true
render :update do |page|
page.replace_html "#{@issue.id}_discussion".to_sym, :partial => "discussion", :locals => {:issue => @issue}
page.replace_html "#{@issue.id}_tip".to_sym, page.task_board_tooltip(@issue)
page.replace_html "#{@issue.id}_tip".to_sym, page.task_board_tooltip(@issue, @journals)
end
end

Expand Down
16 changes: 10 additions & 6 deletions app/helpers/task_boards_helper.rb
Expand Up @@ -73,19 +73,23 @@ def update_sticky_note container, issue, board=nil
page.visual_effect(:highlight, "#{container}")
end

def task_board_tooltip(ticket)
def task_board_tooltip(ticket, journals=nil)
content = "<strong>#{l(:field_subject)}</strong>: #{textilizable ticket.subject}<br />" +
"<strong>#{l(:field_description)}</strong>: #{textilizable ticket.description}<br />" +
"<strong>#{l(:field_assigned_to)}</strong>: #{ticket.assigned_to}<br />" +
((ticket.feature? or ticket.children.any?) ? "" : "<strong>#{l(:field_estimated_hours)}</strong>: #{ticket.estimated_hours ? ticket.estimated_hours : 0} #{l(:field_sp_hours)}<br />") +
((ticket.feature? or ticket.children.any?) ? "" : "<strong>#{l(:field_remaining_effort)}</strong>: #{ticket.remaining_effort ? ticket.remaining_effort : 0} #{l(:field_sp_hours)}<br />") +
"<strong>#{l(:field_comments)}</strong>: <br />"
if @journals
content += "<ul>"
@journals.take(5).reverse.each do |j|
content += "<li style='padding-left: 4px; margin: 0;'>&raquo; #{j.notes}</li>"
unless journals.nil?
if journals.empty?
content += "<span>No comments yet.</span>"
else
content += "<ul>"
journals.take(5).reverse.each do |j|
content += "<li style='padding-left: 4px; margin: 0;'>&raquo; #{j.notes}</li>"
end
content += "</ul>"
end
content += "</ul>"
else
content += "<span>Click #{image_tag 'talk.png', :plugin => 'scrum_task_board'} to load comments.</span>"
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/task_boards/_feature.rhtml
Expand Up @@ -2,7 +2,7 @@
<%= link_to "#{feature.parent.issue_from_id} &raquo; ", "##{dom_id(feature.parent.issue_from)}",
:class => "to_parent", :style => "color: orange;", :title => "Jump to parent." if !feature.parent.nil? %>
<div class="tooltip">
<%= link_to_issue feature %><span id="<%= feature.id %>_tip" class="tip"><%= task_board_tooltip(feature) %></span>
<%= link_to_issue feature %><span id="<%= feature.id %>_tip" class="tip"><%= task_board_tooltip(feature, @journals) %></span>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/task_boards/_issue.html.erb
Expand Up @@ -13,7 +13,7 @@
:title => "Jump to parent." if !issue.parent.nil? %>
<% end %>
<div class="tooltip">
<%= link_to_issue issue %><span id="<%= issue.id %>_tip" class="tip"><%= task_board_tooltip(issue) %></span>
<%= link_to_issue issue %><span id="<%= issue.id %>_tip" class="tip"><%= task_board_tooltip(issue, @journals) %></span>
</div>
</div>

Expand Down

0 comments on commit 944525e

Please sign in to comment.