card-mod-history 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef26bb3f54e291b305c04d313dc3f5718606a2f447af31ec01594e950545a64e
4
- data.tar.gz: 3edd2f398f989a2b1a22989f60103bd9fd1307f13ef1d248e8db66a4ff058f8a
3
+ metadata.gz: 14b000c818d4e928c00b9599251244525653a78f44842986e536b503e5311d49
4
+ data.tar.gz: 94b4fcf68548ae1b070402f73dca6c50a6e0c12e7b204fb22868ce14e8be97a5
5
5
  SHA512:
6
- metadata.gz: 0e4c06ce4757f5c61351538ee99c2763bd1f9e15285f4046dd4a4060bc8fd3d5116c06abbd3b8e6542754885dd58ec7734b5fa81343e9a0191b92e5d0969be22
7
- data.tar.gz: 7686879a8ac1ff5be965861c48b134c373d32e123a6c880247d2a5bbdad8580884d9aefcdbea7d615a2e414d905b9d4da2c25c57000646aef42ae13a177a1eb3
6
+ metadata.gz: 22dea11654d68b02724fa7f952bd6700b721334e54e165c584058197a3c0f65f23f5f41964f158baf3e86093deb12f8d854e98d6979edf2b09d5557eef990796
7
+ data.tar.gz: 2fdfd6b5d9f3b3042c1fafc9924ff77b6e7610c02dd83fc8fa498c39bb8015801fa333f1cc57ab574a76482175f2f5d5a1b76bbf6e95e16190d1b4686ca4b06b
@@ -107,8 +107,7 @@ class Card
107
107
  "#{time_ago_in_words(@act.acted_at)} ago"
108
108
  end
109
109
 
110
- def
111
- accordion_item
110
+ def accordion_item
112
111
  # context = @act.main_action&.draft ? :warning : :default
113
112
  @format.accordion_item header,
114
113
  subheader: act_links,
@@ -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"
@@ -66,7 +66,7 @@ private
66
66
  def new_content_action_id
67
67
  return unless @current_action && current_action_changes_content?
68
68
 
69
- @current_action.id
69
+ @current_action.id || (@current_action.save! && @current_action.id)
70
70
  end
71
71
 
72
72
  def current_action_changes_content?
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.17.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-06-12 00:00:00.000000000 Z
13
+ date: 2024-11-22 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.107.0
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.107.0
28
+ version: 1.108.1
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org
@@ -65,7 +65,7 @@ files:
65
65
  - set/all/history_board.rb
66
66
  homepage: https://decko.org
67
67
  licenses:
68
- - GPL-3.0
68
+ - GPL-3.0-or-later
69
69
  metadata:
70
70
  source_code_uri: https://github.com/decko-commons/decko
71
71
  homepage_uri: https://decko.org