Module | ProductGeneratorHelper
In: | app/helpers/product_generator_helper.rb

画面生成の helper を与える。

### Methods

check_boxes_for_buttons direction_selector display_destroy? input_initializer_selector input_type_selector inputs_for_validates item_tr layout_selector links_for_operations position_selector program_field type_selector

### Public Instance methods

check_boxes_for_buttons()

各画面で利用するボタンを設定する check box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 14
    14:   def check_boxes_for_buttons
    15:     "#{@display.attributes["type"]}::BUTTON_TYPE".constantize.map do |pair|
    16:       name = "button_#{pair.last}"
    17:       check_box_with_label("display[]", name, h(s_(pair.first)))
    18:     end.join("<br />")
    19:   end

direction_selector()

項目をソートする場合の順方向を選択する select box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 62
    62:   def direction_selector
    63:     constant_select_tag(Item::LABEL_DIRECTION, "item[direction]", @item, "direction", h(s_("Option|none")))
    64:   end

display_destroy?()

削除画面かどうかを判定する。

[Source]

       # File app/helpers/product_generator_helper.rb, line 4
    4:   def display_destroy?
    5:     return controller.action_name == "display_destroy"
    6:   end

input_initializer_selector()

入力の初期値を選択するための select box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 72
    72:   def input_initializer_selector
    73:     constant_select_tag(Item::LABEL_INPUT_INITIALIZER, "item[input_initializer]", @item, "input_initializer")
    74:   end

input_type_selector()

入力の種類を選択するための select box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 67
    67:   def input_type_selector
    68:     constant_select_tag(Item::LABEL_INPUT_TYPE, "item[input_type]", @item, "input_type")
    69:   end

inputs_for_validates(column_name)

column_name を検証する部品を設定するための input 群を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 77
    77:   def inputs_for_validates(column_name)
    78:     count = Item::VALIDATES_COLUMN_PARAMETER_COUNT[column_name.to_sym]
    79:     colspan = ' colspan="2"' if count == 1
    80:     result = check_box_with_label("item", column_name, h(Item.human_attribute_name(column_name)))
    81:     (1..count).each do |i|
    82:       parameter_column_name = "#{column_name}_#{i}"
    83:       result << "</td><td#{colspan}>"
    84:       result << Item.human_attribute_name(parameter_column_name) << ":"
    85:       result << text_field("item", parameter_column_name)
    86:     end
    87:     return result
    88:   end

item_tr(header, data, options={})

項目ごとの行を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 39
    39:   def item_tr(header, data, options={})
    40:     data_colspan = options[:colspan] || 3
    41:     if data_colspan && 1 < data_colspan
    42:       colspan = %Q| colspan="#{data_colspan}"|
    43:     end
    44:     %Q|<tr><th colspan="2">#{h(header)}</th><td#{colspan}>#{data} #{options[:example]}</td></tr>|
    45:   end

layout_selector()

項目のレイアウトを選択するための select box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 48
    48:   def layout_selector
    49:     x = @display.is_a?(DisplayToList) ? "list" : "show"
    50:     select "item", "layout", InputOption.options_for_select("item_layout_#{x}", @display.items.size+2).map {|x| [x.first, x.last.to_i]}
    51:   end

links_for_operations(with_destroy)

画面に対する操作へのリンクを返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 22
    22:   def links_for_operations(with_destroy)
    23:     links = [["memo.png", "e", "display_edit", s_("ProductGenerator|Edit")]]
    24:     links << ["delete.gif", "d", "display_destroy", s_("ProductGenerator|Delete")] if with_destroy
    25:     links.map do |image, suffix, action, alt|
    26:       link_to_view_motion(image_tag(image, {:alt => alt}),
    27:         "display", "#{@display.id}#{suffix}",
    28:         {}, {:action => action, :id => @display.id},
    29:         :class => "reloadable_link")
    30:     end.join(" ")
    31:   end

position_selector()

項目の位置を選択するための select box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 54
    54:   def position_selector
    55:     size = @display.items.size
    56:     options = ((size == 0) ? [] : (1..size).map {|i| [i, i]})
    57:     options.unshift([h(s_("Option|none")), ""])
    58:     select "item", "position", options
    59:   end

program_field(x)

ビジネスロジックのパスを設定する check box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 34
    34:   def program_field(x)
    35:     check_box_with_label("display", "logic_#{x}", h(s_(DisplayToEdit::LOGIC_TYPE[x])))
    36:   end

type_selector()

機能の種類を選択する select box を返す。

[Source]

        # File app/helpers/product_generator_helper.rb, line 9
     9:   def type_selector
    10:     constant_select_tag(Product::LABEL_TYPE, "product[type]", @product, "type")
    11:   end

[Validate]