card-mod-edit 0.1 → 0.11.4
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 +7 -7
- data/set/all/bridge/tab_visibility.rb +10 -5
- data/set/all/edit_name.rb +2 -2
- data/set/all/edit_type.rb +51 -33
- data/set/all/editor.rb +2 -3
- data/set/all/form.rb +7 -0
- data/set/all/form_buttons.rb +10 -2
- data/set/all/new.rb +4 -6
- data/set/right/input_type.rb +35 -0
- data/set/self/input_type.rb +12 -0
- metadata +28 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4585a2392445ad135ba9d2ca3d5281ac157e60c985a13065ab40fe616833dd1
|
|
4
|
+
data.tar.gz: 411c89a8efe8b6340e712265a7b57b2b4a32d97cb4a3ce767a06f647baa74891
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b593eeb1dcd1c28e11154cf4a2d97708901d5fdaf087441e641767070c74061b9d39bc89368b5f37f82c9f0070070a33d88076ce2fb29d096a4998244769735
|
|
7
|
+
data.tar.gz: ae37bbd8b63506434029f7acb2627070912a0bf2211ecc0e63140ff2941c8801516dcdc7c6a300ce6d1e9167b6f10b5d01d7f51daf2f580a64cde0269b3b6e51
|
data/set/all/bridge.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"Rules" => :rules_tab }.freeze
|
|
1
|
+
BRIDGE_TABS = { "Account" => :account_tab,
|
|
2
|
+
"Guide" => :guide_tab,
|
|
3
|
+
"Engage" => :engage_tab,
|
|
4
|
+
"History" => :history_tab,
|
|
5
|
+
"Related" => :related_tab,
|
|
6
|
+
"Rules" => :rules_tab }.freeze
|
|
8
7
|
|
|
8
|
+
format :html do
|
|
9
9
|
wrapper :bridge do
|
|
10
10
|
class_up "modal-dialog", "no-gaps"
|
|
11
11
|
voo.hide! :modal_footer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
format :html do
|
|
2
2
|
def visible_bridge_tabs
|
|
3
|
-
BRIDGE_TABS.select do |_title, view|
|
|
3
|
+
Bridge::BRIDGE_TABS.select do |_title, view|
|
|
4
4
|
send "show_#{view}?"
|
|
5
5
|
end
|
|
6
6
|
end
|
|
@@ -34,11 +34,9 @@ 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?
|
|
@@ -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
|
@@ -11,7 +11,7 @@ format :html do
|
|
|
11
11
|
|
|
12
12
|
def name_form success_view=nil
|
|
13
13
|
card_form({ action: :update, id: card.id },
|
|
14
|
-
|
|
14
|
+
"data-main-success": JSON(redirect: true, view: ""),
|
|
15
15
|
"data-update-origin": "true",
|
|
16
16
|
success: edit_name_success(success_view)) do
|
|
17
17
|
[hidden_edit_name_fields,
|
|
@@ -22,7 +22,7 @@ format :html do
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def edit_name_success view=nil
|
|
25
|
-
success = {
|
|
25
|
+
success = { name: "_self", redirect: "" }
|
|
26
26
|
success[:view] = view if view
|
|
27
27
|
success
|
|
28
28
|
end
|
data/set/all/edit_type.rb
CHANGED
|
@@ -42,60 +42,78 @@ 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
|
+
options = Auth.createable_types
|
|
56
|
+
if !@no_current_type && card.real? && !options.include?(card.type_name)
|
|
57
|
+
# current type should be an option on existing cards,
|
|
58
|
+
# regardless of create perms
|
|
59
|
+
options.push(card.type_name).sort!
|
|
60
|
+
end
|
|
61
|
+
@raw_type_options = ::Set.new options
|
|
62
|
+
end
|
|
63
|
+
|
|
45
64
|
def wrap_type_formgroup
|
|
46
65
|
formgroup "Type", input: "type", class: "type-formgroup", help: false do
|
|
47
66
|
output [yield, hidden_field_tag(:assign, true)]
|
|
48
67
|
end
|
|
49
68
|
end
|
|
50
69
|
|
|
51
|
-
def
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
def type_field_options
|
|
71
|
+
if grouped_types.size == 1
|
|
72
|
+
simple_type_field_options
|
|
73
|
+
else
|
|
74
|
+
multi_type_field_options
|
|
75
|
+
end
|
|
56
76
|
end
|
|
57
77
|
|
|
58
|
-
def
|
|
59
|
-
|
|
78
|
+
def simple_type_field_options
|
|
79
|
+
options_for_select grouped_types.flatten[1], current_type_value
|
|
80
|
+
end
|
|
60
81
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
def multi_type_field_options
|
|
83
|
+
grouped_options_for_select grouped_types, current_type_value
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def current_type_value
|
|
87
|
+
return if @no_current_type
|
|
88
|
+
|
|
89
|
+
@current_type_value ||= card.type_name_or_default
|
|
66
90
|
end
|
|
67
91
|
|
|
68
|
-
def grouped_types
|
|
92
|
+
def grouped_types
|
|
69
93
|
groups = Hash.new { |h, k| h[k] = [] }
|
|
70
|
-
allowed = ::Set.new Auth.createable_types
|
|
71
|
-
allowed << current_type if current_type
|
|
72
94
|
|
|
73
|
-
visible_cardtype_groups.each_pair do |name, items|
|
|
95
|
+
visible_cardtype_groups.each_pair.with_object(groups) do |(name, items), grps|
|
|
74
96
|
if name == "Custom"
|
|
75
|
-
|
|
76
|
-
groups["Custom"] << type unless ::Card::Set::Self::Cardtype::GROUP_MAP[type]
|
|
77
|
-
end
|
|
97
|
+
custom_grouped_types grps
|
|
78
98
|
else
|
|
79
|
-
|
|
80
|
-
groups[name] << i if allowed.include?(i)
|
|
81
|
-
end
|
|
99
|
+
standard_grouped_types grps, name, items
|
|
82
100
|
end
|
|
83
101
|
end
|
|
84
|
-
groups
|
|
85
102
|
end
|
|
86
103
|
|
|
87
|
-
def
|
|
88
|
-
|
|
104
|
+
def custom_grouped_types groups
|
|
105
|
+
Auth.createable_types.each do |type|
|
|
106
|
+
groups["Custom"] << type unless ::Card::Set::Self::Cardtype::GROUP_MAP[type]
|
|
107
|
+
end
|
|
89
108
|
end
|
|
90
109
|
|
|
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!
|
|
110
|
+
def standard_grouped_types groups, name, items
|
|
111
|
+
items.each do |i|
|
|
112
|
+
groups[name] << i if raw_type_options.include?(i)
|
|
98
113
|
end
|
|
99
|
-
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def visible_cardtype_groups
|
|
117
|
+
::Card::Set::Self::Cardtype::GROUP
|
|
100
118
|
end
|
|
101
119
|
end
|
data/set/all/editor.rb
CHANGED
data/set/all/form.rb
CHANGED
|
@@ -214,9 +214,16 @@ format :html do
|
|
|
214
214
|
add_class opts, "card-form"
|
|
215
215
|
add_class opts, "slotter" unless opts[:redirect] || opts[:no_slotter]
|
|
216
216
|
add_class opts, "autosave" if action == :update
|
|
217
|
+
interpret_main_success_opts opts
|
|
217
218
|
opts
|
|
218
219
|
end
|
|
219
220
|
|
|
221
|
+
def interpret_main_success_opts opts
|
|
222
|
+
return unless (hash = opts.delete :main_success)
|
|
223
|
+
|
|
224
|
+
opts["data-main-success"] = JSON hash
|
|
225
|
+
end
|
|
226
|
+
|
|
220
227
|
def card_form_url_and_action action
|
|
221
228
|
case action
|
|
222
229
|
when Symbol then [path(action: action), action]
|
data/set/all/form_buttons.rb
CHANGED
|
@@ -42,6 +42,8 @@ format :html do
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def delete_button opts={}
|
|
45
|
+
return unless card.real?
|
|
46
|
+
|
|
45
47
|
link_to "Delete", delete_button_opts(opts)
|
|
46
48
|
end
|
|
47
49
|
|
|
@@ -49,7 +51,7 @@ format :html do
|
|
|
49
51
|
add_class opts, "slotter btn btn-outline-danger ml-auto btn-sm"
|
|
50
52
|
opts["data-confirm"] = delete_confirm opts
|
|
51
53
|
opts[:path] = { action: :delete }
|
|
52
|
-
opts[:path][:success] = delete_success(opts)
|
|
54
|
+
opts[:path][:success] = delete_success(opts)
|
|
53
55
|
opts[:remote] = true
|
|
54
56
|
opts
|
|
55
57
|
end
|
|
@@ -59,6 +61,12 @@ format :html do
|
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
def delete_success opts
|
|
62
|
-
opts
|
|
64
|
+
if opts[:success]
|
|
65
|
+
opts.delete :success
|
|
66
|
+
elsif main?
|
|
67
|
+
{ redirect: true, mark: "*previous" }
|
|
68
|
+
else
|
|
69
|
+
{ view: :just_deleted }
|
|
70
|
+
end
|
|
63
71
|
end
|
|
64
72
|
end
|
data/set/all/new.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
format :html do
|
|
2
|
+
delegate :autoname?, to: :card
|
|
3
|
+
|
|
2
4
|
view :new, perms: :create, unknown: true, cache: :never do
|
|
3
5
|
new_view_frame_and_form new_form_opts
|
|
4
6
|
end
|
|
@@ -73,7 +75,7 @@ format :html do
|
|
|
73
75
|
end
|
|
74
76
|
|
|
75
77
|
def new_form_opts
|
|
76
|
-
{ "main-success"
|
|
78
|
+
{ "data-main-success": JSON(redirect: true) }
|
|
77
79
|
end
|
|
78
80
|
|
|
79
81
|
def new_view_title
|
|
@@ -88,7 +90,7 @@ format :html do
|
|
|
88
90
|
end
|
|
89
91
|
|
|
90
92
|
def new_success
|
|
91
|
-
card.rule(:thanks) || "_self"
|
|
93
|
+
{ mark: (card.rule(:thanks) || "_self") }
|
|
92
94
|
end
|
|
93
95
|
|
|
94
96
|
def new_in_modal_success; end
|
|
@@ -114,10 +116,6 @@ format :html do
|
|
|
114
116
|
end
|
|
115
117
|
end
|
|
116
118
|
|
|
117
|
-
def autoname?
|
|
118
|
-
@autoname.nil? ? (@autoname = card.rule_card :autoname).present? : @autoname
|
|
119
|
-
end
|
|
120
|
-
|
|
121
119
|
def needs_name?
|
|
122
120
|
card.name.blank? && !autoname?
|
|
123
121
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
format :html do
|
|
2
|
+
def quick_editor
|
|
3
|
+
@submit_on_change = true
|
|
4
|
+
super
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def quick_form_opts
|
|
8
|
+
super.merge "data-update-foreign-slot":
|
|
9
|
+
".card-slot.quick_edit-view.RIGHT-Xcontent_option_view"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def default_input_type
|
|
13
|
+
:radio
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def raw_help_text
|
|
17
|
+
"edit interface for list cards"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# def option_label_text option_name
|
|
21
|
+
# super.downcase
|
|
22
|
+
# end
|
|
23
|
+
|
|
24
|
+
def quick_edit
|
|
25
|
+
card.left.prototype_default_card.try(:show_input_type?) ? super : ""
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def option_names
|
|
30
|
+
left.prototype_default_card&.try(:input_type_content_options) || super
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def supports_content_option_view?
|
|
34
|
+
item_name.in? ["checkbox", "radio", "filtered list"]
|
|
35
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
setting_opts group: :editing,
|
|
2
|
+
position: 3,
|
|
3
|
+
rule_type_editable: false,
|
|
4
|
+
short_help_text: "edit interface"
|
|
5
|
+
|
|
6
|
+
format :html do
|
|
7
|
+
def raw_help_text
|
|
8
|
+
"Configure [[https://ace.c9.io/|ace]], "\
|
|
9
|
+
"Decko's default code editor, using these available "\
|
|
10
|
+
"[[https://github.com/ajaxorg/ace/wiki/Configuring-Ace|options]]."
|
|
11
|
+
end
|
|
12
|
+
end
|
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:
|
|
4
|
+
version: 0.11.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ethan McCutchen
|
|
@@ -10,8 +10,22 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
14
|
-
dependencies:
|
|
13
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: card
|
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
requirements:
|
|
19
|
+
- - '='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 1.101.4
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - '='
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: 1.101.4
|
|
15
29
|
description: ''
|
|
16
30
|
email:
|
|
17
31
|
- info@decko.org
|
|
@@ -40,14 +54,20 @@ files:
|
|
|
40
54
|
- set/all/overlay_guide.haml
|
|
41
55
|
- set/all/overlay_guide.rb
|
|
42
56
|
- set/all/template_nest.rb
|
|
57
|
+
- set/right/input_type.rb
|
|
58
|
+
- set/self/input_type.rb
|
|
43
59
|
- set/type/list.rb
|
|
44
60
|
- set/type/plain_text.rb
|
|
45
61
|
- set/type/pointer.rb
|
|
46
|
-
homepage:
|
|
62
|
+
homepage: https://decko.org
|
|
47
63
|
licenses:
|
|
48
|
-
- GPL-2.0
|
|
49
64
|
- GPL-3.0
|
|
50
65
|
metadata:
|
|
66
|
+
source_code_uri: https://github.com/decko-commons/decko
|
|
67
|
+
homepage_uri: https://decko.org
|
|
68
|
+
bug_tracker_uri: https://github.com/decko-commons/decko/issues
|
|
69
|
+
wiki_uri: https://decko.org
|
|
70
|
+
documentation_url: http://docs.decko.org/
|
|
51
71
|
card-mod: edit
|
|
52
72
|
post_install_message:
|
|
53
73
|
rdoc_options: []
|
|
@@ -57,15 +77,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
57
77
|
requirements:
|
|
58
78
|
- - ">="
|
|
59
79
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.
|
|
80
|
+
version: '2.5'
|
|
61
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
82
|
requirements:
|
|
63
83
|
- - ">="
|
|
64
84
|
- !ruby/object:Gem::Version
|
|
65
85
|
version: '0'
|
|
66
86
|
requirements: []
|
|
67
|
-
rubygems_version: 3.
|
|
87
|
+
rubygems_version: 3.1.4
|
|
68
88
|
signing_key:
|
|
69
89
|
specification_version: 4
|
|
70
|
-
summary:
|
|
90
|
+
summary: Edit handling
|
|
71
91
|
test_files: []
|