summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 14:17:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 14:17:11 +0000
commit5b5b751d8c0ec5f2f326b16198ca776042413058 (patch)
tree06eefd7f6d1d2a6e62b2d4f1b9c73da19f228ee4 /lib
parentab22ec2a94bfcb04d283057450b7d4ad65d99778 (diff)
downloadredmine-5b5b751d8c0ec5f2f326b16198ca776042413058.tar.gz
redmine-5b5b751d8c0ec5f2f326b16198ca776042413058.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/views/labelled_form_builder.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/redmine/views/labelled_form_builder.rb b/lib/redmine/views/labelled_form_builder.rb
index 965dee8c1..07805c562 100644
--- a/lib/redmine/views/labelled_form_builder.rb
+++ b/lib/redmine/views/labelled_form_builder.rb
@@ -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)