card-mod-edit 0.11.0 → 0.11.1
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/tab_visibility.rb +9 -4
- data/set/all/edit_type.rb +51 -33
- data/set/all/editor.rb +2 -3
- data/set/all/form_buttons.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 060450e130a1d097fe4898887562bbf3f63ffc586724461b085a0265fdc01789
|
4
|
+
data.tar.gz: 4ad0b9deff35af5955453f20422f9aa23a3fcf05f77e7f10ac2ecad83906d63c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357b106327c36d6dd1ddd47421b3cbfe1ce55aaef42d3ee006ba3106ec19c2218a67f791dbf64db8d356db38e82ac697e95fd1be254283420ba914ea1f6211cd
|
7
|
+
data.tar.gz: 4773e3bd9b7430bf8a83d8423eec6cb02fd448aeba7591d4b05227d4b4f3bdd111006aab200657dbe005a3f628ab3e5cca5f3b0de6658f9610a2b6bdec5fcea2
|
@@ -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_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
|
76
|
+
end
|
77
|
+
|
78
|
+
def simple_type_field_options
|
79
|
+
options_for_select grouped_types.flatten[1], current_type_value
|
56
80
|
end
|
57
81
|
|
58
|
-
def
|
59
|
-
|
82
|
+
def multi_type_field_options
|
83
|
+
grouped_options_for_select grouped_types, current_type_value
|
84
|
+
end
|
60
85
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
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_buttons.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.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: 2021-03-02 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.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.101.
|
28
|
+
version: 1.101.1
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|