card-mod-list 0.17.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/set/abstract/01_list/events.rb +4 -5
- data/set/abstract/01_list/html_views.rb +8 -5
- data/set/abstract/01_list.rb +9 -0
- data/set/abstract/id_list.rb +16 -5
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65989034e21afc9e3769f389cfc2f3ba3f81209637629121523eab9da32b073f
|
4
|
+
data.tar.gz: 2357bda45c2aa1d05dc0aca4470d4b6b0044c25ab5dfb4e373ac50ad9c034bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6437a78a681212055884a92629becc1c8169599738f4a620ec89b5e203d594ce45e95629767db25eade3de0b5f8f65783ed8ffbfa25077170c7665abffb6d719
|
7
|
+
data.tar.gz: 4f183a50fb4e9bb9fd75afa0fac50d5e13f619ae80925e2b9efb6db728bbb62555a595b9a98a35212fb3cbf26730bdf1a72b9f96c2bec0bb6695248467a2cc81
|
@@ -22,17 +22,16 @@ event :validate_item_type, :validate, on: :save, when: :validate_item_type? do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
# At present this may never generate an error, because the uniqueness is enforced
|
26
|
+
# by `#standardize_items`. It's possible we may want to separate the policy about
|
27
|
+
# whether duplicates are allowed and the policy about whether we autocorrect vs.
|
28
|
+
# raise an error?
|
25
29
|
event :validate_item_uniqueness, :validate, on: :save, when: :unique_items? do
|
26
30
|
return unless (dupes = duplicate_item_names)&.present?
|
27
31
|
|
28
32
|
errors.add :content, t(:list_duplicate_items_names, duplicates: dupes.to_sentence)
|
29
33
|
end
|
30
34
|
|
31
|
-
# for override
|
32
|
-
def unique_items?
|
33
|
-
false
|
34
|
-
end
|
35
|
-
|
36
35
|
def ok_item_types
|
37
36
|
nil
|
38
37
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
format :html do
|
2
|
-
view :core
|
2
|
+
view :core do
|
3
3
|
standard_pointer_core
|
4
4
|
end
|
5
5
|
|
@@ -70,10 +70,8 @@ format :html do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def select_input
|
73
|
-
|
74
|
-
|
75
|
-
options_for_select(options, card.first_name),
|
76
|
-
class: "pointer-select form-control")
|
73
|
+
select_tag "pointer_select-#{unique_id}", select_input_options,
|
74
|
+
class: "pointer-select form-control"
|
77
75
|
end
|
78
76
|
|
79
77
|
def bar_select_input
|
@@ -108,6 +106,11 @@ format :html do
|
|
108
106
|
|
109
107
|
private
|
110
108
|
|
109
|
+
def select_input_options
|
110
|
+
options = { "-- Select --" => "" }.merge card.options_hash
|
111
|
+
options_for_select options, card.first_name
|
112
|
+
end
|
113
|
+
|
111
114
|
# currently only used by :list and :autocomplete. could be generalized?
|
112
115
|
def items_for_input items=nil
|
113
116
|
items ||= card.item_names context: :raw
|
data/set/abstract/01_list.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
include_set Abstract::Paging
|
2
2
|
include_set Abstract::Items
|
3
3
|
|
4
|
+
# for override
|
5
|
+
# if false, item names that match cardnames will
|
6
|
+
# NOT be treated like references to those cards
|
7
|
+
def item_references?
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
4
11
|
def diff_args
|
5
12
|
{ diff_format: :pointer }
|
6
13
|
end
|
@@ -44,5 +51,7 @@ def chunk_class
|
|
44
51
|
end
|
45
52
|
|
46
53
|
def each_reference_out
|
54
|
+
return unless item_references?
|
55
|
+
|
47
56
|
item_names.each { |name| yield name, chunk_class::CODE }
|
48
57
|
end
|
data/set/abstract/id_list.rb
CHANGED
@@ -10,10 +10,12 @@ def standardize_item cardish
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def item_ids args={}
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
seeding_ids do
|
14
|
+
item_strings(args).map do |item|
|
15
|
+
item = standardize_item item unless item.match?(/^~/)
|
16
|
+
item&.to_s&.tr("~", "")&.to_i
|
17
|
+
end.compact
|
18
|
+
end
|
17
19
|
end
|
18
20
|
|
19
21
|
def item_names args={}
|
@@ -34,5 +36,14 @@ def create_references_out
|
|
34
36
|
referee_ids = item_ids
|
35
37
|
return if referee_ids.empty?
|
36
38
|
|
37
|
-
|
39
|
+
values = referee_ids.each_with_object([]) do |rid, vals|
|
40
|
+
vals << {
|
41
|
+
referer_id: id,
|
42
|
+
referee_id: rid,
|
43
|
+
referee_key: nil,
|
44
|
+
ref_type: "L"
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
Reference.insert_in_slices values
|
38
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.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: 2024-
|
13
|
+
date: 2024-11-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,42 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.108.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.108.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-format
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.18.1
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.18.1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: card-mod-collection
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.18.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.18.1
|
57
57
|
description: ''
|
58
58
|
email:
|
59
59
|
- info@decko.org
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- set/type/pointer.rb
|
103
103
|
homepage: https://decko.org
|
104
104
|
licenses:
|
105
|
-
- GPL-3.0
|
105
|
+
- GPL-3.0-or-later
|
106
106
|
metadata:
|
107
107
|
source_code_uri: https://github.com/decko-commons/decko
|
108
108
|
homepage_uri: https://decko.org
|