Module | ListHelper
In: | app/helpers/list_helper.rb

一覧の設定画面の helper を与える。

### Methods

check_box_to_set_default check_box_to_share detail_button_box hidden_link_to_list import_button_box input_creator_sub input_display_sub link_to_add link_to_edit link_to_import list_button_box mode picker_to_share sortable_items

### Public Instance methods

check_box_to_set_default()

[Source]

        # File app/helpers/list_helper.rb, line 83
    83:   def check_box_to_set_default
    84:     return check_box_tag("set_default", "1", @display.default_list?)
    85:   end

check_box_to_share()

[Source]

        # File app/helpers/list_helper.rb, line 87
    87:   def check_box_to_share
    88:     return check_box_tag("share", "1", @roleable)
    89:   end

detail_button_box(suffix)

[Source]

        # File app/helpers/list_helper.rb, line 58
    58:   def detail_button_box(suffix)
    59:     buttons = {
    60:       :left   => link_to_close({"_" => suffix},
    61:                                {:id => @product.id, :action => "index"},
    62:                                {:class => "button"}),
    63:       :center => submit_tag(h(s_("submit_tag|Update")), :class => "button", :name => "create"),
    64:       :right => link_to_view_motion(h(s_("List|Destroy")), @current_view, "destroy",
    65:                                     {"_" => "_#{suffix}"},
    66:                                     {:action => "destroy", :id => @product.id, :display_id => @display.id},
    67:                                     :confirm => s_("confirm|Are you sure?"),
    68:                                     :method => :post,
    69:                                     :class => "button"),
    70:     }
    71:     return lcr_button_box(buttons)
    72:   end

hidden_link_to_list()

[Source]

       # File app/helpers/list_helper.rb, line 4
    4:   def hidden_link_to_list
    5:     link_to_view_motion(h(s_("List")), "view_list", @product.id,
    6:                         {},
    7:                         {:controller => "list", :action => "index", :id => @product.id},
    8:                         {:class => "reloadable_link", :style => "display:none;"})
    9:   end

import_button_box(suffix)

[Source]

        # File app/helpers/list_helper.rb, line 74
    74:   def import_button_box(suffix)
    75:     buttons = {
    76:       :left   => link_to_close({"_" => suffix},
    77:                                {:id => @product.id, :action => "index"},
    78:                                {:class => "button"}),
    79:     }
    80:     return lcr_button_box(buttons)
    81:   end

input_creator_sub()

[Source]

         # File app/helpers/list_helper.rb, line 117
    117:   def input_creator_sub
    118:     text_field_tag("target[creator_sub]", @target && @target[:creator_sub])
    119:   end

input_display_sub()

[Source]

         # File app/helpers/list_helper.rb, line 113
    113:   def input_display_sub
    114:     text_field_tag("target[display_sub]", @target && @target[:display_sub])
    115:   end

link_to_add()

[Source]

        # File app/helpers/list_helper.rb, line 11
    11:   def link_to_add
    12:     link_to_remote(h(s_("List|Add")), {
    13:                      :update => "view_list",
    14:                      :complete => visual_effect(:highlight, "list_list"),
    15:                      :url => {:action => "add", :id => @product.id},
    16:                    }, {
    17:                      :class => "button"
    18:                    })
    19:   end

link_to_edit(display_id)

[Source]

        # File app/helpers/list_helper.rb, line 21
    21:   def link_to_edit(display_id)
    22:     link_to_view_motion(h(s_("List|Edit")), @sub_view, display_id,
    23:                         {},
    24:                         {:action => "edit", :id => @product.id, :display_id => display_id},
    25:                         {:class => "button reloadable_link"})
    26:   end

link_to_import()

[Source]

        # File app/helpers/list_helper.rb, line 28
    28:   def link_to_import
    29:     link_to_view_motion(h(s_("List|Import")), @sub_view, "import",
    30:                         {},
    31:                         {:action => "import", :id => @product.id},
    32:                         {:class => "button reloadable_link"})
    33:   end

list_button_box(suffix)

[Source]

        # File app/helpers/list_helper.rb, line 49
    49:   def list_button_box(suffix)
    50:     buttons = {
    51:       :left   => link_to_close({"_" => suffix},
    52:                                {:controller => "product", :id => @product.id, :action => "list"},
    53:                                {:class => "button"}),
    54:     }
    55:     return lcr_button_box(buttons)
    56:   end

mode()

[Source]

        # File app/helpers/list_helper.rb, line 35
    35:   def mode
    36:     case @mode
    37:     when :add
    38:       mode = h(s_("List|Mode 'Add'"))
    39:     when :edit
    40:       mode = h(s_("List|Mode 'Edit'"))
    41:     when :destroy
    42:       mode = h(s_("List|Mode 'Destroy'"))
    43:     else
    44:       mode = false
    45:     end
    46:     return mode
    47:   end

picker_to_share()

[Source]

         # File app/helpers/list_helper.rb, line 91
     91:   def picker_to_share
     92:     e = text_field("roleable", "name", :readonly => true, :size => 30, :class => (@roleable ? "selected" : ""))
     93:     e << " "
     94:     e << submit_tag(h(s_("List|Pick")), :class => "button", :name => "picker")
     95:     # hidden link for ajax
     96:     e << link_to_view_motion("", @sub_view, "lump", {
     97:                              }, {
     98:                                :controller   => "picker",
     99:                                :action       => "lump",
    100:                                :return_field => "lump",
    101:                                :return_to    => "list_share",
    102:                                :view         => @sub_view,
    103:                              }, {
    104:                                :style => "display:none",
    105:                              })
    106:     if @roleable
    107:       e << hidden_field_tag("roleable_id", @roleable.id)
    108:       e << hidden_field_tag("roleable_type", @roleable.class.to_s)
    109:     end
    110:     return e
    111:   end

sortable_items()

[Source]

         # File app/helpers/list_helper.rb, line 121
    121:   def sortable_items
    122:     x = ["selected", "unselected"]
    123:     y = x.map {|prefix| "#{prefix}_items"}
    124:     x.map do |prefix|
    125:       sortable_element("#{prefix}_items",
    126:                        :complete => visual_effect(:highlight, "#{prefix}_items"),
    127:                        :url => {:action => "order_#{prefix}", :id => @product.id, :display_id => @display.id},
    128:                        :dropOnEmpty => true,
    129:                        :containment => y,
    130:                        :constraint => false)
    131:     end.join
    132:   end

[Validate]