OSDN Git Service

tooltips added on calendar
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Jan 2007 10:36:18 +0000 (10:36 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 13 Jan 2007 10:36:18 +0000 (10:36 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@161 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/projects_controller.rb
app/helpers/issues_helper.rb
app/views/issues/_tooltip.rhtml [new file with mode: 0644]
app/views/projects/calendar.rhtml
app/views/projects/gantt.rhtml
public/stylesheets/application.css

index 7b62312..165333e 100644 (file)
@@ -463,7 +463,7 @@ class ProjectsController < ApplicationController
     # finish on sunday\r
     @date_to = @date_to + (7-@date_to.cwday)  \r
       \r
-    @issues = @project.issues.find(:all, :include => :tracker, :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])\r
+    @issues = @project.issues.find(:all, :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to])\r
     render :layout => false if request.xhr?\r
   end  \r
 \r
@@ -485,7 +485,7 @@ class ProjectsController < ApplicationController
     \r
     @date_from = Date.civil(@year_from, @month_from, 1)\r
     @date_to = (@date_from >> @months) - 1\r
-    @issues = @project.issues.find(:all, :order => "start_date, due_date", :include => [:tracker, :status, :author, :priority], :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to])\r
+    @issues = @project.issues.find(:all, :order => "start_date, due_date", :include => [:tracker, :status, :assigned_to, :priority], :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to])\r
     \r
     if params[:output]=='pdf'\r
       @options_for_rfpdf ||= {}\r
index d732589..cacc7f5 100644 (file)
@@ -56,12 +56,12 @@ module IssuesHelper
     \r
     unless no_html\r
       label = content_tag('strong', label)\r
-      old_value = content_tag("i", h(old_value)) if old_value\r
-      old_value = content_tag("strike", h(old_value)) if old_value and !value\r
+      old_value = content_tag("i", h(old_value)) if detail.old_value\r
+      old_value = content_tag("strike", old_value) if detail.old_value and (!detail.value or detail.value.empty?)\r
       value = content_tag("i", h(value)) if value\r
     end\r
     \r
-    if value\r
+    if detail.value and !detail.value.empty?\r
       if old_value\r
         label + " " + l(:text_journal_changed, old_value, value)\r
       else\r
diff --git a/app/views/issues/_tooltip.rhtml b/app/views/issues/_tooltip.rhtml
new file mode 100644 (file)
index 0000000..d7b555e
--- /dev/null
@@ -0,0 +1,6 @@
+<%= link_to "#{issue.tracker.name} ##{issue.id}", { :controller => 'issues', :action => 'show', :id => issue } %></strong>: <%=h issue.subject %><br />\r
+<br />\r
+<strong><%= l(:field_start_date) %></strong>: <%= format_date(issue.start_date) %><br />\r
+<strong><%= l(:field_due_date) %></strong>: <%= format_date(issue.due_date) %><br />\r
+<strong><%= l(:field_assigned_to) %></strong>: <%= issue.assigned_to ? issue.assigned_to.name : "-" %><br />\r
+<strong><%= l(:field_priority) %></strong>: <%= issue.priority.name %>\r
index b750b0b..809d593 100644 (file)
@@ -41,11 +41,12 @@ while day <= @date_to
        if day.cwday == 1 %>\r
        <th><%= day.cweek %></th>\r
        <% end %>       \r
-       <td valign="top" style="width:14%" class="<%= day.month==@month ? "even" : "odd" %>">\r
+       <td valign="top" class="<%= day.month==@month ? "even" : "odd" %>" style="width:14%; <%= Date.today == day ? 'background:#FDFED0;' : '' %>">\r
        <p class="textright"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p> \r
        <% day_issues = []\r
        @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day } \r
-       day_issues.each do |i| %>       \r
+       day_issues.each do |i| %>\r
+           <div class="tooltip">\r
                <%= if day == i.start_date and day == i.due_date\r
                    image_tag('arrow_bw.png')\r
                elsif day == i.start_date\r
@@ -53,7 +54,11 @@ while day <= @date_to
                elsif day == i.due_date\r
                    image_tag('arrow_to.png') \r
                end %>\r
-               <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i }, :title => "#{i.subject}" %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br />\r
+               <small><%= link_to "#{i.tracker.name} ##{i.id}", { :controller => 'issues', :action => 'show', :id => i } %>: <%=h i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small>\r
+        <span class="tip">\r
+        <%= render :partial => "issues/tooltip", :locals => { :issue => i }%>\r
+        </span>                \r
+               </div>\r
        <% end %>\r
     </td>\r
        <%= '</tr><tr style="height:100px">' if day.cwday >= 7 and day!=@date_to %>\r
index 5f6c96e..f20e928 100644 (file)
@@ -196,13 +196,9 @@ top = headers_heigth + 10
        <%= (i.done_ratio).to_i %>%\r
        </div>\r
        <% # === tooltip === %>\r
-       <div style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;" class="tooltip"><span class="tip">\r
-          <strong><%= "#{i.tracker.name} ##{i.id}" %></strong>: <%=h i.subject %><br />\r
-          <br />\r
-          <strong><%= l(:field_start_date) %></strong>: <%= format_date(i.start_date) %><br />\r
-          <strong><%= l(:field_due_date) %></strong>: <%= format_date(i.due_date) %><br />\r
-          <strong><%= l(:field_assigned_to) %></strong>: <%= i.assigned_to ? i.assigned_to.name : "-" %><br />\r
-          <strong><%=l(:field_priority)%></strong>: <%= i.priority.name %>\r
+       <div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">\r
+       <span class="tip">\r
+    <%= render :partial => "issues/tooltip", :locals => { :issue => i }%>\r
        </span></div>\r
        <% top = top + 20\r
 end %>\r
index 6fed472..1e78b33 100644 (file)
@@ -558,14 +558,14 @@ font-size: 1em;
 .task_todo { background:#aaa url(../images/task_todo.png); border: 1px solid #aaa; }\r
 \r
 /***** Tooltips ******/\r
-.tooltip{position:absolute;z-index:24;}\r
+.tooltip{position:relative;z-index:24;}\r
 .tooltip:hover{z-index:25;color:#000;}\r
 .tooltip span.tip{display: none}\r
 \r
 div.tooltip:hover span.tip{\r
 display:block;\r
 position:absolute;\r
-top:12px; left:20px; width:270px;\r
+top:12px; left:24px; width:270px;\r
 border:1px solid #555;\r
 background-color:#fff;\r
 padding: 4px;\r