Module: Card::Set::All::New::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb
Instance Method Summary collapse
-
#cancel_create_path ⇒ Object
path to redirect to after canceling a new form.
-
#create_form(form_opts = {}) ⇒ Object
-
#create_form_with_alert_guide ⇒ Object
-
#framed_create_form(form_opts = {}) ⇒ Object
-
#needs_name? ⇒ Boolean
-
#new_form_opts ⇒ Object
-
#new_in_modal_success ⇒ Object
-
#new_in_modal_title ⇒ Object
-
#new_modal_menu ⇒ Object
-
#new_modal_size ⇒ Object
-
#new_name_formgroup ⇒ Object
-
#new_name_prompt? ⇒ Boolean
-
#new_success ⇒ Object
-
#new_type_permitted? ⇒ Boolean
-
#new_type_preset? ⇒ Boolean
-
#new_type_prompt? ⇒ Boolean
-
#new_type_prompt_context? ⇒ Boolean
-
#new_view_hidden ⇒ Object
-
#new_view_name ⇒ Object
NAME HANDLING.
-
#new_view_title ⇒ Object
LOCALIZE.
-
#new_view_type ⇒ Object
TYPE HANDLING.
-
#standard_create_button(args = {}) ⇒ Object
-
#view: new ⇒ Object
-
#view: new_buttons ⇒ Object
-
#view: new_fields ⇒ Object
-
#view: new_in_modal ⇒ Object
-
#view: new_in_modal_buttons ⇒ Object
-
#view: new_type_formgroup ⇒ Object
-
#view: simple_new ⇒ Object
-
#with_create_context ⇒ Object
Instance Method Details
#cancel_create_path ⇒ Object
path to redirect to after canceling a new form
183 184 185 186 187 188 189 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 183 def cancel_create_path if main? path_to_previous else path view: (voo&.home_view || :unknown) end end |
#create_form(form_opts = {}) ⇒ Object
50 51 52 53 54 55 56 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 50 def create_form form_opts={} with_create_context do card_form :create, form_opts do create_form_with_alert_guide end end end |
#create_form_with_alert_guide ⇒ Object
78 79 80 81 82 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 78 def create_form_with_alert_guide wrap_with :div, class: "d-flex justify-content-between" do [_render_new_fields, (alert_guide if voo.show?(:guide))] end end |
#framed_create_form(form_opts = {}) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 68 def framed_create_form form_opts={} form_opts.reverse_merge! success: new_success with_create_context do frame_and_form :create, form_opts do create_form_with_alert_guide end end end |
#needs_name? ⇒ Boolean
129 130 131 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 129 def needs_name? card.name.blank? && !autoname? end |
#new_form_opts ⇒ Object
84 85 86 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 84 def new_form_opts { "data-main-success": JSON(redirect: true) } end |
#new_in_modal_success ⇒ Object
104 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 104 def new_in_modal_success; end |
#new_in_modal_title ⇒ Object
96 97 98 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 96 def new_in_modal_title new_name_prompt? ? new_view_title : render_title end |
#new_modal_menu ⇒ Object
62 63 64 65 66 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 62 def do [render_close_modal_link, render_board_link] end end |
#new_modal_size ⇒ Object
58 59 60 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 58 def new_modal_size :large end |
#new_name_formgroup ⇒ Object
118 119 120 121 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 118 def new_name_formgroup output _render_name_formgroup, hidden_field_tag("name_prompt", true) end |
#new_name_prompt? ⇒ Boolean
123 124 125 126 127 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 123 def new_name_prompt? voo.visible? :name_formgroup do needs_name? || params[:name_prompt] end end |
#new_success ⇒ Object
100 101 102 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 100 def new_success { mark: (card.rule(:thanks) || "_self") } end |
#new_type_permitted? ⇒ Boolean
157 158 159 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 157 def new_type_permitted? Card.new(type_id: card.type_id).ok? :create end |
#new_type_preset? ⇒ Boolean
149 150 151 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 149 def new_type_preset? params[:type] || voo.type end |
#new_type_prompt? ⇒ Boolean
143 144 145 146 147 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 143 def new_type_prompt? voo.visible? :new_type_formgroup do !new_type_preset? && new_type_prompt_context? && new_type_permitted? end end |
#new_type_prompt_context? ⇒ Boolean
153 154 155 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 153 def new_type_prompt_context? main? || card.simple? || card.is_template? end |
#new_view_hidden ⇒ Object
106 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 106 def new_view_hidden; end |
#new_view_name ⇒ Object
NAME HANDLING
110 111 112 113 114 115 116 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 110 def new_view_name if new_name_prompt? new_name_formgroup elsif !autoname? hidden_field_tag "card[name]", card.name end end |
#new_view_title ⇒ Object
LOCALIZE
89 90 91 92 93 94 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 89 def new_view_title output( "New", (card.type_name unless card.type_id == Card.default_type_id) ) end |
#new_view_type ⇒ Object
TYPE HANDLING
135 136 137 138 139 140 141 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 135 def new_view_type if new_type_prompt? _render_new_type_formgroup else hidden_field_tag "card[type_id]", card.type_id end end |
#standard_create_button(args = {}) ⇒ Object
191 192 193 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 191 def args={} args.merge(class: "submit-button create-submit-button") end |
#view: new ⇒ Object
11 12 13 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 11 view :new, perms: :create, unknown: true, cache: :never do framed_create_form new_form_opts end |
#view: new_buttons ⇒ Object
169 170 171 172 173 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 169 view :new_buttons do do [, (href: cancel_create_path)] end end |
#view: new_fields ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 30 view :new_fields, perms: :create, unknown: true, cache: :never do wrap true, class: "w-100" do [ new_view_hidden, new_view_name, new_view_type, _render_content_formgroups, _render(voo. || :new_buttons) ] end end |
#view: new_in_modal ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 15 view :new_in_modal, perms: :create, unknown: true, cache: :never, wrap: { modal: { footer: "", size: :edit_modal_size, title: :new_in_modal_title, menu: :new_modal_menu } } do voo. ||= :new_in_modal_buttons wrap do create_form "data-slot-selector": "modal-origin", "data-slot-error-selector": ".card-slot" end end |
#view: new_in_modal_buttons ⇒ Object
175 176 177 178 179 180 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 175 view :new_in_modal_buttons do class_up "button-form-group", "d-flex" do [(text: "Submit"), ] end end |
#view: new_type_formgroup ⇒ Object
161 162 163 164 165 166 167 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 161 view :new_type_formgroup do wrap_type_formgroup do type_field class: "type-field _live-type-field slotter", href: path(view: :new_fields), "data-remote" => true end end |
#view: simple_new ⇒ Object
26 27 28 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 26 view :simple_new, perms: :create, unknown: true, wrap: :slot, cache: :never do create_form end |
#with_create_context ⇒ Object
42 43 44 45 46 47 48 |
# File 'platypus/tmp/set/gem-defaults/mod011-edit/all/new.rb', line 42 def with_create_context with_nest_mode :edit do voo.title ||= new_view_title if new_name_prompt? voo.show :help yield end end |