Module | PickerHelper
In: | app/helpers/picker_helper.rb

選択部品の helper を与える。

### Methods

li_branch_link li_branch_links_for_lump li_branch_submit_tags li_leaf_link mail_picker_button_box picker_button_box picker_list_branch_link picker_list_branch_links_for_lump picker_list_branch_submit_tags picker_list_leaf picker_table_leaf tr_leaf_link

### Public Instance methods

li_branch_link(model_name, it, selected_id, options)

選択肢の集合に対するリンクを返す。

[Source]

         # File app/helpers/picker_helper.rb, line 89
     89:   def li_branch_link(model_name, it, selected_id, options)
     90:     if it.id == selected_id
     91:       css_class = "tree_icon pick selected"
     92:       tree_icon = tree_icon_open
     93:       name = '<span class="selected">' + h(it.name_with_in) + '</span>'
     94:     else
     95:       css_class = "tree_icon pick"
     96:       tree_icon = tree_icon_close
     97:       name = h(it.name_with_in)
     98:     end
     99:     return [
    100:       "<li>",
    101:       link_to_view_motion(tree_icon,
    102:         @current_view, "#{model_name}#{it.id}", {},
    103:         @pass_params_link.merge(options), :class => css_class),
    104:       name,
    105:       "</li>",
    106:     ].join(" ")
    107:   end

li_branch_links_for_lump(model_name, it, selected_id, options)

一括選択について選択肢の集合に対するリンクを返す。

[Source]

         # File app/helpers/picker_helper.rb, line 122
    122:   def li_branch_links_for_lump(model_name, it, selected_id, options)
    123:     if it.id == selected_id
    124:       css_class = "pick selected"
    125:       tree_icon = tree_icon_open
    126:     else
    127:       css_class = "pick"
    128:       tree_icon = tree_icon_close
    129:     end
    130:     options = @pass_params_link.merge(options)
    131:     return [
    132:       "<li>",
    133:       link_to_view_motion(tree_icon,
    134:         @current_view, "#{model_name}#{it.id}", {},
    135:         options.merge({:action => "lump"}), :class => "tree_icon "+css_class),
    136:       link_to_view_motion(h(it.name_with_in),
    137:         @current_view, "#{model_name}#{it.id}pick", {},
    138:         options.merge({:action => "pick", :lump_pick => model_name}), :class => css_class),
    139:       "</li>",
    140:     ].join(" ")
    141:   end

li_branch_submit_tags(model_name, it, selected_id)

その選択肢から分岐した子への submit を返す。

[Source]

         # File app/helpers/picker_helper.rb, line 156
    156:   def li_branch_submit_tags(model_name, it, selected_id)
    157:     if it.id == selected_id
    158:       css_class = "pick selected"
    159:       tree_icon = tree_icon_open_without_tag
    160:     else
    161:       css_class = "pick"
    162:       tree_icon = tree_icon_close_without_tag
    163:     end
    164:     return [
    165:       "<li>",
    166:       submit_tag("&tree_icon;", :name => "#{model_name}[open#{it.id}]", :class => "tree_icon "+css_class).sub(/&amp;tree_icon;/) { tree_icon },
    167:       submit_tag(h(it.name_with_in), :name => "#{model_name}[pick#{it.id}]", :class => css_class),
    168:       "</li>",
    169:     ].join("")
    170:   end

li_leaf_link(model_name, it, options)

選択肢のリンクを返す。

[Source]

        # File app/helpers/picker_helper.rb, line 32
    32:   def li_leaf_link(model_name, it, options)
    33:     return [
    34:       "<li>",
    35:       tree_icon_leaf,
    36:       link_to_view_motion(h(it.name_with_in),
    37:         @current_view, "#{model_name}#{it.id}", {},
    38:         @pass_params_link.merge(options), :class => "pick"),
    39:       "</li>",
    40:       ].join(" ")
    41:   end

mail_picker_button_box()

メールアドレス選択画面のボタン群を返す。

[Source]

        # File app/helpers/picker_helper.rb, line 12
    12:   def mail_picker_button_box
    13:     @picker_button_box ||= lcr_button_box({
    14:         :left => link_to_close({"_" => "&suffix;"}, @return_to_url, :class => "button"),
    15:         :right => submit_tag(h(s_("Mail Picker|OK")), :name => "pick", :id => nil),
    16:       })
    17:     return @picker_button_box
    18:   end

picker_button_box()

選択画面のボタン群を返す。

[Source]

       # File app/helpers/picker_helper.rb, line 4
    4:   def picker_button_box
    5:     @picker_button_box ||= lcr_button_box({
    6:         :left => link_to_close({"_" => "&suffix;"}, @return_to_url, :class => "button"),
    7:       })
    8:     return @picker_button_box
    9:   end

picker_list_branch_link(model_name, list)

選択肢の集合に対するリンクの一覧を返す。

[Source]

        # File app/helpers/picker_helper.rb, line 76
    76:   def picker_list_branch_link(model_name, list)
    77:     unless list.blank?
    78:       key = "#{model_name}_id".to_sym
    79:       selected_id = params[key]
    80:       action = params[:action]
    81:       list = list.map do |it|
    82:         li_branch_link(model_name, it, selected_id, :action => action, key => it.id)
    83:       end
    84:       return '<ul class="picker_list">' + list.join("") + '</ul>'
    85:     end
    86:   end

picker_list_branch_links_for_lump(model_name, list)

一括選択について選択肢の集合に対するリンクの一覧を返す。

[Source]

         # File app/helpers/picker_helper.rb, line 110
    110:   def picker_list_branch_links_for_lump(model_name, list)
    111:     unless list.blank?
    112:       key = "#{model_name}_id".to_sym
    113:       selected_id = params[key]
    114:       list = list.map do |it|
    115:         li_branch_links_for_lump(model_name, it, selected_id, key => it.id)
    116:       end
    117:       return '<ul class="picker_list">' + list.join("") + '</ul>'
    118:     end
    119:   end

picker_list_branch_submit_tags(model_name, list)

その選択肢から分岐した子への submit 群を返す。

[Source]

         # File app/helpers/picker_helper.rb, line 144
    144:   def picker_list_branch_submit_tags(model_name, list)
    145:     unless list.blank?
    146:       key = "#{model_name}_id".to_sym
    147:       selected_id = params[key]
    148:       list = list.map do |it|
    149:         li_branch_submit_tags(model_name, it, selected_id)
    150:       end
    151:       return '<ul class="picker_list">' + list.join("") + '</ul>'
    152:     end
    153:   end

picker_list_leaf(model_name, list, options={})

選択肢のリンクの一覧を返す。

[Source]

        # File app/helpers/picker_helper.rb, line 21
    21:   def picker_list_leaf(model_name, list, options={})
    22:     unless list.blank?
    23:       key = "#{model_name}_id".to_sym
    24:       list = list.map do |it|
    25:         li_leaf_link(model_name, it, options.merge(:action => "pick", key => it.id))
    26:       end
    27:       return '<ul class="picker_list">' + list.join("") + '</ul>'
    28:     end
    29:   end

picker_table_leaf(model_name, records)

選択肢のリンクの一覧を返す。

[Source]

        # File app/helpers/picker_helper.rb, line 44
    44:   def picker_table_leaf(model_name, records)
    45:     if records.blank?
    46:       contents = []
    47:     else
    48:       contents = records.map do |record|
    49:         tr_leaf_link(model_name, record, @pass_params_form)
    50:       end
    51:     end
    52:     contents.unshift(content_tag(:tr, [s_("Picker|Code"), s_("Picker|Name")].map {|x| content_tag(:th, h(x))}.join))
    53:     return content_tag(:table, contents.join, :class => "picker_list", :border => 1)
    54:   end

tr_leaf_link(model_name, record, options)

選択肢のリンクを返す。

[Source]

        # File app/helpers/picker_helper.rb, line 57
    57:   def tr_leaf_link(model_name, record, options)
    58:     contents = []
    59:     [@record_code, @record_name].each do |m|
    60:       if m
    61:         record_options = {
    62:           "#{@record_id}".to_sym => record.__send__(@record_id),
    63:           "#{@record_name}".to_sym => record.__send__(@record_name),
    64:           "#{@record_code}".to_sym => record.__send__(@record_code),
    65:         }
    66:         x = link_to_view_motion(h(record.__send__(m)),
    67:                                 @current_view, "#{model_name}#{record.id}__#{m}", {},
    68:                                 options.merge(record_options), :class => "pick")
    69:         contents << content_tag(:td, x)
    70:       end
    71:     end
    72:     return content_tag(:tr, contents.join, :class => "pick")
    73:   end

[Validate]