]> source.dussan.org Git - redmine.git/commitdiff
Added 'Estimated hours' attribute on issues.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 15 Sep 2007 14:54:15 +0000 (14:54 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 15 Sep 2007 14:54:15 +0000 (14:54 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@731 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb
app/views/issues/edit.rhtml
app/views/issues/show.rhtml
app/views/projects/add_issue.rhtml
db/migrate/069_add_issues_estimated_hours.rb [new file with mode: 0644]
lang/en.yml
lang/fr.yml
public/stylesheets/application.css
test/functional/projects_controller_test.rb

index 827c6f70edff755c6efd1e3c2893b62c45704b40..23cc71f7cc605af3be5ac85aada894291bb7fa63 100644 (file)
@@ -42,6 +42,7 @@ class Issue < ActiveRecord::Base
   validates_presence_of :subject, :description, :priority, :tracker, :author, :status
   validates_length_of :subject, :maximum => 255
   validates_inclusion_of :done_ratio, :in => 0..100
+  validates_numericality_of :estimated_hours, :allow_nil => true
   validates_associated :custom_values, :on => :update
 
   # set default status for new issues
index f131041edb604c20b4573bc74c7c7de90a623cbe..53ffd7f6cef07728e7e140756f6026eb2d06ba91 100644 (file)
@@ -18,6 +18,7 @@
 <div class="splitcontentright">
 <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
 <p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
+<p><%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %></p>
 <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
 </div>
 
index 59bf9eaed8ad326b2c821c5df222c9a4037ba2fc..6be93d483156be536245ac4fe26eb987beaea9d0 100644 (file)
@@ -6,34 +6,37 @@
 <%= 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' %>
 </div>
 
-<h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%=h @issue.subject %></h2>
-
+<h2><%= @issue.tracker.name %> #<%= @issue.id %>: <%=h @issue.subject %></h2>
+        <p class="author">
+        <%= l(:label_added_time_by, distance_of_time_in_words(Time.now, @issue.created_on), link_to_user(@issue.author)) %>.
+        <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @issue.updated_on)) if @issue.created_on != @issue.updated_on %>.
+        </p>
 <div class="box">
 <table width="100%">
 <tr>
     <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td>
-    <td style="width:15%"><b><%=l(:field_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td>
-</tr>
-<tr>
-    <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
-    <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
-</tr>
-<tr>
-    <td><b><%=l(:field_author)%> :</b></td><td><%= link_to_user @issue.author %></td>
-    <td><b><%=l(:field_start_date)%> :</b></td><td><%= format_date(@issue.start_date) %></td>
+    <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td>
 </tr>
 <tr>
-    <td><b><%=l(:field_created_on)%> :</b></td><td><%= format_date(@issue.created_on) %></td>
+    <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.priority.name %></td>
     <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td>
 </tr>
 <tr>
-    <td><b><%=l(:field_updated_on)%> :</b></td><td><%= format_date(@issue.updated_on) %></td>
+    <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
     <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td>
 </tr>
 <tr>
-    <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td>
+    <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
+    <% if User.current.allowed_to?(:view_time_entries, @project) %>
     <td><b><%=l(:label_spent_time)%> :</b></td>
     <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td>
+    <% end %>
+</tr>
+<tr>
+    <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td>
+    <% if @issue.estimated_hours %>
+    <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td>
+    <% end %>
 </tr>
 <tr>
 <% n = 0
index 1793ef1d8386d47970ad6a2e67e17bdeac8dbe49..e19d00826e6946b6da768996af48bddcbe70050f 100644 (file)
@@ -19,6 +19,7 @@
 <div class="splitcontentright">
 <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
 <p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
+<p><%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %></p>
 <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
 </div>
 
diff --git a/db/migrate/069_add_issues_estimated_hours.rb b/db/migrate/069_add_issues_estimated_hours.rb
new file mode 100644 (file)
index 0000000..90b86e2
--- /dev/null
@@ -0,0 +1,9 @@
+class AddIssuesEstimatedHours < ActiveRecord::Migration
+  def self.up
+    add_column :issues, :estimated_hours, :float
+  end
+
+  def self.down
+    remove_column :issues, :estimated_hours
+  end
+end
index 29c371ad49896abc82717d066a04768f2ddc1c3f..af5dea1ea82a85c0e05d498e2a901fd799462ae8 100644 (file)
@@ -158,6 +158,7 @@ field_issue_to_id: Related issue
 field_delay: Delay
 field_assignable: Issues can be assigned to this role
 field_redirect_existing_links: Redirect existing links
+field_estimated_hours: Estimated time
 
 setting_app_title: Application title
 setting_app_subtitle: Application subtitle
@@ -416,6 +417,8 @@ label_sort_by: Sort by "%s"
 label_send_test_email: Send a test email
 label_feeds_access_key_created_on: RSS access key created %s ago
 label_module_plural: Modules
+label_added_time_by: Added %s ago by %s
+label_updated_time: Updated %s ago
 
 button_login: Login
 button_submit: Submit
index e92a28babcd59f0b8a06fe82e351df1fc21301dc..315fe8d9154c10ed04f05f977d8da46fdfd2ff66 100644 (file)
@@ -158,6 +158,7 @@ field_issue_to_id: Demande liée
 field_delay: Retard
 field_assignable: Demandes assignables à ce rôle
 field_redirect_existing_links: Rediriger les liens existants
+field_estimated_hours: Temps estimé
 
 setting_app_title: Titre de l'application
 setting_app_subtitle: Sous-titre de l'application
@@ -416,6 +417,8 @@ label_sort_by: Trier par "%s"
 label_send_test_email: Envoyer un email de test
 label_feeds_access_key_created_on: Clé d'accès RSS créée il y a %s
 label_module_plural: Modules
+label_added_time_by: Ajouté il y a %s par %s
+label_updated_time: Mis à jour il y a %s
 
 button_login: Connexion
 button_submit: Soumettre
index 064ff5ec6c1cf68d0f61ace953239a2a04925768..d896eb4ce1ddee05341294fb07651e948b802559 100644 (file)
@@ -414,6 +414,8 @@ background:#467aa7;
 .textright{text-align:right;}
 .important{color:#f02025; background-color:inherit; font-weight:bold;}
 
+#content .author {color:#888; font-style:italic;}
+
 .box{
 margin:0 0 20px 0;
 padding:10px;
index 6f8ae1d7dfbde92e664a50237a9cfa1009f40b07..5990cd0e16bef5aadf9bdb4a436d6e74d51fd4bc 100644 (file)
@@ -40,7 +40,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
     get :list
     assert_response :success
     assert_template 'list'
-    assert_not_nil assigns(:projects)
+    assert_not_nil assigns(:project_tree)
   end\r
   \r
   def test_show\r