card-mod-history 0.11.3 → 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/lib/card/action.rb +1 -1
- data/set/all/history/actions.rb +8 -5
- data/set/all/history/events.rb +1 -1
- data/set/all/history_bridge.rb +30 -17
- 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: 41d0178f2fba9cab5cbdd1292ec4c4599850a29edbc1070bffb0376940cf73d4
|
4
|
+
data.tar.gz: c80f042afcd381951625363007624bacb5667ea529387566ed6dd55c434ffd46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb75bb9ce90265eadc285d2da4e8537ae8abee8d61cf08297cb62e65c00fecba385c7eb063e1149c734668068d8c0f8f38eaa112927638b27a7f5433fb01ee23
|
7
|
+
data.tar.gz: 80b069164b605b311639905435a654ec54fd6034bc28ef88716e6586d4fdaf5e5d9700a11678f2bc2cebeaa2612cd1f0938203408eb037af570cc3cbb0a1cefa
|
data/lib/card/action.rb
CHANGED
data/set/all/history/actions.rb
CHANGED
@@ -6,13 +6,16 @@ end
|
|
6
6
|
|
7
7
|
def action_from_id action_id
|
8
8
|
return unless action_id.is_a?(Integer) || action_id =~ /^\d+$/
|
9
|
-
|
10
|
-
# if not an integer revision id is probably a mod (e.g. if you request
|
9
|
+
# if not an integer, action_id is probably a mod (e.g. if you request
|
11
10
|
# files/:logo/standard.png)
|
12
|
-
action = Action.fetch action_id
|
13
|
-
return unless action.card_id == id
|
14
11
|
|
15
|
-
|
12
|
+
action_if_on_self Action.fetch(action_id)
|
13
|
+
end
|
14
|
+
|
15
|
+
def action_if_on_self action
|
16
|
+
return unless action.is_a? Action
|
17
|
+
|
18
|
+
action if action.card_id == id
|
16
19
|
end
|
17
20
|
|
18
21
|
def old_actions
|
data/set/all/history/events.rb
CHANGED
data/set/all/history_bridge.rb
CHANGED
@@ -7,25 +7,11 @@ format :html do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
view :updated_by, wrap: { div: { class: "text-muted" } } do
|
10
|
-
|
11
|
-
updaters = Card.search(updater_of: { id: card.id })
|
10
|
+
updaters = Card.search(updater_of: { id: card.id }) if card.id
|
12
11
|
return "" unless updaters.present?
|
13
12
|
|
14
|
-
|
15
|
-
"Updated by #{
|
16
|
-
end
|
17
|
-
|
18
|
-
def updater_links updaters, item_view: :link, max_count: 3, others_target: card
|
19
|
-
return "" unless updaters.present?
|
20
|
-
|
21
|
-
total = updaters.size
|
22
|
-
fetch_count = total > max_count ? max_count - 1 : max_count
|
23
|
-
|
24
|
-
reduced = first_card(fetch_count).map { |c| nest c, view: item_view }
|
25
|
-
if total > max_count
|
26
|
-
reduced << link_to_card(others_target, "#{total - fetch_count} others")
|
27
|
-
end
|
28
|
-
reduced.to_sentence
|
13
|
+
links = updater_links updaters, others_target: card.fetch(:editors)
|
14
|
+
"Updated by #{links}"
|
29
15
|
end
|
30
16
|
|
31
17
|
def acts_bridge_layout acts, context=:bridge
|
@@ -62,4 +48,31 @@ format :html do
|
|
62
48
|
act_listing(act, opts[:act_seq], :bridge)
|
63
49
|
end
|
64
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def updater_links updaters, item_view: :link, max_count: 3, others_target: card
|
55
|
+
total = updaters.size
|
56
|
+
num_to_show = number_of_updaters_to_show total, max_count
|
57
|
+
|
58
|
+
links =
|
59
|
+
links_to_updaters(updaters, num_to_show, item_view) +
|
60
|
+
link_to_other_updaters(total, others_target, num_to_show)
|
61
|
+
|
62
|
+
links.to_sentence
|
63
|
+
end
|
64
|
+
|
65
|
+
def number_of_updaters_to_show total, max_count
|
66
|
+
total > max_count ? max_count - 1 : max_count
|
67
|
+
end
|
68
|
+
|
69
|
+
def links_to_updaters updaters, num_to_show, item_view
|
70
|
+
updaters[0..(num_to_show - 1)].map { |c| nest c, view: item_view }
|
71
|
+
end
|
72
|
+
|
73
|
+
def link_to_other_updaters total, target, num_to_show
|
74
|
+
return [] unless total > num_to_show
|
75
|
+
|
76
|
+
link_to_card target, "#{total - num_to_show} others"
|
77
|
+
end
|
65
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-history
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
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: 2021-
|
13
|
+
date: 2021-05-05 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.4
|
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.4
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|