Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 7 files changed
  • 0 comments
  • 1 contributor
34 app/controllers/task_boards_controller.rb
@@ -4,6 +4,8 @@ class TaskBoardsController < ApplicationController
4 4 layout 'base'
5 5 before_filter :get_project, :authorize, :only => [:index, :show]
6 6 before_filter :set_cache_buster
  7 + before_filter :get_issue, :only => [:update_issue_status, :update_issue, :add_comment, :get_comment]
  8 +
7 9 def set_cache_buster
8 10 response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
9 11 response.headers["Pragma"] = "no-cache"
@@ -58,7 +60,7 @@ def show
58 60 @features = @features.select {|f| not f.custom_values.first(:conditions => "value = '#{@selected_team}'").nil? }
59 61 @tasks.reject!.each { |t| t if !@features.member? t.super_parent }
60 62 end
61   -
  63 +
62 64 @tasks.reject!.each do |f|
63 65 if f.version_child?(@version)
64 66 p = f.parent.issue_from
@@ -111,7 +113,6 @@ def show
111 113 def update_issue_status
112 114 get_project
113 115 @status = IssueStatus.find(params[:status_id])
114   - @issue = Issue.find(params[:issue_id])
115 116 @issue.init_journal(User.current, "")
116 117 @selected_resource = params[:selected_resource] ? params[:selected_resource] : ""
117 118
@@ -147,8 +148,7 @@ def update_issue_status
147 148
148 149 def update_issue
149 150 #TODO Permissions trapping - view
150   - get_project
151   - @issue = Issue.find(params[:issue_id])
  151 + get_project
152 152 @issue.init_journal(User.current, '')
153 153 @issue.update_attributes(params[:issue])
154 154 @selected_resource = params[:selected_resource] ? params[:selected_resource] : ""
@@ -180,13 +180,13 @@ def update_issue
180 180
181 181 def add_comment
182 182 get_project
183   - @issue = Issue.find(params[:issue_id])
184 183 @issue.init_journal(User.current, params[:comment])
185 184 @issue.update_attributes(params[:issue])
186   - render :update do |page|
187   - page.replace_html "#{@issue.id}_discussion".to_sym, :partial => "discussion", :locals => {:issue => @issue}
188   - page.replace_html "#{@issue.id}_tip".to_sym, page.task_board_tooltip(@issue)
189   - end
  185 + render_comment
  186 + end
  187 +
  188 + def get_comment
  189 + render_comment
190 190 end
191 191
192 192 private
@@ -198,10 +198,26 @@ def get_version
198 198 @version = Version.find params[:version_id]
199 199 end
200 200
  201 + def get_issue
  202 + @issue = Issue.find(params[:issue_id])
  203 + end
  204 +
  205 + def get_journals(ticket)
  206 + ticket.journals.find(:all, :include => [:user, :journalized], :conditions => "notes <> ''", :order => "created_on DESC")
  207 + end
  208 +
201 209 def ordered_keys(values)
202 210 values.keys.sort{|x,y| values[x][:order] <=> values[y][:order]}
203 211 end
204 212
  213 + def render_comment
  214 + @journals = get_journals(@issue)
  215 + render :update do |page|
  216 + page.replace_html "#{@issue.id}_discussion".to_sym, :partial => "discussion", :locals => {:issue => @issue}
  217 + page.replace_html "#{@issue.id}_tip".to_sym, page.task_board_tooltip(@issue)
  218 + end
  219 + end
  220 +
205 221 def parented_sort(tasks)
206 222 psorted = tasks.sort_by {|t| -t.children.count }
207 223 sorted = psorted.select {|p| p.parent.nil? && p.children.any?}
18 app/helpers/task_boards_helper.rb
@@ -79,16 +79,16 @@ def task_board_tooltip(ticket)
79 79 "<strong>#{l(:field_assigned_to)}</strong>: #{ticket.assigned_to}<br />" +
80 80 ((ticket.feature? or ticket.children.any?) ? "" : "<strong>#{l(:field_estimated_hours)}</strong>: #{ticket.estimated_hours ? ticket.estimated_hours : 0} #{l(:field_sp_hours)}<br />") +
81 81 ((ticket.feature? or ticket.children.any?) ? "" : "<strong>#{l(:field_remaining_effort)}</strong>: #{ticket.remaining_effort ? ticket.remaining_effort : 0} #{l(:field_sp_hours)}<br />") +
82   - "<strong>#{l(:field_comments)}</strong>: <br /> <ul>"
83   - journals = get_journals(ticket).take(5)
84   - journals.reverse.each do |j|
85   - content += "<li style='padding-left: 4px; margin: 0;'>&raquo; #{j.notes}</li>"
  82 + "<strong>#{l(:field_comments)}</strong>: <br />"
  83 + if @journals
  84 + content += "<ul>"
  85 + @journals.take(5).reverse.each do |j|
  86 + content += "<li style='padding-left: 4px; margin: 0;'>&raquo; #{j.notes}</li>"
  87 + end
  88 + content += "</ul>"
  89 + else
  90 + content += "<span>Click #{image_tag 'talk.png', :plugin => 'scrum_task_board'} to load comments.</span>"
86 91 end
87   - content += "</ul>"
88   - end
89   -
90   - def get_journals(ticket)
91   - ticket.journals.find(:all, :include => [:user], :conditions => "notes <> ''", :order => "created_on DESC")
92 92 end
93 93
94 94 end
6 app/views/task_boards/_discussion.rhtml
... ... @@ -1,7 +1,7 @@
1   -<% journals = get_journals(issue) %>
2   -<% journals.each do |journal| %>
  1 +<% @journals.each do |journal| %>
3 2 <div class="comment">
4   - <h5><%= journal.user %><span class="time_ago"><%= time_tag journal.created_on %> ago</span></h5>
  3 + <h5><%= journal.user %><br/><span class="time_ago"><%= time_tag journal.created_on %> ago</span></h5>
5 4 <%= textilizable(journal, :notes) %>
6 5 </div>
7 6 <% end %>
  7 +
20 app/views/task_boards/_feature.rhtml
@@ -10,7 +10,7 @@
10 10 <div class="initial_controls" style="display: none;">
11 11 <div class="edit" title="Edit">Edit</div>
12 12 <div class="toggle_details maximized" title="Show Details">Show Details</div>
13   - <div class="talk" title="Comment">Comment</div>
  13 + <div class="talk" title="Comment" id="<%= feature.id %>_talk">Comment</div>
14 14 </div>
15 15 <div class="current_data">
16 16 <p class="estimate" style="right: 2px;"><%= feature.remaining_effort ? feature.remaining_effort : '' %></p>
@@ -41,24 +41,12 @@
41 41 </div>
42 42 <div class="discussion">
43 43 <div id="<%= feature.id %>_discussion">
44   - <%= render :partial => "discussion", :locals => {:issue => feature} %>
45 44 </div>
46 45 </div>
47 46 </div>
48 47 </div>
49 48
50   - <script type="text/javascript">
51   - sticky_note("<%= dom_id(feature) %>", "<%= feature.assigned_to_id %>", "<%= feature.status_id %>");
52   - jQuery(function(){
53   - jQuery("#<%= feature.id %>_discussion").slimScroll({
54   - height: '150px',
55   - });
56   - });
57   - jQuery("#text_comment_<%= feature.id %>").focusout(function(){
58   - if(jQuery(this).val() == "") jQuery(this).val("Type your comment here...");
59   - });
60   - jQuery("#text_comment_<%= feature.id %>").focusin(function(){
61   - if(jQuery(this).val() == "Type your comment here...") jQuery(this).val("");
62   - });
63   - </script>
  49 +<script type="text/javascript">
  50 + sticky_note("<%= dom_id(feature) %>", "<%= feature.assigned_to_id %>", "<%= feature.status_id %>", "<%= feature.id %>", false);
  51 +</script>
64 52
83 app/views/task_boards/_issue.html.erb
... ... @@ -1,18 +1,71 @@
1 1 <li id="<%= dom_id(issue) %>" class="<%= status_classes_for(issue, User.current) %> task_board_data <%= task_board_border_class(issue)%> <%= 'current_is_assigned' if issue.assigned_to.eql? User.current %> <%= 'isBug' if defined?(bug) %> assigned_to_<%= issue.assigned_to_id %>" <%= "style='border: 3px solid #E33;'" if issue.if_blocked %>>
2   - <%= render :partial => 'issue_show', :locals => {:issue => issue } %>
3   -</li>
4 2
5   -<script type="text/javascript">
6   - /* if (jQuery("#show_bugs").is(":checked")) {
7   - jQuery('.isBug').show();
8   - }
9   - else {
10   - jQuery('.isBug').hide();
11   - } */
12   - <% if (issue.assigned_to_id == @selected_resource.to_i) or ["", "All", "Select a resource..."].member?(@selected_resource) %>
13   - jQuery('.assigned_to_<%= issue.assigned_to_id %>').show();
14   - <% else %>
15   - jQuery('.assigned_to_<%= issue.assigned_to_id %>').hide();
16   - <% end %>
17   -</script>
  3 +<!--- START-------------------------------------------------------------------------------------------------------------->
  4 +
  5 + <div class="issue_number">
  6 + <% if params[:board].to_i.eql? 1 %>
  7 + <%= link_to "#{issue.parent.issue_from_id} &raquo; ", "##{dom_id(issue.parent.issue_from)}",
  8 + :class => "to_parent", :style => "color: orange;",
  9 + :title => "Jump to parent." if (!issue.parent.nil? and !issue.parent.issue_from.feature?) and not issue.task_parent? %>
  10 + <% elsif params[:board].to_i.eql? 2 %>
  11 + <%= link_to "#{issue.parent.issue_from_id} &raquo; ", "##{dom_id(issue.parent.issue_from)}",
  12 + :class => "to_parent", :style => "color: orange;",
  13 + :title => "Jump to parent." if !issue.parent.nil? %>
  14 + <% end %>
  15 + <div class="tooltip">
  16 + <%= link_to_issue issue %><span id="<%= issue.id %>_tip" class="tip"><%= task_board_tooltip(issue) %></span>
  17 + </div>
  18 + </div>
  19 +
  20 + <div class="bulk_details">
  21 +
  22 + <div class="initial_controls" style="display: none;">
  23 + <div class="edit" title="Edit">Edit</div>
  24 + <div class="toggle_details maximized" title="Show Details">Show Details</div>
  25 + <div class="talk" title="Comment" id="<%= issue.id %>_talk">Comment</div>
  26 + </div>
  27 +
  28 + <div class="current_data">
  29 + <p class="estimate"><%= "R: #{issue.remaining_effort}" if issue.remaining_effort %></p>
  30 + <p class="assignee <%= "assigned_to_current" if issue.assigned_to.eql? User.current %>"><%= issue.assigned_to ? issue.assigned_to : '' %></p>
  31 + <p class="est"><%= "E: #{issue.estimated_hours}" if issue.estimated_hours %></p>
  32 + <p class="status"><%= issue.status.name %></p>
  33 + <hr/>
  34 + <p><%= truncate(issue.subject, :length => 50) %></p>
  35 + <%= progress_bar issue.done_ratio, :width =>'100%' %>
  36 + </div>
  37 +
  38 + <div class="edit_here" style="display:none;">
  39 + <div class="cancel" title="Cancel">Cancel</div>
  40 + <div class="submit_link" title="Save">Save</div>
  41 + <div style="width: 100%; margin: 0; padding: 0;">
  42 + <%= render :partial => 'edit_form', :locals => {:issue => issue}%>
  43 + </div>
  44 + </div>
  45 +
  46 + <div class="talk_here" style="display:none">
  47 + <div class="cancel" title="Cancel">Cancel</div>
  48 + <div class="comment_form_panel">
  49 + <% remote_form_for :issue, issue, :url => {:action => "add_comment", :controller => "task_boards",
  50 + :id => @project, :issue_id => issue }, :html => {:id => "#{issue.id}_comment_form", :class => "comment_form"},
  51 + :complete => "initTalk(#{issue.id});" do |f| %>
  52 + <%= text_area_tag "comment", nil, :id => "text_comment_#{issue.id}" %>
  53 + <%= f.submit "+", :class => "add" %><div class="clear"></div>
  54 + <% end %>
  55 + </div>
  56 + <div class="discussion">
  57 + <div id="<%= issue.id %>_discussion">
  58 +
  59 + </div>
  60 + </div>
  61 + </div>
  62 +
  63 + </div>
  64 + <script type="text/javascript" id="stickynotejs_<%= issue.id %>" class="stickynotejs">
  65 + sticky_note('<%= dom_id(issue) %>', '<%= issue.assigned_to_id %>', '<%= issue.status_id %>', '<%= issue.id %>', <%= issue.version_descendants.empty? %>);
  66 + </script>
  67 +
  68 +<!----------------------------------------------------------------------------------------------------------------END --->
  69 +
  70 +</li>
18 71
48 assets/javascripts/sticky_note.js
... ... @@ -1,6 +1,28 @@
1 1 j = jQuery.noConflict(); //This allows Prototype to go undisturbed
2 2
3   -function sticky_note(issue, assigned_to, status_id)
  3 +function initTalk(id) {
  4 + jQuery("#text_comment_" + id).val('Type your comment here...');
  5 + var barheight = getbarHeight(jQuery("#"+ id + "_discussion"), 30);
  6 + jQuery('.slimScrollBar').css({height: barheight + 'px'});
  7 +}
  8 +
  9 +
  10 +function markLoaded(id) {
  11 + var jtextComment = jQuery("#text_comment_" + id);
  12 + var defaultText = "Type your comment here...";
  13 + jQuery("#" + id + "_discussion").slimScroll({ height: '150px'});
  14 + jtextComment.focusout(function(){
  15 + if(jQuery(this).val() == "") jQuery(this).val(defaultText);
  16 + });
  17 + jtextComment.focusin(function(){
  18 + if(jQuery(this).val() == defaultText) jQuery(this).val("");
  19 + });
  20 + jQuery("#issue_" + id + " .talk").addClass("comments_loaded");
  21 + jQuery("#issue_" + id + " .talk_here").show();
  22 + initTalk(id);
  23 +}
  24 +
  25 +function sticky_note(issue, assigned_to, status_id, issue_id, draggable)
4 26 {
5 27 jQuery("#" + issue + "").hover(
6 28 function(){
@@ -16,10 +38,22 @@ function sticky_note(issue, assigned_to, status_id)
16 38
17 39 jQuery("#" + issue + " .talk").click(function(){
18 40 jQuery("#" + issue + " .current_data, #" + issue + " .initial_controls").hide();
19   - jQuery("#" + issue + " .talk_here").show();
20   - jQuery("#" + issue + " .talk_here textarea").val("Type your comment here...");
  41 + if(jQuery(this).hasClass("comments_loaded")) {
  42 + jQuery("#" + issue + " .talk_here").show();
  43 + jQuery("#" + issue + " .talk_here textarea").val("Type your comment here...");
  44 + }
  45 + else {
  46 + var id = jQuery(this).attr("id").split("_")[0];
  47 + console.log(jQuery(this).attr("id").split("_")[0]);
  48 + new Ajax.Request('/task_boards/get_comment', {
  49 + asynchronous :true,
  50 + evalScripts :true,
  51 + onComplete :function(request){markLoaded(id)},
  52 + parameters :'issue_id=' + id
  53 + });
  54 + }
21 55 });
22   -
  56 +
23 57 jQuery("#" + issue + " .cancel").click(function(){
24 58 jQuery("#" + issue + " #issue_assigned_to_id").val(assigned_to);
25 59 jQuery("#" + issue + " #issue_status_id").val(status_id);
@@ -30,7 +64,7 @@ function sticky_note(issue, assigned_to, status_id)
30 64 if ( jQuery("#" + issue + " .toggle_details").hasClass('maximized'))
31 65 jQuery("#" + issue + " .current_data").show();
32 66 });
33   -
  67 +
34 68 jQuery("#" + issue + " .toggle_details").click(function(){
35 69 jQuery("#" + issue + " .current_data").toggle(1, function()
36 70 {
@@ -54,4 +88,8 @@ function sticky_note(issue, assigned_to, status_id)
54 88 return false;
55 89 }
56 90 });
  91 +
  92 + if(draggable)
  93 + new Draggable(issue, {constraint:"horizontal", revert:"failure"});
57 94 }
  95 +
29 assets/stylesheets/task_board.css
@@ -291,13 +291,18 @@
291 291 #task_board .talk_here .discussion {
292 292 /* overflow: auto;*/
293 293 height: 150px;
294   - background-color: #ccc;
  294 + background-color: #fafafa;
295 295 }
296 296
297 297 div.discussion .time_ago {
298 298 float: right;
299 299 }
300 300
  301 +.discussion .comment {
  302 + padding: 0 10px 0 2px;
  303 + word-wrap: break-word;
  304 +}
  305 +
301 306 #task_board .issue_subject {
302 307 font-size: 11px;
303 308 }
@@ -325,14 +330,16 @@ div.discussion .time_ago {
325 330 }
326 331
327 332 div.tooltip span.tip{
328   -position: absolute; z-index: 1000;
329   -display: none;
330   -/*top:12px; left:24px;*/
331   -border:1px solid #555;
332   -background-color:#fff;
333   -padding: 4px; width:300px;
334   -font-size: 0.8em;
335   -color:#505050;
  333 + position: absolute;
  334 + z-index: 1000;
  335 + display: none;
  336 + /*top:12px; left:24px;*/
  337 + border:1px solid #555;
  338 + background-color:#fff;
  339 + padding: 4px; width:300px;
  340 + font-size: 0.8em;
  341 + color:#505050;
  342 + word-wrap: break-word;
336 343 }
337 344
338 345 .tooltip { display: inline; }
@@ -368,8 +375,9 @@ ul.condensed li {display: inline-block; margin-right: 1px; }
368 375 max-height: 45px;
369 376 margin-top: 0px;
370 377 margin-bottom: 0px;
371   - resize: none;
372 378 overflow: hidden;
  379 + font-family: Helvetica, Arial;
  380 + resize: none;
373 381 }
374 382
375 383 .comment_form .add {
@@ -382,6 +390,7 @@ ul.condensed li {display: inline-block; margin-right: 1px; }
382 390 vertical-align: center;
383 391 margin-right: 1px;
384 392 background-color: #82C3F2;
  393 + cursor: pointer;
385 394 }
386 395
387 396 .comment_form .add:hover {

No commit comments for this range

Something went wrong with that request. Please try again.