mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-06 15:41:33 +00:00
Show the entered value when it's not valid (#23996).
git-svn-id: http://svn.redmine.org/redmine/trunk@15971 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ab22ec2a94
commit
5b5b751d8c
@ -65,7 +65,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if @issue.safe_attribute? 'estimated_hours' %>
|
||||
<p><%= f.text_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours'), :value => format_hours(@issue.estimated_hours) %> <%= l(:field_hours) %></p>
|
||||
<p><%= f.hours_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p>
|
||||
<% end %>
|
||||
|
||||
<% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<%= labelled_fields_for :time_entry, @time_entry do |time_entry| %>
|
||||
<div class="splitcontent">
|
||||
<div class="splitcontentleft">
|
||||
<p><%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time, :value => format_hours(@time_entry.hours) %> <%= l(:field_hours) %></p>
|
||||
<p><%= time_entry.hours_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %></p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p><%= time_entry.select :activity_id, activity_collection_for_select_options %></p>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
</span>
|
||||
</p>
|
||||
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
||||
<p><%= f.text_field :hours, :size => 6, :required => true, :value => format_hours(@time_entry.hours) %></p>
|
||||
<p><%= f.hours_field :hours, :size => 6, :required => true %></p>
|
||||
<p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p>
|
||||
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
|
||||
<% @time_entry.custom_field_values.each do |value| %>
|
||||
|
||||
@ -42,6 +42,15 @@ class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder
|
||||
label_for_field(field, options) + super(field, priority_zones, options, html_options.except(:label)).html_safe
|
||||
end
|
||||
|
||||
# A field for entering hours value
|
||||
def hours_field(field, options={})
|
||||
# display the value before type cast when the entered value is not valid
|
||||
if @object.errors[field].blank?
|
||||
options = options.merge(:value => format_hours(@object.send field))
|
||||
end
|
||||
text_field field, options
|
||||
end
|
||||
|
||||
# Returns a label tag for the given field
|
||||
def label_for_field(field, options = {})
|
||||
return ''.html_safe if options.delete(:no_label)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user