Project

General

Profile

Error #352 » advanced_roadmap_redmine_1.0.3.diff

Christoph Plank, 2010-11-05 12:08

View differences:

advanced_roadmap.new/app/views/projects/roadmap.rhtml 1970-01-01 00:00:00.000000000 +0000
1
<h2><%=l(:label_roadmap)%></h2>
2

  
3
<% if @versions.empty? %>
4
<p class="nodata"><%= l(:label_no_data) %></p>
5
<% else %>
6

  
7
<div id="roadmap">
8

  
9
<% if @versions.size >= 1 %>
10
  <%= tag "a", :name => l(:label_total) %>
11
  <h3 class="icon22 icon22-package"><%= l(:label_total) %></h3>
12
  <%
13
    estimated_hours = 0.0
14
    spent_hours = 0.0
15
    rest_hours = 0.0
16
    completed_pourcent = 0.0
17
    closed_pourcent = 0.0
18
  	@versions.each do |version|
19
  	  estimated_hours += version.estimated_hours
20
      spent_hours += version.spent_hours
21
      rest_hours += version.rest_hours
22
      completed_pourcent += version.spent_hours
23
      closed_pourcent += version.closed_spent_hours
24
  	end
25
  	total = spent_hours + rest_hours
26
  	if total > 0.0
27
      completed_pourcent = (completed_pourcent * 100.0) / total
28
      closed_pourcent = (closed_pourcent * 100.0) / total
29
  	end
30
  %>
31
  <%= progress_bar([closed_pourcent, completed_pourcent], :width => '40em', :legend => ('%0.0f%' % completed_pourcent)) %>
32
  <fieldset><legend><%= l(:label_time_tracking) %></legend>
33
  <table>
34
  <tr>
35
    <td width="130px" align="right"><%= l(:field_estimated_hours) %></td>
36
    <td width="340px" class="total-hours"><%= l_hours(estimated_hours) %></td>
37
  </tr>
38
  <% if User.current.allowed_to?(:view_time_entries, @project) %>
39
    <tr>
40
      <td width="130px" align="right"><%= l(:label_spent_time) %></td>
41
      <td width="340px" class="total-hours"><%= l_hours(spent_hours) %></td>
42
    </tr>
43
    <tr>
44
      <td width="130px" align="right"><%= l(:field_done_ratio) %></td>
45
      <td width="340px" class="total-hours"><big><%= "%.0f" % completed_pourcent %></big>%</td>
46
    </tr>
47
    <tr>
48
      <td width="130px" align="right"><%= l(:label_roadmap_due_in, "") %></td>
49
      <td width="340px" class="total-hours"><%= "#{l_hours(rest_hours)} / #{l_days(rest_hours / 8.0)} / #{l_weeks(rest_hours / 40.0)}" %></td>
50
    </tr>
51
  <% end %>
52
  </table>
53
  </fieldset>
54
<% end %>
55

  
56
<% @versions.each do |version| %>   
57
  <% issues = version.fixed_issues.find(:all,
58
                                        :include => [:status, :tracker],
59
                                        :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"],
60
                                        :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") unless @selected_tracker_ids.empty? %>
61
  <%= tag 'a', :name => version.name %>
62
  <h3 class="icon22 icon22-package"><%= link_to h(version.name), :controller => 'versions', :action => 'show', :id => version %></h3>
63
  <%= render :partial => 'versions/overview', :locals => {:version => version} %>
64
  <%= render :partial => 'versions/milestones', :locals => {:version => version} %>
65
  <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
66
  <%= render :partial => 'versions/issues', :locals => {:version => version, :issues => issues} %>
67
<% end %>
68

  
69
</div>
70
<% end %>
71

  
72
<% content_for :sidebar do %>
73
  <% form_tag({}, :method => :get) do %>
74
    <h3><%= l(:label_roadmap) %></h3>
75
    <% @trackers.each do |tracker| %>
76
      <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
77
      <%= tracker.name %></label><br />
78
    <% end %>
79
    <br />
80
    <label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
81
    <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
82
  <% end %>
83

  
84
  <h3><%= l(:label_milestone_plural) %></h3>
85
  <% @project.milestones.sort.each do |milestone| %>
86
    <%= link_to milestone.name, :controller => :milestones, :action => :show, :id => milestone.id %><br />
87
  <% end %>
88

  
89
  <h3><%= l(:label_version_plural) %></h3>
90
  <%= link_to l(:label_total), "##{l(:label_total)}" %><br />
91
  <% @versions.each do |version| %>
92
    <%= link_to version.name, "##{version.name}" %><br />
93
  <% end %>
94
<% end %>
95

  
96
<% html_title(l(:label_roadmap)) %>
advanced_roadmap.new/app/views/versions/index.rhtml 2010-11-05 10:45:47.000000000 +0000
1
<h2><%=l(:label_roadmap)%></h2>
2

  
3
<% if @versions.empty? %>
4
<p class="nodata"><%= l(:label_no_data) %></p>
5
<% else %>
6

  
7
<div id="roadmap">
8

  
9
<% if @versions.size >= 1 %>
10
  <%= tag "a", :name => l(:label_total) %>
11
  <h3 class="icon22 icon22-package"><%= l(:label_total) %></h3>
12
  <%
13
    estimated_hours = 0.0
14
    spent_hours = 0.0
15
    rest_hours = 0.0
16
    completed_pourcent = 0.0
17
    closed_pourcent = 0.0
18
  	@versions.each do |version|
19
  	  estimated_hours += version.estimated_hours
20
      spent_hours += version.spent_hours
21
      rest_hours += version.rest_hours
22
      completed_pourcent += version.spent_hours
23
      closed_pourcent += version.closed_spent_hours
24
  	end
25
  	total = spent_hours + rest_hours
26
  	if total > 0.0
27
      completed_pourcent = (completed_pourcent * 100.0) / total
28
      closed_pourcent = (closed_pourcent * 100.0) / total
29
  	end
30
  %>
31
  <%= progress_bar([closed_pourcent, completed_pourcent], :width => '40em', :legend => ('%0.0f%' % completed_pourcent)) %>
32
  <fieldset><legend><%= l(:label_time_tracking) %></legend>
33
  <table>
34
  <tr>
35
    <td width="130px" align="right"><%= l(:field_estimated_hours) %></td>
36
    <td width="340px" class="total-hours"><%= l_hours(estimated_hours) %></td>
37
  </tr>
38
  <% if User.current.allowed_to?(:view_time_entries, @project) %>
39
    <tr>
40
      <td width="130px" align="right"><%= l(:label_spent_time) %></td>
41
      <td width="340px" class="total-hours"><%= l_hours(spent_hours) %></td>
42
    </tr>
43
    <tr>
44
      <td width="130px" align="right"><%= l(:field_done_ratio) %></td>
45
      <td width="340px" class="total-hours"><big><%= "%.0f" % completed_pourcent %></big>%</td>
46
    </tr>
47
    <tr>
48
      <td width="130px" align="right"><%= l(:label_roadmap_due_in, "") %></td>
49
      <td width="340px" class="total-hours"><%= "#{l_hours(rest_hours)} / #{l_days(rest_hours / 8.0)} / #{l_weeks(rest_hours / 40.0)}" %></td>
50
    </tr>
51
  <% end %>
52
  </table>
53
  </fieldset>
54
<% end %>
55

  
56
<% @versions.each do |version| %>   
57
  <% issues = version.fixed_issues.find(:all,
58
                                        :include => [:status, :tracker],
59
                                        :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"],
60
                                        :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") unless @selected_tracker_ids.empty? %>
61
  <%= tag 'a', :name => version.name %>
62
  <h3 class="icon22 icon22-package"><%= link_to h(version.name), :controller => 'versions', :action => 'show', :id => version %></h3>
63
  <%= render :partial => 'versions/overview', :locals => {:version => version} %>
64
  <%= render :partial => 'versions/milestones', :locals => {:version => version} %>
65
  <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
66
  <%= render :partial => 'versions/issues', :locals => {:version => version, :issues => issues} %>
67
<% end %>
68

  
69
</div>
70
<% end %>
71

  
72
<% content_for :sidebar do %>
73
  <% form_tag({}, :method => :get) do %>
74
    <h3><%= l(:label_roadmap) %></h3>
75
    <% @trackers.each do |tracker| %>
76
      <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
77
      <%= tracker.name %></label><br />
78
    <% end %>
79
    <br />
80
    <label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
81
    <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
82
  <% end %>
83

  
84
  <h3><%= l(:label_milestone_plural) %></h3>
85
  <% @project.milestones.sort.each do |milestone| %>
86
    <%= link_to milestone.name, :controller => :milestones, :action => :show, :id => milestone.id %><br />
87
  <% end %>
88

  
89
  <h3><%= l(:label_version_plural) %></h3>
90
  <%= link_to l(:label_total), "##{l(:label_total)}" %><br />
91
  <% @versions.each do |version| %>
92
    <%= link_to version.name, "##{version.name}" %><br />
93
  <% end %>
94
<% end %>
95

  
96
<% html_title(l(:label_roadmap)) %>
advanced_roadmap.new/init.rb 2010-11-05 10:45:47.000000000 +0000
17 17

  
18 18
  Issue.send(:include, IssuePatch)
19 19
  Project.send(:include, ProjectPatch)
20
  ProjectsController.send(:include, ProjectsControllerPatch)
20
  VersionsController.send(:include, VersionsControllerPatch)
21 21
  ProjectsHelper.send(:include, ProjectsHelperPatch)
22 22
  Redmine::I18n.send(:include, RedmineI18nPatch)
23 23
  Version.send(:include, VersionPatch)
advanced_roadmap.new/lib/projects_controller_patch.rb 1970-01-01 00:00:00.000000000 +0000
1
require_dependency "projects_controller"
2

  
3
module ProjectsControllerPatch
4
  def self.included(base)
5
    base.class_eval do
6
      def roadmap_with_advanced_info
7
        roadmap_without_advanced_info
8
      end
9
      alias_method_chain :roadmap, :advanced_info
10
    end
11
  end
12
end
advanced_roadmap.new/lib/versions_controller_patch.rb 2010-11-05 10:45:47.000000000 +0000
1
require_dependency "versions_controller"
2

  
3
module VersionsControllerPatch
4
  def self.included(base)
5
    base.class_eval do
6
      def index_with_advanced_info
7
        index_without_advanced_info
8
      end
9
      alias_method_chain :index, :advanced_info
10
    end
11
  end
12
end
    (1-1/1)