Project

General

Profile

Patch #18679 ยป labelled-form-builder-label.patch

Masato NODA, 2014-12-18 12:37

View differences:

lib/redmine/views/labelled_form_builder.rb
class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder
include Redmine::I18n
(field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box) +
(field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box label) +
%w(date_select)).each do |selector|
src = <<-END_SRC
def #{selector}(field, options = {})
test/unit/lib/redmine/views/labelled_form_builder_test.rb
require File.expand_path('../../../../../test_helper', __FILE__)
class Redmine::Views::LabelledFormBuilderTest < ActionView::TestCase
def test_label_should_output_one_element
labelled_form_for(Issue.new) do |f|
output = f.label :subject
assert_equal output, '<label for="issue_subject">Subject</label>'
end
end
end
    (1-1/1)