diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e1505f8..61b29e7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -426,7 +426,7 @@ module ApplicationHelper end def html_hours(text) - text.gsub(%r{(\d+)\.(\d+)}, '\1.\2').html_safe + text.gsub(%r{(\d+)([\.:])(\d+)}, '\1\2\3').html_safe end def authoring(created, author, options={}) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 57a4531..ea551ec 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -149,7 +149,12 @@ module QueriesHelper def total_tag(column, value) label = content_tag('span', "#{column.caption}:") - value = content_tag('span', format_object(value), :class => 'value') + value = if [:hours, :spent_hours, :total_spent_hours, :estimated_hours].include? column.name + format_hours(value) + else + format_object(value) + end + value = content_tag('span', value, :class => 'value') content_tag('span', label + " " + value, :class => "total-for-#{column.name.to_s.dasherize}") end @@ -184,6 +189,8 @@ module QueriesHelper content_tag('span', value.to_s(issue) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe, :class => value.css_classes_for(issue)) + when :hours, :spent_hours, :total_spent_hours, :estimated_hours + format_hours(value) else format_object(value) end diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 960256e..f8acef5 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -65,7 +65,7 @@ <% end %> <% if @issue.safe_attribute? 'estimated_hours' %> -
<%= f.text_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %>
+<%= f.text_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours'), :value => format_hours(@issue.estimated_hours) %> <%= l(:field_hours) %>
<% end %> <% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %> diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 3291ba7..0a642f2 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -14,7 +14,7 @@ <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %>
+<%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time, :value => format_hours(@time_entry.hours) %> <%= l(:field_hours) %>
<%= time_entry.select :activity_id, activity_collection_for_select_options %>
diff --git a/app/views/my/blocks/_timelog.html.erb b/app/views/my/blocks/_timelog.html.erb index 5668311..5b8820c 100644 --- a/app/views/my/blocks/_timelog.html.erb +++ b/app/views/my/blocks/_timelog.html.erb @@ -46,7 +46,7 @@ entries_by_day = entries.group_by(&:spent_on)<%= setting_select :time_format, Setting::TIME_FORMATS.collect {|f| [::I18n.l(Time.now, :locale => locale, :format => f), f]}, :blank => :label_language_based %>
+<%= setting_select :timespan_format, [["%.2f" % 0.75, 'decimal'], ['0:45 h', 'minutes']], :blank => false %>
+<%= setting_select :user_format, @options[:user_format] %>
<%= setting_check_box :gravatar_enabled %>
diff --git a/app/views/timelog/_form.html.erb b/app/views/timelog/_form.html.erb index 5b0ec6a..59198d0 100644 --- a/app/views/timelog/_form.html.erb +++ b/app/views/timelog/_form.html.erb @@ -18,7 +18,7 @@<%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>
-<%= f.text_field :hours, :size => 6, :required => true %>
+<%= f.text_field :hours, :size => 6, :required => true, :value => format_hours(@time_entry.hours) %>
<%= f.text_field :comments, :size => 100, :maxlength => 1024 %>
<%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %>
<% @time_entry.custom_field_values.each do |value| %> diff --git a/app/views/timelog/_report_criteria.html.erb b/app/views/timelog/_report_criteria.html.erb index c86b219..a74cdbf 100644 --- a/app/views/timelog/_report_criteria.html.erb +++ b/app/views/timelog/_report_criteria.html.erb @@ -8,9 +8,9 @@ <% total = 0 -%> <% @report.periods.each do |period| -%> <% sum = sum_hours(select_hours(hours_for_value, @report.columns, period.to_s)); total += sum -%> -