From: Jean-Philippe Lang Date: Sat, 15 Sep 2007 14:54:15 +0000 (+0000) Subject: Added 'Estimated hours' attribute on issues. X-Git-Tag: 0.6.0~151 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=89b349818bfaee2669aab99df9e11de84c0f145c;p=redmine.git Added 'Estimated hours' attribute on issues. git-svn-id: http://redmine.rubyforge.org/svn/trunk@731 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/issue.rb b/app/models/issue.rb index 827c6f70e..23cc71f7c 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/app/views/issues/edit.rhtml b/app/views/issues/edit.rhtml index f131041ed..53ffd7f6c 100644 --- a/app/views/issues/edit.rhtml +++ b/app/views/issues/edit.rhtml @@ -18,6 +18,7 @@

<%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %>

<%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %>

+

<%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %>

<%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>

diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 59bf9eaed..6be93d483 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -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' %> -

<%= @issue.tracker.name %> #<%= @issue.id %> - <%=h @issue.subject %>

- +

<%= @issue.tracker.name %> #<%= @issue.id %>: <%=h @issue.subject %>

+

+ <%= 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 %>. +

- - - - - - - - - + - + - + - + + <% if User.current.allowed_to?(:view_time_entries, @project) %> + <% end %> + + + + <% if @issue.estimated_hours %> + + <% end %> <% n = 0 diff --git a/app/views/projects/add_issue.rhtml b/app/views/projects/add_issue.rhtml index 1793ef1d8..e19d00826 100644 --- a/app/views/projects/add_issue.rhtml +++ b/app/views/projects/add_issue.rhtml @@ -19,6 +19,7 @@

<%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %>

<%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %>

+

<%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %>

<%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>

diff --git a/db/migrate/069_add_issues_estimated_hours.rb b/db/migrate/069_add_issues_estimated_hours.rb new file mode 100644 index 000000000..90b86e243 --- /dev/null +++ b/db/migrate/069_add_issues_estimated_hours.rb @@ -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 diff --git a/lang/en.yml b/lang/en.yml index 29c371ad4..af5dea1ea 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -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 diff --git a/lang/fr.yml b/lang/fr.yml index e92a28bab..315fe8d91 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -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 diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 064ff5ec6..d896eb4ce 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -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; diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 6f8ae1d7d..5990cd0e1 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -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 def test_show
<%=l(:field_status)%> :<%= @issue.status.name %><%=l(:field_priority)%> :<%= @issue.priority.name %>
<%=l(:field_assigned_to)%> :<%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %><%=l(:field_category)%> :<%=h @issue.category ? @issue.category.name : "-" %>
<%=l(:field_author)%> :<%= link_to_user @issue.author %><%=l(:field_start_date)%> :<%= format_date(@issue.start_date) %><%=l(:field_start_date)%> :<%= format_date(@issue.start_date) %>
<%=l(:field_created_on)%> :<%= format_date(@issue.created_on) %><%=l(:field_priority)%> :<%= @issue.priority.name %> <%=l(:field_due_date)%> :<%= format_date(@issue.due_date) %>
<%=l(:field_updated_on)%> :<%= format_date(@issue.updated_on) %><%=l(:field_assigned_to)%> :<%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %> <%=l(:field_done_ratio)%> :<%= @issue.done_ratio %> %
<%=l(:field_fixed_version)%> :<%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %><%=l(:field_category)%> :<%=h @issue.category ? @issue.category.name : "-" %><%=l(:label_spent_time)%> : <%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %>
<%=l(:field_fixed_version)%> :<%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %><%=l(:field_estimated_hours)%> :<%= lwr(:label_f_hour, @issue.estimated_hours) %>