mod/pointer/set/abstract/02_pointer/html_views.rb in card-1.98.3 vs mod/pointer/set/abstract/02_pointer/html_views.rb in card-1.99.0

- old
+ new

@@ -19,11 +19,11 @@ def standard_pointer_items paging_args pointer_items(paging_args.extract!(:limit, :offset)).join(voo.separator || "\n") end - view :closed_content do + view :one_line_content do item_view = implicit_item_view item_view = item_view == "name" ? "name" : "link" wrap_with :div, class: "pointer-list" do # limit to first 10 items to optimize pointer_items(view: item_view, limit: 10, offset: 0).join ", " @@ -32,15 +32,15 @@ def wrap_item rendered, item_view %(<div class="pointer-item item-#{item_view}">#{rendered}</div>) end - view :editor do + view :input do _render_hidden_content_field + super() end - def default_editor + def default_input_type :list end view :list, cache: :never do list_input @@ -52,11 +52,12 @@ def list_input args={} items = items_for_input args[:item_list] extra_class = "pointer-list-ul" ul_classes = classy "pointer-list-editor", extra_class - haml :list_input, items: items, ul_classes: ul_classes + haml :list_input, items: items, ul_classes: ul_classes, + options_card: options_card_name end %i[autocomplete checkbox radio select multiselect].each do |editor_view| view(editor_view) { send "#{editor_view}_input" } end @@ -65,15 +66,15 @@ items = items_for_input haml :autocomplete_input, item: items.first, options_card: options_card_name end def checkbox_input - haml :checkbox_input + haml :checkbox_input, submit_on_change: @submit_on_change end def radio_input - haml :radio_input + haml :radio_input, submit_on_change: @submit_on_change end def select_input options = { "-- Select --" => "" }.merge card.options_hash select_tag("pointer_select-#{unique_id}", @@ -99,9 +100,17 @@ slot: { hide: [:modal_footer] }, filter: { not_ids: card.item_ids.map(&:to_s).join(",") } } end def add_item_overlay_link; end + + def one_line_content + if count == 1 + card.item_names.first + else + short_content + end + end private # currently only used by :list and :autocomplete. could be generalized? def items_for_input items=nil