card-mod-edit 0.11.0 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/set/all/bridge.rb +3 -3
- data/set/all/bridge/related_section.rb +2 -2
- data/set/all/bridge/tab_visibility.rb +10 -5
- data/set/all/edit_name.rb +18 -20
- data/set/all/edit_name_confirmation.haml +7 -0
- data/set/all/edit_type.rb +52 -33
- data/set/all/editor.rb +3 -5
- data/set/all/form.rb +14 -11
- data/set/all/form_buttons.rb +11 -2
- data/set/all/form_elements.rb +1 -0
- data/set/all/new.rb +2 -2
- data/set/all/template_nest.rb +1 -1
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a54a9e3aa482aa83ddee3fbca1e2a2ffbbb733124cf681aab56a159e6a943e2
|
4
|
+
data.tar.gz: 7a719d423cb25de68e1974e4d73c87c6719398d0b7e1bb1d787256f93330d6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c879f60df6bce6723ba0d1d05f2dc423594a5ca02d661640d3d708ab8f66f00dc2b4ca05768166c1fcee10fdb304023ceb4cd6c3f1000159990f290fa7dacc8
|
7
|
+
data.tar.gz: 691b4cff469c27bc9d5e0d64e61074a7b709a00701ff9fce21c0705454407b3ae606b3fefe673991a0c9e564640fd524bdca85087d68e1f7155cd1614b2eef39
|
data/set/all/bridge.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
BRIDGE_TABS = { "Account" => :account_tab,
|
2
|
-
"Guide"
|
3
|
-
"Engage"
|
2
|
+
"Guide" => :guide_tab,
|
3
|
+
"Engage" => :engage_tab,
|
4
4
|
"History" => :history_tab,
|
5
5
|
"Related" => :related_tab,
|
6
|
-
"Rules"
|
6
|
+
"Rules" => :rules_tab }.freeze
|
7
7
|
|
8
8
|
format :html do
|
9
9
|
wrapper :bridge do
|
@@ -17,7 +17,7 @@ format :html do
|
|
17
17
|
|
18
18
|
def related_by_name_items
|
19
19
|
pills = []
|
20
|
-
if card.name.
|
20
|
+
if card.name.compound?
|
21
21
|
pills += card.name.ancestors.map { |a| [a, a, { mark: :absolute }] }
|
22
22
|
end
|
23
23
|
pills += RELATED_ITEMS["by name"]
|
@@ -29,6 +29,6 @@ format :html do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def related_by_type_items
|
32
|
-
[["#{card.type} cards", [card.type, :type, :by_name], mark: :absolute]]
|
32
|
+
[["#{card.type} cards", [card.type, :type, :by_name], { mark: :absolute }]]
|
33
33
|
end
|
34
34
|
end
|
@@ -34,15 +34,13 @@ format :html do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def show_discussion?
|
37
|
-
d_card = discussion_card
|
38
|
-
return unless d_card
|
37
|
+
return unless (d_card = discussion_card)
|
39
38
|
|
40
|
-
|
41
|
-
d_card.ok? permission_task
|
39
|
+
d_card.ok? discussion_permission_task(d_card)
|
42
40
|
end
|
43
41
|
|
44
42
|
def discussion_card?
|
45
|
-
card.
|
43
|
+
card.compound? && card.name.tag_name.key == :discussion.cardname.key
|
46
44
|
end
|
47
45
|
|
48
46
|
def discussion_card
|
@@ -50,4 +48,11 @@ format :html do
|
|
50
48
|
|
51
49
|
card.fetch :discussion, skip_modules: true, new: {}
|
52
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def discussion_permission_task d_card=nil
|
55
|
+
d_card ||= discussion_card
|
56
|
+
d_card.new_card? ? :update : :read
|
57
|
+
end
|
53
58
|
end
|
data/set/all/edit_name.rb
CHANGED
@@ -1,58 +1,56 @@
|
|
1
1
|
format :html do
|
2
|
-
# note: depends on js with selector ".edit_name-view .card-form"
|
3
2
|
view :edit_name, perms: :update do
|
4
3
|
frame { name_form }
|
5
4
|
end
|
6
5
|
|
7
|
-
# note: depends on js with selector ".name_form-view .card-form"
|
8
6
|
view :name_form, perms: :update, wrap: :slot, cache: :never do
|
9
7
|
name_form :edit_name_row
|
10
8
|
end
|
11
9
|
|
12
10
|
def name_form success_view=nil
|
13
11
|
card_form({ action: :update, id: card.id },
|
14
|
-
|
12
|
+
"data-main-success": JSON(redirect: true, view: ""),
|
15
13
|
"data-update-origin": "true",
|
14
|
+
class: "_rename-form",
|
16
15
|
success: edit_name_success(success_view)) do
|
17
|
-
[
|
16
|
+
[edit_name_hidden_fields,
|
18
17
|
_render_name_formgroup,
|
19
|
-
|
18
|
+
edit_name_confirmation,
|
20
19
|
edit_name_buttons]
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
24
23
|
def edit_name_success view=nil
|
25
|
-
success = {
|
24
|
+
success = { name: "_self", redirect: "" }
|
26
25
|
success[:view] = view if view
|
27
26
|
success
|
28
27
|
end
|
29
28
|
|
30
|
-
def
|
29
|
+
def edit_name_hidden_fields
|
31
30
|
hidden_tags old_name: card.name, card: { update_referers: false }
|
32
31
|
end
|
33
32
|
|
34
33
|
def edit_name_buttons
|
34
|
+
class_up "button-form-group", "rename-button-form-group"
|
35
35
|
button_formgroup do
|
36
36
|
[rename_and_update_button, rename_button, standard_cancel_button]
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
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"
|
48
50
|
end
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
msg << %(<h6>This may change names referred to by other cards.</h6>)
|
54
|
-
msg << %(<p>You may choose to <em>update or ignore</em> the referers.</p>)
|
55
|
-
msg << hidden_field_tag(:referers, 1)
|
56
|
-
alert("warning", false, false, class: "hidden-alert") { msg }
|
52
|
+
def rename_button
|
53
|
+
button_tag t(:core_rename),
|
54
|
+
class: "renamer", data: { disable_with: t(:core_renaming) }
|
57
55
|
end
|
58
56
|
end
|
data/set/all/edit_type.rb
CHANGED
@@ -42,60 +42,79 @@ format :html do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def type_field args={}
|
46
|
+
@no_current_type = args.delete :no_current_type # just a test artifact?
|
47
|
+
action_view.select_tag "card[type]", type_field_options,
|
48
|
+
args.merge("data-select2-id": "#{unique_id}-#{Time.now.to_i}")
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def raw_type_options
|
54
|
+
return @raw_type_options if @raw_type_options
|
55
|
+
|
56
|
+
options = Auth.createable_types
|
57
|
+
if !@no_current_type && card.real? && !options.include?(card.type_name)
|
58
|
+
# current type should be an option on existing cards,
|
59
|
+
# regardless of create perms
|
60
|
+
options.push(card.type_name).sort!
|
61
|
+
end
|
62
|
+
@raw_type_options = ::Set.new options
|
63
|
+
end
|
64
|
+
|
45
65
|
def wrap_type_formgroup
|
46
66
|
formgroup "Type", input: "type", class: "type-formgroup", help: false do
|
47
67
|
output [yield, hidden_field_tag(:assign, true)]
|
48
68
|
end
|
49
69
|
end
|
50
70
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
71
|
+
def type_field_options
|
72
|
+
if grouped_types.size == 1
|
73
|
+
simple_type_field_options
|
74
|
+
else
|
75
|
+
multi_type_field_options
|
76
|
+
end
|
56
77
|
end
|
57
78
|
|
58
|
-
def
|
59
|
-
|
79
|
+
def simple_type_field_options
|
80
|
+
options_for_select grouped_types.flatten[1], current_type_value
|
81
|
+
end
|
60
82
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
83
|
+
def multi_type_field_options
|
84
|
+
grouped_options_for_select grouped_types, current_type_value
|
85
|
+
end
|
86
|
+
|
87
|
+
def current_type_value
|
88
|
+
return if @no_current_type
|
89
|
+
|
90
|
+
@current_type_value ||= card.type_name_or_default
|
66
91
|
end
|
67
92
|
|
68
|
-
def grouped_types
|
93
|
+
def grouped_types
|
69
94
|
groups = Hash.new { |h, k| h[k] = [] }
|
70
|
-
allowed = ::Set.new Auth.createable_types
|
71
|
-
allowed << current_type if current_type
|
72
95
|
|
73
|
-
visible_cardtype_groups.each_pair do |name, items|
|
96
|
+
visible_cardtype_groups.each_pair.with_object(groups) do |(name, items), grps|
|
74
97
|
if name == "Custom"
|
75
|
-
|
76
|
-
groups["Custom"] << type unless ::Card::Set::Self::Cardtype::GROUP_MAP[type]
|
77
|
-
end
|
98
|
+
custom_grouped_types grps
|
78
99
|
else
|
79
|
-
|
80
|
-
groups[name] << i if allowed.include?(i)
|
81
|
-
end
|
100
|
+
standard_grouped_types grps, name, items
|
82
101
|
end
|
83
102
|
end
|
84
|
-
groups
|
85
103
|
end
|
86
104
|
|
87
|
-
def
|
88
|
-
|
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
|
89
109
|
end
|
90
110
|
|
91
|
-
def
|
92
|
-
|
93
|
-
|
94
|
-
if !card.new_card? && !typelist.include?(card.type_name)
|
95
|
-
# current type should be an option on existing cards,
|
96
|
-
# regardless of create perms
|
97
|
-
typelist.push(card.type_name).sort!
|
111
|
+
def standard_grouped_types groups, name, items
|
112
|
+
items.each do |i|
|
113
|
+
groups[name] << i if raw_type_options.include?(i)
|
98
114
|
end
|
99
|
-
|
115
|
+
end
|
116
|
+
|
117
|
+
def visible_cardtype_groups
|
118
|
+
::Card::Set::Self::Cardtype::GROUP
|
100
119
|
end
|
101
120
|
end
|
data/set/all/editor.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
Self::InputOptions.add_to_basket :options, "text area"
|
3
2
|
Self::InputOptions.add_to_basket :options, "text field"
|
4
3
|
|
@@ -24,9 +23,8 @@ format :html do
|
|
24
23
|
|
25
24
|
# move somewhere more accessible?
|
26
25
|
def with_card mark
|
27
|
-
|
28
|
-
|
29
|
-
yield card
|
26
|
+
card = Card[mark]
|
27
|
+
yield card if card
|
30
28
|
rescue Card::Error::CodenameNotFound
|
31
29
|
nil
|
32
30
|
end
|
@@ -47,7 +45,7 @@ format :html do
|
|
47
45
|
|
48
46
|
def text_area_input
|
49
47
|
text_area :content, rows: 5, class: "d0-card-content",
|
50
|
-
"data-card-type-code"
|
48
|
+
"data-card-type-code": card.type_code
|
51
49
|
end
|
52
50
|
|
53
51
|
def text_field_input
|
data/set/all/form.rb
CHANGED
@@ -30,15 +30,13 @@ format :html do
|
|
30
30
|
hidden_field :last_action_id_before_edit, class: "current_revision_id"
|
31
31
|
end
|
32
32
|
|
33
|
-
def wrap_content_formgroup
|
33
|
+
def wrap_content_formgroup &block
|
34
34
|
formgroup("Content", input: :content, help: false,
|
35
|
-
class: classy("card-editor"))
|
35
|
+
class: classy("card-editor"), &block)
|
36
36
|
end
|
37
37
|
|
38
|
-
def button_formgroup
|
39
|
-
wrap_with :div, class:
|
40
|
-
wrap_with :div, yield
|
41
|
-
end
|
38
|
+
def button_formgroup &block
|
39
|
+
wrap_with :div, class: "form-group #{classy 'button-form-group'}", &block
|
42
40
|
end
|
43
41
|
|
44
42
|
def name_field
|
@@ -214,9 +212,16 @@ format :html do
|
|
214
212
|
add_class opts, "card-form"
|
215
213
|
add_class opts, "slotter" unless opts[:redirect] || opts[:no_slotter]
|
216
214
|
add_class opts, "autosave" if action == :update
|
215
|
+
interpret_main_success_opts opts
|
217
216
|
opts
|
218
217
|
end
|
219
218
|
|
219
|
+
def interpret_main_success_opts opts
|
220
|
+
return unless (hash = opts.delete :main_success)
|
221
|
+
|
222
|
+
opts["data-main-success"] = JSON hash
|
223
|
+
end
|
224
|
+
|
220
225
|
def card_form_url_and_action action
|
221
226
|
case action
|
222
227
|
when Symbol then [path(action: action), action]
|
@@ -227,18 +232,16 @@ format :html do
|
|
227
232
|
end
|
228
233
|
end
|
229
234
|
|
230
|
-
def editor_wrap type=nil
|
235
|
+
def editor_wrap type=nil, &block
|
231
236
|
html_class = "editor"
|
232
237
|
html_class << " #{type}-editor" if type
|
233
|
-
wrap_with :div, class: html_class
|
234
|
-
yield
|
235
|
-
end
|
238
|
+
wrap_with :div, class: html_class, &block
|
236
239
|
end
|
237
240
|
|
238
241
|
# FIELD VIEWS
|
239
242
|
|
240
243
|
def add_junction_class
|
241
|
-
return unless card.name.
|
244
|
+
return unless card.name.compound?
|
242
245
|
|
243
246
|
class_up "card-editor", "RIGHT-#{card.name.tag_name.safe_key}"
|
244
247
|
end
|
data/set/all/form_buttons.rb
CHANGED
@@ -5,6 +5,7 @@ format :html do
|
|
5
5
|
|
6
6
|
def standard_save_button opts={}
|
7
7
|
return if voo&.hide?(:save_button)
|
8
|
+
|
8
9
|
add_class opts, "submit-button btn-sm mr-3 _update-history-pills"
|
9
10
|
opts[:text] ||= "Save"
|
10
11
|
opts["data-cy"] = "save"
|
@@ -42,6 +43,8 @@ format :html do
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def delete_button opts={}
|
46
|
+
return unless card.real?
|
47
|
+
|
45
48
|
link_to "Delete", delete_button_opts(opts)
|
46
49
|
end
|
47
50
|
|
@@ -49,7 +52,7 @@ format :html do
|
|
49
52
|
add_class opts, "slotter btn btn-outline-danger ml-auto btn-sm"
|
50
53
|
opts["data-confirm"] = delete_confirm opts
|
51
54
|
opts[:path] = { action: :delete }
|
52
|
-
opts[:path][:success] = delete_success(opts)
|
55
|
+
opts[:path][:success] = delete_success(opts)
|
53
56
|
opts[:remote] = true
|
54
57
|
opts
|
55
58
|
end
|
@@ -59,6 +62,12 @@ format :html do
|
|
59
62
|
end
|
60
63
|
|
61
64
|
def delete_success opts
|
62
|
-
opts
|
65
|
+
if opts[:success]
|
66
|
+
opts.delete :success
|
67
|
+
elsif main?
|
68
|
+
{ redirect: true, mark: "*previous" }
|
69
|
+
else
|
70
|
+
{ view: :just_deleted }
|
71
|
+
end
|
63
72
|
end
|
64
73
|
end
|
data/set/all/form_elements.rb
CHANGED
@@ -52,6 +52,7 @@ format :html do
|
|
52
52
|
# redirect to *previous if no :href is given
|
53
53
|
def cancel_button args={}
|
54
54
|
return unless voo.show? :cancel_button
|
55
|
+
|
55
56
|
text = args.delete(:text) || "Cancel"
|
56
57
|
add_class args, "btn btn-#{args.delete(:situation) || 'secondary'}"
|
57
58
|
add_class args, cancel_strategy(args[:redirect], args[:href])
|
data/set/all/new.rb
CHANGED
@@ -75,7 +75,7 @@ format :html do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def new_form_opts
|
78
|
-
{ "main-success"
|
78
|
+
{ "data-main-success": JSON(redirect: true) }
|
79
79
|
end
|
80
80
|
|
81
81
|
def new_view_title
|
@@ -90,7 +90,7 @@ format :html do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def new_success
|
93
|
-
card.rule(:thanks) || "_self"
|
93
|
+
{ mark: (card.rule(:thanks) || "_self") }
|
94
94
|
end
|
95
95
|
|
96
96
|
def new_in_modal_success; end
|
data/set/all/template_nest.rb
CHANGED
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.11.
|
4
|
+
version: 0.11.5
|
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: 2021-05-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.101.
|
21
|
+
version: 1.101.5
|
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.101.
|
28
|
+
version: 1.101.5
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- set/all/edit_content.rb
|
44
44
|
- set/all/edit_inline.rb
|
45
45
|
- set/all/edit_name.rb
|
46
|
+
- set/all/edit_name_confirmation.haml
|
46
47
|
- set/all/edit_type.rb
|
47
48
|
- set/all/editing.rb
|
48
49
|
- set/all/editor.rb
|
@@ -59,10 +60,15 @@ files:
|
|
59
60
|
- set/type/list.rb
|
60
61
|
- set/type/plain_text.rb
|
61
62
|
- set/type/pointer.rb
|
62
|
-
homepage:
|
63
|
+
homepage: https://decko.org
|
63
64
|
licenses:
|
64
65
|
- GPL-3.0
|
65
66
|
metadata:
|
67
|
+
source_code_uri: https://github.com/decko-commons/decko
|
68
|
+
homepage_uri: https://decko.org
|
69
|
+
bug_tracker_uri: https://github.com/decko-commons/decko/issues
|
70
|
+
wiki_uri: https://decko.org
|
71
|
+
documentation_url: http://docs.decko.org/
|
66
72
|
card-mod: edit
|
67
73
|
post_install_message:
|
68
74
|
rdoc_options: []
|
@@ -79,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
85
|
- !ruby/object:Gem::Version
|
80
86
|
version: '0'
|
81
87
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
88
|
+
rubygems_version: 3.1.4
|
83
89
|
signing_key:
|
84
90
|
specification_version: 4
|
85
91
|
summary: Edit handling
|