card-mod-history 0.16.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0eadd287d28611d17a7e670cc86f530020f3fb1a033f3caa4669d98ae890799
4
- data.tar.gz: 21fbfc6e2a38807ebed7e1d40b47d2382c8195298bcf394e3f5b484363d16255
3
+ metadata.gz: 1a20f2d9eec3fe3db61fd2812e78f4bb8565cda58e0b1fc7a0688c8cb5765109
4
+ data.tar.gz: 7be6fe76ba77beee613bc340de7177403c98caf3e818d15f8b58a70b4d67fa37
5
5
  SHA512:
6
- metadata.gz: 6df8845d3cd17b190f7512f39e2e49d52ef8fbe17f56b29795d04d37ed9032f923f3e281049ca0cfcefad4951d15e20e3ebe8401941e8c03275f1ae8cc3c08bd
7
- data.tar.gz: 5135f6f03178e172430558b00e99841fa236be5c833c11d59a4d95dd5dc21c58ec92846bb5fca23a6c4cb8947f7303b4d7445fb843205a8fc4dbaf960999ffa2
6
+ metadata.gz: cb259274b48f051e5e793142d26efe926eb1fcb66d0204586f8d459c99b0d1307538683ff8936a84969ccbdef56daa8ddf3cc0a9f22e3754de0ded3328878c48
7
+ data.tar.gz: d1c77b5e3e5db4f7788d1e985986d0fcf4d1caf0005201e66a0ac949b560e059834aac159b71ea6e9806e275121595b696441bbb14d0fab2b0cfe677b36005b6
data/config/admin.yml ADDED
@@ -0,0 +1,3 @@
1
+ views:
2
+ - creator_credit
3
+ - updated_by
@@ -9,10 +9,14 @@ class Card
9
9
  %(<span class="nr">##{@args[:act_seq]}</span> #{actor_and_ago})
10
10
  end
11
11
 
12
+ def relative_title
13
+ @act_card.name.from @card.name
14
+ end
15
+
12
16
  def subtitle
13
17
  return "" unless @act.card_id != @format.card.id
14
18
 
15
- wrap_with :small, "act on #{absolute_title}"
19
+ wrap_with :small, "act on #{relative_title}"
16
20
  end
17
21
 
18
22
  def act_links
data/lib/card/act.rb CHANGED
@@ -122,7 +122,7 @@ class Card
122
122
  def actions_affecting card
123
123
  actions.select do |action|
124
124
  (card.id == action.card_id) ||
125
- card.nestee_ids.include?(action.card_id)
125
+ card.history_card_ids.include?(action.card_id)
126
126
  end
127
127
  end
128
128
 
@@ -53,19 +53,29 @@ class Card
53
53
  end
54
54
  end
55
55
 
56
+ def relative_name
57
+ @action.card.name.from @format.card.name
58
+ end
59
+
56
60
  def name_diff
57
- return @action.card.name if @action.card.name.compound?
61
+ return relative_name if @action.card.name.compound?
58
62
  # TODO: handle compound names better
59
63
 
60
- if @action.card == @format.card
61
- name_changes
62
- else
63
- link_to_view(
64
- :related, name_changes,
65
- path: { slot: { items: { view: "history", nest_name: @action.card.name } } }
66
- # "data-slot-selector" => ".card-slot.history-view"
67
- )
68
- end
64
+ # if @action.card == @format.card
65
+ name_changes
66
+
67
+ # I commented out the following because it's hard to imagine it working; there
68
+ # no "related" view! But perhaps we do still need handling for this case, which
69
+ # is evidently for when there is a change involving a simple card that is not the
70
+ # act card??
71
+ #
72
+ # else
73
+ # link_to_view(
74
+ # :related, name_changes,
75
+ # path: { slot: { items: { view: "history", nest_name: @action.card.name } } }
76
+ # # "data-slot-selector" => ".card-slot.history-view"
77
+ # )
78
+ # end
69
79
  end
70
80
 
71
81
  def content_diff
@@ -102,11 +102,9 @@ class Card
102
102
  # @return [True/False] for :trash
103
103
  def interpret_value field, value
104
104
  case field.to_sym
105
- when :type_id
106
- value&.to_i
107
- when :cardtype
108
- Card.fetch_name(value&.to_i)
109
- else value
105
+ when :type_id then value&.to_i
106
+ when :cardtype then value&.to_i&.cardname
107
+ else value
110
108
  end
111
109
  end
112
110
  end
data/lib/card/action.rb CHANGED
@@ -31,8 +31,8 @@ class Card
31
31
  inverse_of: :action,
32
32
  dependent: :delete_all,
33
33
  class_name: "Card::Change"
34
- belongs_to :super_action, class_name: "Action", inverse_of: :sub_actions
35
- has_many :sub_actions, class_name: "Action", inverse_of: :super_action
34
+ belongs_to :super_action, class_name: "Card::Action", inverse_of: :sub_actions
35
+ has_many :sub_actions, class_name: "Card::Action", inverse_of: :super_action
36
36
 
37
37
  scope :created_by, lambda { |actor_id|
38
38
  joins(:act).where "card_acts.actor_id = ?", actor_id
@@ -6,18 +6,14 @@ event :update_ancestor_timestamps, :integrate do
6
6
  ids.map { |anc_id| Card.expire anc_id.cardname }
7
7
  end
8
8
 
9
+ # event :update_temporary_cache, :initialize do
10
+ # Card.cache.temp.write key, self if key.present?
11
+ # end
12
+
9
13
  # must be called on all actions and before :set_name, :process_subcards and
10
14
  # :delete_children
11
15
  event :assign_action, :initialize, when: :actionable? do
12
- act = director.need_act
13
- @current_action = Card::Action.create(
14
- card_act_id: act.id,
15
- action_type: action,
16
- draft: (Env.params["draft"] == "true")
17
- )
18
- if @supercard && @supercard != self
19
- @current_action.super_action = @supercard.current_action
20
- end
16
+ @current_action = new_action
21
17
  end
22
18
 
23
19
  event :detect_conflict, :validate, on: :update, when: :edit_conflict? do
@@ -53,12 +49,6 @@ event :finalize_act, after: :finalize_action, when: :act_card? do
53
49
  Card::Director.act.update! card_id: id
54
50
  end
55
51
 
56
- event :remove_empty_act, :integrate_with_delay_final,
57
- priority: 100, when: :remove_empty_act? do
58
- # Card::Director.act.delete
59
- # Card::Director.act = nil
60
- end
61
-
62
52
  # can we store an action? (can be overridden, eg in files)
63
53
  def actionable?
64
54
  history?
@@ -81,6 +71,26 @@ end
81
71
 
82
72
  private
83
73
 
74
+ def new_action
75
+ Card::Action.new(
76
+ act: director.need_act,
77
+ # ar_card: self,
78
+ action_type: action,
79
+ draft: draft_action?,
80
+ super_action: super_action
81
+ )
82
+ end
83
+
84
+ def draft_action?
85
+ Env.params["draft"] == "true"
86
+ end
87
+
88
+ def super_action
89
+ return unless @supercard && @supercard != self
90
+
91
+ @supercard.current_action
92
+ end
93
+
84
94
  # changes for the create action are stored after the first update
85
95
  def store_card_changes_for_create_action
86
96
  Card::Action.cache.delete "#{create_action.id}-changes"
data/set/all/history.rb CHANGED
@@ -3,6 +3,10 @@ def history?
3
3
  true
4
4
  end
5
5
 
6
+ def no_history?
7
+ !history?
8
+ end
9
+
6
10
  # all cards whose acts are considered part of this card's history
7
11
  def history_card_ids
8
12
  nestee_ids << id
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.16.0
4
+ version: 0.18.0
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: 2023-11-18 00:00:00.000000000 Z
13
+ date: 2024-10-31 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.106.0
21
+ version: 1.108.0
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.106.0
28
+ version: 1.108.0
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org
@@ -36,6 +36,7 @@ files:
36
36
  - LICENSE
37
37
  - README.md
38
38
  - assets/style/history.scss
39
+ - config/admin.yml
39
40
  - config/locales/de.yml
40
41
  - config/locales/en.yml
41
42
  - data/test.yml
@@ -64,7 +65,7 @@ files:
64
65
  - set/all/history_board.rb
65
66
  homepage: https://decko.org
66
67
  licenses:
67
- - GPL-3.0
68
+ - GPL-3.0-or-later
68
69
  metadata:
69
70
  source_code_uri: https://github.com/decko-commons/decko
70
71
  homepage_uri: https://decko.org
@@ -81,14 +82,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
82
  requirements:
82
83
  - - ">="
83
84
  - !ruby/object:Gem::Version
84
- version: '2.5'
85
+ version: '3.0'
85
86
  required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  requirements:
87
88
  - - ">="
88
89
  - !ruby/object:Gem::Version
89
90
  version: '0'
90
91
  requirements: []
91
- rubygems_version: 3.4.10
92
+ rubygems_version: 3.5.7
92
93
  signing_key:
93
94
  specification_version: 4
94
95
  summary: Revision histories in acts, actions, and changes