Module: Card::Set::All::EditType::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb,
card/tmpsets/set/mod011-card-mod-edit/all/edit_type.rb

Instance Method Summary collapse

Instance Method Details

#edit_type_successObject



21
22
23
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 21

def edit_type_success
  { view: :core }
end

#type_field(args = {}) ⇒ Object



58
59
60
61
62
63
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 58

def type_field args={}
  typelist = Auth.createable_types
  current_type = type_field_current_value args, typelist
  action_view.select_tag "card[type]", type_field_options(current_type),
                         args.merge("data-select2-id": "#{unique_id}-#{Time.now.to_i}")
end

#type_field_current_value(args, typelist) ⇒ Object



98
99
100
101
102
103
104
105
106
107
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 98

def type_field_current_value args, typelist
  return if args.delete :no_current_type

  if !card.new_card? && !typelist.include?(card.type_name)
    # current type should be an option on existing cards,
    # regardless of create perms
    typelist.push(card.type_name).sort!
  end
  card.type_name_or_default
end

#type_formgroup(args = {}) ⇒ Object



45
46
47
48
49
50
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 45

def type_formgroup args={}
  add_class args, "type-field"
  wrap_type_formgroup do
    type_field args
  end
end

#view: bridge_type_formgroupObject



31
32
33
34
35
36
37
38
39
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 31

view :bridge_type_formgroup, unknown: true, wrap: :slot do
  type_formgroup href: path(mark: card.id,
                            view: :edit_form,
                            assign: true,
                            slot: { show: :type_form }),
                 class: "live-type-field slotter",
                 'data-remote': true,
                 'data-slot-selector': ".card-slot.edit_form-view"
end

#view: edit_typeObject



9
10
11
12
13
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 9

view :edit_type, cache: :never, perms: :update do
  frame do
    _render_edit_type_form
  end
end

#view: edit_type_formObject



15
16
17
18
19
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 15

view :edit_type_form, cache: :never, perms: :update, wrap: :slot do
  card_form :update, success: edit_type_success do
    [type_formgroup, render_new_buttons]
  end
end

#view: edit_type_rowObject



25
26
27
28
29
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 25

view :edit_type_row do
  return _render_bridge_type_formgroup if voo.visible?(:type_form) { false }

  edit_row_fixed_width "Type", link_to_card(card.type), :bridge_type_formgroup
end

#view: type_formgroupObject



41
42
43
# File 'card/tmpsets/set/mod012-card-mod-edit/all/edit_type.rb', line 41

view :type_formgroup do
  type_formgroup
end