##// END OF EJS Templates
Show the entered value when it's not valid (#23996)....
Jean-Philippe Lang -
r15589:5b5b751d8c0e
parent child
Show More
@@ -65,7 +65,7
65 <% end %>
65 <% end %>
66
66
67 <% if @issue.safe_attribute? 'estimated_hours' %>
67 <% if @issue.safe_attribute? 'estimated_hours' %>
68 <p><%= f.text_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours'), :value => format_hours(@issue.estimated_hours) %> <%= l(:field_hours) %></p>
68 <p><%= f.hours_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p>
69 <% end %>
69 <% end %>
70
70
71 <% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %>
71 <% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %>
@@ -14,7 +14,7
14 <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %>
14 <%= labelled_fields_for :time_entry, @time_entry do |time_entry| %>
15 <div class="splitcontent">
15 <div class="splitcontent">
16 <div class="splitcontentleft">
16 <div class="splitcontentleft">
17 <p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time, :value => format_hours(@time_entry.hours) %> <%= l(:field_hours) %></p>
17 <p><%= time_entry.hours_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p>
18 </div>
18 </div>
19 <div class="splitcontentright">
19 <div class="splitcontentright">
20 <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
20 <p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
@@ -18,7 +18,7
18 </span>
18 </span>
19 </p>
19 </p>
20 <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
20 <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
21 <p><%= f.text_field :hours, :size => 6, :required => true, :value => format_hours(@time_entry.hours) %></p>
21 <p><%= f.hours_field :hours, :size => 6, :required => true %></p>
22 <p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p>
22 <p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p>
23 <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
23 <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
24 <% @time_entry.custom_field_values.each do |value| %>
24 <% @time_entry.custom_field_values.each do |value| %>
@@ -42,6 +42,15 class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder
42 label_for_field(field, options) + super(field, priority_zones, options, html_options.except(:label)).html_safe
42 label_for_field(field, options) + super(field, priority_zones, options, html_options.except(:label)).html_safe
43 end
43 end
44
44
45 # A field for entering hours value
46 def hours_field(field, options={})
47 # display the value before type cast when the entered value is not valid
48 if @object.errors[field].blank?
49 options = options.merge(:value => format_hours(@object.send field))
50 end
51 text_field field, options
52 end
53
45 # Returns a label tag for the given field
54 # Returns a label tag for the given field
46 def label_for_field(field, options = {})
55 def label_for_field(field, options = {})
47 return ''.html_safe if options.delete(:no_label)
56 return ''.html_safe if options.delete(:no_label)
General Comments 0
You need to be logged in to leave comments. Login now