card-mod-edit 0.13.2 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/set/all/edit_content.rb +2 -2
- data/set/all/edit_inline.rb +3 -4
- data/set/all/edit_name.rb +12 -22
- data/set/all/edit_name_skip_referers.haml +4 -0
- data/set/all/edit_type.rb +4 -11
- data/set/all/editing.rb +2 -4
- data/set/all/editor.rb +2 -2
- data/set/all/form.rb +2 -2
- data/set/all/formgroup.rb +27 -15
- data/set/all/new.rb +54 -53
- data/set/all/read_formgroup.haml +5 -0
- data/set/all/template_nest.rb +3 -3
- metadata +21 -6
- data/set/all/edit_name_confirmation.haml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a86c67c71f50c7b45836f6166ca956e80cee6877364384b95dc25038bef5241
|
4
|
+
data.tar.gz: fb33b97ea23ea991791ac74b07415573a39eecae233712c126647e4b862b2ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ab0b5b9fba295909a90912a7260d8cbba847eb9d403d9c9effc57a4ee9a2f77ca2b8e7385f983f0e1df9c5dbd6f0104afd32eb7fbc884daf3fe2144170f4cb
|
7
|
+
data.tar.gz: 6d05d22e44ff5d9240f378337d8d612129f93e4e8f8175a91ef5c0b9db2ba1370d371bb99e666e822d792eee975293d6e1bb53f5317ced3fb340c77d423fdfcc
|
data/set/all/edit_content.rb
CHANGED
@@ -9,7 +9,7 @@ format :html do
|
|
9
9
|
def edit_form
|
10
10
|
voo.hide :edit_type_row
|
11
11
|
form_opts = edit_form_opts.reverse_merge success: edit_success
|
12
|
-
card_form
|
12
|
+
card_form :update, form_opts do
|
13
13
|
[
|
14
14
|
edit_view_hidden,
|
15
15
|
_render_edit_type_row(home_view: :edit_type_row),
|
@@ -20,7 +20,7 @@ format :html do
|
|
20
20
|
# the slot wrap. Id think this would probably best be handled as an
|
21
21
|
# option to #wrap that triggers a new heir voo
|
22
22
|
_render_content_formgroups,
|
23
|
-
|
23
|
+
_render(voo.buttons_view || :edit_buttons)
|
24
24
|
]
|
25
25
|
end
|
26
26
|
end
|
data/set/all/edit_inline.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
format :html do
|
2
2
|
view :edit_inline, perms: :update, unknown: true, cache: :never, wrap: :slot do
|
3
|
+
add_name_context
|
3
4
|
voo.hide :name_formgroup, :type_formgroup
|
4
5
|
with_nest_mode :edit do
|
5
6
|
card_form :update, success: edit_success do
|
6
7
|
[
|
7
8
|
edit_view_hidden,
|
8
9
|
_render_content_formgroups,
|
9
|
-
|
10
|
+
_render(voo.buttons_view || :edit_inline_buttons)
|
10
11
|
]
|
11
12
|
end
|
12
13
|
end
|
@@ -18,9 +19,7 @@ format :html do
|
|
18
19
|
|
19
20
|
view :edit_inline_buttons do
|
20
21
|
button_formgroup do
|
21
|
-
|
22
|
-
[standard_save_button, cancel_in_place_button, delete_button]
|
23
|
-
end
|
22
|
+
[standard_save_button, cancel_in_place_button, delete_button]
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
data/set/all/edit_name.rb
CHANGED
@@ -7,50 +7,40 @@ format :html do
|
|
7
7
|
name_form :edit_name_row
|
8
8
|
end
|
9
9
|
|
10
|
+
private
|
11
|
+
|
10
12
|
def name_form success_view=nil
|
11
13
|
card_form({ action: :update, id: card.id },
|
12
14
|
{ "data-main-success": JSON(redirect: true, view: ""),
|
13
|
-
"data-
|
15
|
+
"data-slotter-mode": "update-origin",
|
14
16
|
class: "_rename-form",
|
15
17
|
success: edit_name_success(success_view) }) do
|
16
|
-
[
|
17
|
-
|
18
|
-
edit_name_confirmation,
|
18
|
+
[_render_name_formgroup,
|
19
|
+
edit_name_skip_referers,
|
19
20
|
edit_name_buttons]
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
24
|
+
def edit_name_skip_referers
|
25
|
+
haml :edit_name_skip_referers
|
26
|
+
end
|
27
|
+
|
23
28
|
def edit_name_success view=nil
|
24
29
|
success = { name: "_self", redirect: "" }
|
25
30
|
success[:view] = view if view
|
26
31
|
success
|
27
32
|
end
|
28
33
|
|
29
|
-
def edit_name_hidden_fields
|
30
|
-
hidden_tags old_name: card.name, card: { update_referers: false }
|
31
|
-
end
|
32
|
-
|
33
34
|
def edit_name_buttons
|
34
35
|
class_up "button-form-group", "rename-button-form-group"
|
35
36
|
button_formgroup do
|
36
|
-
[
|
37
|
+
[rename_button, standard_cancel_button]
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
def edit_name_confirmation
|
41
|
-
alert "warning", false, false, class: "hidden-alert" do
|
42
|
-
haml :edit_name_confirmation, referer_count: card.references_in.count
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def rename_and_update_button
|
47
|
-
submit_button text: t(:core_rename_and_update),
|
48
|
-
disable_with: t(:core_renaming),
|
49
|
-
class: "_renamer-updater"
|
50
|
-
end
|
51
|
-
|
52
41
|
def rename_button
|
53
42
|
button_tag t(:core_rename),
|
54
|
-
class: "renamer", data: { disable_with: t(:core_renaming)
|
43
|
+
class: "renamer", data: { disable_with: t(:core_renaming),
|
44
|
+
confirm: t(:core_rename_confirm) }
|
55
45
|
end
|
56
46
|
end
|
data/set/all/edit_type.rb
CHANGED
@@ -26,9 +26,8 @@ format :html do
|
|
26
26
|
view: :edit_form,
|
27
27
|
assign: true,
|
28
28
|
slot: { show: :type_form }),
|
29
|
-
class: "
|
30
|
-
'data-remote': true
|
31
|
-
'data-slot-selector': ".card-slot.edit_form-view"
|
29
|
+
class: "_live-type-field",
|
30
|
+
'data-remote': true
|
32
31
|
end
|
33
32
|
|
34
33
|
view :type_formgroup do
|
@@ -95,19 +94,13 @@ format :html do
|
|
95
94
|
|
96
95
|
visible_cardtype_groups.each_pair.with_object(groups) do |(name, items), grps|
|
97
96
|
if name == "Custom"
|
98
|
-
|
97
|
+
groups[name] = custom_types
|
99
98
|
else
|
100
99
|
standard_grouped_types grps, name, items
|
101
100
|
end
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
105
|
-
def custom_grouped_types groups
|
106
|
-
Auth.createable_types.each do |type|
|
107
|
-
groups["Custom"] << type unless ::Card::Set::Self::Cardtype::GROUP_MAP[type]
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
104
|
def standard_grouped_types groups, name, items
|
112
105
|
items.each do |i|
|
113
106
|
groups[name] << i if raw_type_options.include?(i)
|
@@ -115,6 +108,6 @@ format :html do
|
|
115
108
|
end
|
116
109
|
|
117
110
|
def visible_cardtype_groups
|
118
|
-
::
|
111
|
+
All::CardtypeGroups::GROUP
|
119
112
|
end
|
120
113
|
end
|
data/set/all/editing.rb
CHANGED
@@ -38,9 +38,7 @@ format :html do
|
|
38
38
|
|
39
39
|
view :edit_buttons do
|
40
40
|
button_formgroup do
|
41
|
-
|
42
|
-
[standard_submit_button, edit_cancel_button, delete_button]
|
43
|
-
end
|
41
|
+
[standard_submit_button, edit_cancel_button, delete_button]
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
@@ -82,7 +80,7 @@ format :html do
|
|
82
80
|
# frame do
|
83
81
|
# # with_nest_mode :edit do
|
84
82
|
# nested_fields.map do |name, _options|
|
85
|
-
# nest Card.fetch(name.to_name.
|
83
|
+
# nest Card.fetch(name.to_name.field(:self)),
|
86
84
|
# view: :titled, title: name, rule_view: view,
|
87
85
|
# hide: :set_label, show: :rule_navbar
|
88
86
|
# end
|
data/set/all/editor.rb
CHANGED
data/set/all/form.rb
CHANGED
@@ -31,8 +31,8 @@ format :html do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def wrap_content_formgroup &block
|
34
|
-
formgroup
|
35
|
-
class: classy("card-editor"), &block
|
34
|
+
formgroup "Content", input: :content, help: false,
|
35
|
+
class: classy("card-editor"), &block
|
36
36
|
end
|
37
37
|
|
38
38
|
def button_formgroup &block
|
data/set/all/formgroup.rb
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
format :html do
|
2
|
-
|
2
|
+
view :read_form do
|
3
|
+
edit_field_configs.map do |field, args|
|
4
|
+
args[:view] = :read_formgroup
|
5
|
+
nest field, args
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
view :read_formgroup, template: :haml, unknown: true, wrap: :slot
|
10
|
+
|
11
|
+
# a formgroup has a label (with helptext) and an input
|
3
12
|
def formgroup title, opts={}, &block
|
13
|
+
input = opts[:input]
|
4
14
|
wrap_with :div, formgroup_div_args(opts[:class]) do
|
5
|
-
|
15
|
+
[formgroup_label(input, title, opts[:help]),
|
16
|
+
editor_wrap(input, &block)]
|
6
17
|
end
|
7
18
|
end
|
8
19
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
help_text = formgroup_help_text opts[:help]
|
13
|
-
"#{label}<div>#{help_text} #{editor_body}</div>"
|
14
|
-
end
|
20
|
+
def formgroup_label input, title, help
|
21
|
+
parts = [formgroup_title(title), formgroup_help(help)].compact
|
22
|
+
return unless parts.present?
|
15
23
|
|
16
|
-
|
17
|
-
|
24
|
+
form.label (input || :content), raw(parts.join("\n"))
|
25
|
+
end
|
18
26
|
|
19
|
-
|
20
|
-
|
27
|
+
def formgroup_title title
|
28
|
+
title if voo&.show?(:title) && title.present?
|
21
29
|
end
|
22
30
|
|
23
31
|
def formgroup_div_args html_class
|
@@ -27,11 +35,15 @@ format :html do
|
|
27
35
|
div_args
|
28
36
|
end
|
29
37
|
|
30
|
-
def
|
31
|
-
return
|
38
|
+
def formgroup_help text=nil
|
39
|
+
return unless voo&.show?(:help) && text != false
|
32
40
|
|
33
41
|
class_up "help-text", "help-block"
|
34
|
-
|
42
|
+
formgroup_voo_help text
|
35
43
|
_render_help
|
36
44
|
end
|
45
|
+
|
46
|
+
def formgroup_voo_help text
|
47
|
+
voo.help = text if voo && text.present? && text.to_s != "true"
|
48
|
+
end
|
37
49
|
end
|
data/set/all/new.rb
CHANGED
@@ -2,30 +2,49 @@ format :html do
|
|
2
2
|
delegate :autoname?, to: :card
|
3
3
|
|
4
4
|
view :new, perms: :create, unknown: true, cache: :never do
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
view :new_content_form, wrap: :slot, unknown: true, cache: :never do
|
9
|
-
with_nest_mode :edit do
|
10
|
-
create_form
|
11
|
-
end
|
5
|
+
framed_create_form new_form_opts
|
12
6
|
end
|
13
7
|
|
14
8
|
view :new_in_modal, perms: :create, unknown: true, cache: :never,
|
15
9
|
wrap: { modal: { footer: "", size: :edit_modal_size,
|
16
10
|
title: :new_in_modal_title,
|
17
11
|
menu: :new_modal_menu } } do
|
18
|
-
|
12
|
+
voo.buttons_view ||= :new_in_modal_buttons
|
13
|
+
wrap do
|
14
|
+
create_form "data-slot-selector": "modal-origin",
|
15
|
+
"data-slot-error-selector": ".card-slot"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
view :simple_new, perms: :create, unknown: true, wrap: :slot, cache: :never do
|
20
|
+
create_form
|
19
21
|
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
view :new_fields, perms: :create, unknown: true, cache: :never do
|
24
|
+
wrap true, class: "w-100" do
|
25
|
+
[
|
26
|
+
new_view_hidden,
|
27
|
+
new_view_name,
|
28
|
+
new_view_type,
|
29
|
+
_render_content_formgroups,
|
30
|
+
_render(voo.buttons_view || :new_buttons)
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def with_create_context
|
36
|
+
with_nest_mode :edit do
|
37
|
+
voo.title ||= new_view_title if new_name_prompt?
|
38
|
+
voo.show :help
|
39
|
+
yield
|
40
|
+
end
|
41
|
+
end
|
24
42
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
43
|
+
def create_form form_opts={}
|
44
|
+
with_create_context do
|
45
|
+
card_form :create, form_opts do
|
46
|
+
create_form_with_alert_guide
|
47
|
+
end
|
29
48
|
end
|
30
49
|
end
|
31
50
|
|
@@ -39,45 +58,27 @@ format :html do
|
|
39
58
|
end
|
40
59
|
end
|
41
60
|
|
42
|
-
def
|
43
|
-
|
44
|
-
form_opts = form_opts.reverse_merge(success: new_success)
|
61
|
+
def framed_create_form form_opts={}
|
62
|
+
form_opts.reverse_merge! success: new_success
|
45
63
|
|
46
|
-
|
47
|
-
voo.title ||= new_view_title if new_name_prompt?
|
48
|
-
voo.show :help
|
64
|
+
with_create_context do
|
49
65
|
frame_and_form :create, form_opts do
|
50
|
-
create_form_with_alert_guide
|
66
|
+
create_form_with_alert_guide
|
51
67
|
end
|
52
68
|
end
|
53
69
|
end
|
54
70
|
|
55
|
-
def create_form_with_alert_guide
|
71
|
+
def create_form_with_alert_guide
|
56
72
|
wrap_with :div, class: "d-flex justify-content-between" do
|
57
|
-
[(
|
58
|
-
[
|
59
|
-
new_view_hidden,
|
60
|
-
new_view_name,
|
61
|
-
new_view_type,
|
62
|
-
_render_content_formgroups,
|
63
|
-
buttons
|
64
|
-
]
|
65
|
-
end),
|
66
|
-
(alert_guide if voo.show?(:guide))]
|
73
|
+
[_render_new_fields, (alert_guide if voo.show?(:guide))]
|
67
74
|
end
|
68
75
|
end
|
69
76
|
|
70
|
-
def new_view_hidden; end
|
71
|
-
|
72
|
-
def new_in_modal_form_opts
|
73
|
-
{ "data-slot-selector": "modal-origin", "data-slot-error-selector": ".card-slot",
|
74
|
-
buttons: _render_new_in_modal_buttons }
|
75
|
-
end
|
76
|
-
|
77
77
|
def new_form_opts
|
78
78
|
{ "data-main-success": JSON(redirect: true) }
|
79
79
|
end
|
80
80
|
|
81
|
+
# LOCALIZE
|
81
82
|
def new_view_title
|
82
83
|
output(
|
83
84
|
"New",
|
@@ -95,6 +96,8 @@ format :html do
|
|
95
96
|
|
96
97
|
def new_in_modal_success; end
|
97
98
|
|
99
|
+
def new_view_hidden; end
|
100
|
+
|
98
101
|
# NAME HANDLING
|
99
102
|
|
100
103
|
def new_view_name
|
@@ -150,34 +153,32 @@ format :html do
|
|
150
153
|
|
151
154
|
view :new_type_formgroup do
|
152
155
|
wrap_type_formgroup do
|
153
|
-
type_field class: "type-field
|
154
|
-
href: path(view: :
|
156
|
+
type_field class: "type-field _live-type-field slotter",
|
157
|
+
href: path(view: :new_fields),
|
155
158
|
"data-remote" => true
|
156
159
|
end
|
157
160
|
end
|
158
161
|
|
159
162
|
view :new_buttons do
|
160
163
|
button_formgroup do
|
161
|
-
[standard_create_button, standard_cancel_button(
|
164
|
+
[standard_create_button, standard_cancel_button(href: cancel_create_path)]
|
162
165
|
end
|
163
166
|
end
|
164
167
|
|
165
168
|
view :new_in_modal_buttons do
|
169
|
+
class_up "button-form-group", "d-flex"
|
166
170
|
button_formgroup do
|
167
|
-
|
168
|
-
[standard_save_and_close_button(text: "Submit"), modal_cancel_button]
|
169
|
-
end
|
171
|
+
[standard_save_and_close_button(text: "Submit"), modal_cancel_button]
|
170
172
|
end
|
171
173
|
end
|
172
174
|
|
173
175
|
# path to redirect to after canceling a new form
|
174
|
-
def
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
{ href: href }
|
176
|
+
def cancel_create_path
|
177
|
+
if main?
|
178
|
+
path_to_previous
|
179
|
+
else
|
180
|
+
path view: (voo&.home_view || :unknown)
|
181
|
+
end
|
181
182
|
end
|
182
183
|
|
183
184
|
def standard_create_button
|
data/set/all/template_nest.rb
CHANGED
@@ -14,7 +14,7 @@ format do
|
|
14
14
|
def template_link_set_name
|
15
15
|
name = voo.nest_name.to_name
|
16
16
|
if name.absolute?
|
17
|
-
name.
|
17
|
+
name.field_name :self
|
18
18
|
else
|
19
19
|
template_link_set_name_for_relative_name name
|
20
20
|
end
|
@@ -24,9 +24,9 @@ format do
|
|
24
24
|
name = name.stripped.gsub(/^\+/, "")
|
25
25
|
|
26
26
|
if (type = on_type_set)
|
27
|
-
[type, name].to_name.
|
27
|
+
[type, name].to_name.field_name :type_plus_right
|
28
28
|
else
|
29
|
-
name.to_name.
|
29
|
+
name.to_name.field_name :right
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-edit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.104.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.104.1
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: card-mod-rules
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - '='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.14.1
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.14.1
|
29
43
|
description: ''
|
30
44
|
email:
|
31
45
|
- info@decko.org
|
@@ -43,7 +57,7 @@ files:
|
|
43
57
|
- set/all/edit_content.rb
|
44
58
|
- set/all/edit_inline.rb
|
45
59
|
- set/all/edit_name.rb
|
46
|
-
- set/all/
|
60
|
+
- set/all/edit_name_skip_referers.haml
|
47
61
|
- set/all/edit_type.rb
|
48
62
|
- set/all/editing.rb
|
49
63
|
- set/all/editor.rb
|
@@ -54,6 +68,7 @@ files:
|
|
54
68
|
- set/all/new.rb
|
55
69
|
- set/all/overlay_guide.haml
|
56
70
|
- set/all/overlay_guide.rb
|
71
|
+
- set/all/read_formgroup.haml
|
57
72
|
- set/all/template_nest.rb
|
58
73
|
- set/right/input_type.rb
|
59
74
|
- set/self/input_type.rb
|
@@ -85,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
100
|
- !ruby/object:Gem::Version
|
86
101
|
version: '0'
|
87
102
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.2.15
|
89
104
|
signing_key:
|
90
105
|
specification_version: 4
|
91
106
|
summary: Edit handling
|