labelled-form-builder-label.patch

Masato NODA, 2014-12-18 12:37

Download (1.22 KB)

View differences:

lib/redmine/views/labelled_form_builder.rb
20 20
class Redmine::Views::LabelledFormBuilder < ActionView::Helpers::FormBuilder
21 21
  include Redmine::I18n
22 22

  
23
  (field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box) +
23
  (field_helpers.map(&:to_s) - %w(radio_button hidden_field fields_for check_box label) +
24 24
        %w(date_select)).each do |selector|
25 25
    src = <<-END_SRC
26 26
    def #{selector}(field, options = {})
test/unit/lib/redmine/views/labelled_form_builder_test.rb
1
require File.expand_path('../../../../../test_helper', __FILE__)
2

  
3
class Redmine::Views::LabelledFormBuilderTest < ActionView::TestCase
4

  
5
  def test_label_should_output_one_element
6
    labelled_form_for(Issue.new) do |f|
7
      output = f.label :subject
8
      assert_equal output, '<label for="issue_subject">Subject</label>'
9
    end
10
  end
11
end