card 1.16.14 → 1.16.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +4 -2
  4. data/lib/card/auth.rb +15 -10
  5. data/lib/card/codename.rb +25 -21
  6. data/lib/card/content.rb +100 -68
  7. data/lib/card/format.rb +158 -129
  8. data/lib/card/query.rb +15 -9
  9. data/lib/card/query/attributes.rb +41 -49
  10. data/lib/card/set.rb +15 -12
  11. data/lib/card/set_pattern.rb +4 -5
  12. data/lib/card/spec_helper.rb +54 -16
  13. data/lib/cardio.rb +43 -25
  14. data/mod/01_core/chunk/include.rb +1 -1
  15. data/mod/01_core/set/all/collection.rb +76 -73
  16. data/mod/01_core/set/all/content.rb +0 -4
  17. data/mod/01_core/set/all/fetch.rb +35 -42
  18. data/mod/01_core/set/all/name.rb +17 -7
  19. data/mod/01_core/set/all/pattern.rb +12 -11
  20. data/mod/01_core/set/all/permissions.rb +51 -42
  21. data/mod/01_core/set/all/phases.rb +2 -1
  22. data/mod/01_core/set/all/references.rb +2 -2
  23. data/mod/01_core/set/all/rules.rb +28 -35
  24. data/mod/01_core/set/all/subcards.rb +12 -12
  25. data/mod/01_core/set/all/tracked_attributes.rb +1 -1
  26. data/mod/01_core/set/all/type.rb +11 -11
  27. data/mod/01_core/set/all/utils.rb +6 -1
  28. data/mod/01_core/spec/set/all/fetch_spec.rb +6 -6
  29. data/mod/01_core/spec/set/all/permissions_spec.rb +11 -11
  30. data/mod/01_core/spec/set/all/tracked_attributes_spec.rb +1 -1
  31. data/mod/01_history/lib/card/action.rb +52 -47
  32. data/mod/01_history/set/all/actions.rb +20 -16
  33. data/mod/01_history/set/all/history.rb +18 -13
  34. data/mod/02_basic_types/set/all/base.rb +23 -2
  35. data/mod/02_basic_types/set/type/pointer.rb +45 -36
  36. data/mod/02_basic_types/spec/set/all/base_spec.rb +40 -24
  37. data/mod/02_basic_types/spec/set/type/pointer_spec.rb +87 -0
  38. data/mod/03_machines/set/right/machine_output.rb +10 -6
  39. data/mod/04_settings/set/abstract/permission.rb +10 -5
  40. data/mod/04_settings/set/type/setting.rb +4 -1
  41. data/mod/05_email/set/all/follow.rb +39 -44
  42. data/mod/05_email/set/all/notify.rb +4 -1
  43. data/mod/05_email/set/right/followers.rb +16 -14
  44. data/mod/05_email/set/self/follow_defaults.rb +22 -19
  45. data/mod/05_standard/lib/carrier_wave/cardmount.rb +1 -0
  46. data/mod/05_standard/set/abstract/attachment.rb +85 -58
  47. data/mod/05_standard/set/all/comment.rb +35 -19
  48. data/mod/05_standard/set/all/error.rb +124 -98
  49. data/mod/05_standard/set/all/list_changes.rb +27 -22
  50. data/mod/05_standard/set/all/rich_html/editing.rb +96 -70
  51. data/mod/05_standard/set/all/rich_html/form.rb +123 -81
  52. data/mod/05_standard/set/all/rich_html/modal.rb +15 -58
  53. data/mod/05_standard/set/right/account.rb +2 -2
  54. data/mod/05_standard/set/right/email.rb +3 -2
  55. data/mod/05_standard/set/rstar/rules.rb +3 -3
  56. data/mod/05_standard/set/self/search.rb +45 -22
  57. data/mod/05_standard/set/type/cardtype.rb +13 -11
  58. data/mod/05_standard/set/type/listed_by.rb +3 -2
  59. data/mod/05_standard/set/type/set.rb +17 -13
  60. data/mod/05_standard/set/type/signup.rb +1 -2
  61. data/mod/05_standard/set/type/user.rb +1 -1
  62. data/mod/05_standard/spec/set/all/account_spec.rb +1 -1
  63. data/mod/05_standard/spec/set/all/history_spec.rb +1 -1
  64. data/mod/05_standard/spec/set/type/email_template_spec.rb +140 -134
  65. data/mod/05_standard/spec/set/type/image_spec.rb +2 -1
  66. data/mod/05_standard/spec/set/type/signup_spec.rb +2 -2
  67. data/spec/models/card/trash_spec.rb +1 -1
  68. data/spec/spec_helper.rb +0 -1
  69. metadata +2 -2
@@ -28,7 +28,7 @@ module ClassMethods
28
28
  INNER JOIN cards ON card_actions.card_id = cards.id
29
29
  WHERE cards.type_id IN (#{Card::FileID}, #{Card::ImageID}) AND card_actions.draft = true"
30
30
  actions.each do |action|
31
- if older_than_five_days? action.created_at && card = action.card # we don't want to delete uploads in progress
31
+ if older_than_five_days?(action.created_at) && card = action.card # we don't want to delete uploads in progress
32
32
  card.delete_files_for_action action
33
33
  end
34
34
  end
@@ -74,6 +74,11 @@ module ClassMethods
74
74
  end
75
75
  end
76
76
 
77
+
78
+ def older_than_five_days? time
79
+ Time.now - time > 432000
80
+ end
81
+
77
82
  end
78
83
 
79
84
  def debug_type
@@ -1,13 +1,13 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  describe Card::Set::All::Fetch do
4
- describe ".fetch" do
5
- it "returns and caches existing cards" do
6
- card_double = class_double("Card")
7
- expect(Card.fetch("A")).to be_instance_of(Card)
8
- expect(Card.cache.read("a")).to be_instance_of(Card)
4
+ describe '.fetch' do
5
+ it 'returns and caches existing cards' do
6
+ card_double = class_double('Card')
7
+ expect(Card.fetch('A')).to be_instance_of(Card)
8
+ expect(Card.cache.read('a')).to be_instance_of(Card)
9
9
  expect(card_double).not_to receive(:find_by_key)
10
- expect(Card.fetch("A")).to be_instance_of(Card)
10
+ expect(Card.fetch('A')).to be_instance_of(Card)
11
11
  end
12
12
 
13
13
  it "returns nil and caches missing cards" do
@@ -89,8 +89,8 @@ describe Card::Set::All::Permissions do
89
89
  expect(card.read_rule_id).to eq(@perm_card.id)
90
90
  expect(card.who_can(:read)).to eq([Card['joe_admin'].id])
91
91
  Card::Auth.as(:anonymous) { expect(card.ok?(:read)).to be_falsey }
92
- Card::Auth.as(:joe_user) { expect(card.ok?(:read)).to be_falsey }
93
- Card::Auth.as(:joe_admin) { expect(card.ok?(:read)).to be_truthy }
92
+ Card::Auth.as('joe_user') { expect(card.ok?(:read)).to be_falsey }
93
+ Card::Auth.as('joe_admin') { expect(card.ok?(:read)).to be_truthy }
94
94
  Card::Auth.as_bot { expect(card.ok?(:read)).to be_truthy }
95
95
  end
96
96
 
@@ -171,7 +171,7 @@ describe Card::Set::All::Permissions do
171
171
  end
172
172
  c = Card.new(name: 'Home+Heart')
173
173
  expect(c.who_can(:read)).to eq([Card::AnyoneSignedInID])
174
- expect(c.permission_rule_card(:read).first.id).to eq(@perm_card.id)
174
+ expect(c.permission_rule_id_and_class(:read).first).to eq(@perm_card.id)
175
175
  c.save
176
176
  expect(c.read_rule_id).to eq(@perm_card.id)
177
177
  end
@@ -183,7 +183,7 @@ describe Card::Set::All::Permissions do
183
183
  end
184
184
  c = Card.new(name: 'Home+Heart')
185
185
  expect(c.who_can(:read)).to eq([Card::AnyoneID])
186
- expect(c.permission_rule_card(:read).first.id).to(
186
+ expect(c.permission_rule_id_and_class(:read).first).to(
187
187
  eq(Card.fetch('*all+*read').id)
188
188
  )
189
189
  c.save
@@ -234,10 +234,10 @@ describe Card::Set::All::Permissions do
234
234
  Card::Auth.as_bot do
235
235
  expect(Card::Auth.always_ok?).to eq(true)
236
236
  end
237
- Card::Auth.as(:joe_user) do
237
+ Card::Auth.as('joe_user') do
238
238
  expect(Card::Auth.always_ok?).to eq(false)
239
239
  end
240
- Card::Auth.as(:joe_admin) do
240
+ Card::Auth.as('joe_admin') do
241
241
  expect(Card::Auth.always_ok?).to eq(true)
242
242
  Card.create! name: 'Hidden'
243
243
  Card.create name: 'Hidden+*self+*read', type: 'Pointer',
@@ -263,12 +263,12 @@ describe Card::Set::All::Permissions do
263
263
 
264
264
  it 'reader setting' do
265
265
  Card.where(trash: false).each do |ca|
266
- rule_card, rule_class = ca.permission_rule_card(:read)
266
+ rule_id, rule_class = ca.permission_rule_id_and_class(:read)
267
267
  # warn "C #{c.inspect}, #{c.read_rule_id}, #{prc.first.id},
268
268
  # {c.read_rule_class}, #{prc.second}, #{prc.first.inspect}" unless
269
269
  # prc.last == c.read_rule_class && prc.first.id == c.read_rule_id
270
270
  expect(rule_class).to eq(ca.read_rule_class)
271
- expect(rule_card.id).to eq(ca.read_rule_id)
271
+ expect(rule_id).to eq(ca.read_rule_id)
272
272
  end
273
273
  end
274
274
 
@@ -474,7 +474,7 @@ describe Card::Set::All::Permissions do
474
474
  end
475
475
 
476
476
  it 'should let joe user basic cards' do
477
- Card::Auth.as :joe_user do
477
+ Card::Auth.as 'joe_user' do
478
478
  expect(@c.ok?(:read)).to be_truthy
479
479
  end
480
480
  end
@@ -503,10 +503,10 @@ describe Card::Set::All::Permissions do
503
503
  it 'should handle delete as a setting' do
504
504
  c = Card.new name: 'whatever'
505
505
  expect(c.who_can(:delete)).to eq([Card['joe_user'].id])
506
- Card::Auth.as(:joe_user) do
506
+ Card::Auth.as('joe_user') do
507
507
  expect(c.ok?(:delete)).to eq(true)
508
508
  end
509
- Card::Auth.as(:u1) do
509
+ Card::Auth.as('u1') do
510
510
  expect(c.ok?(:delete)).to eq(false)
511
511
  end
512
512
  Card::Auth.as(:anonymous) do
@@ -195,7 +195,7 @@ describe Card::Set::All::TrackedAttributes do
195
195
 
196
196
  it 'test_rename_should_not_fail_when_updating_inaccessible_referencer' do
197
197
  Card.create! name: 'Joe Card', content: 'Whattup'
198
- Card::Auth.as :joe_admin do
198
+ Card::Auth.as 'joe_admin' do
199
199
  Card.create! name: 'Admin Card', content: '[[Joe Card]]'
200
200
  end
201
201
  c = Card['Joe Card']
@@ -1,17 +1,18 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  class Card
4
-
5
4
  class Action < ActiveRecord::Base
6
5
  belongs_to :card
7
6
  belongs_to :act, foreign_key: :card_act_id, inverse_of: :actions
8
- has_many :card_changes, foreign_key: :card_action_id, inverse_of: :action,
9
- dependent: :delete_all, class_name: "Card::Change"
7
+ has_many :card_changes, foreign_key: :card_action_id, inverse_of: :action,
8
+ dependent: :delete_all, class_name: 'Card::Change'
10
9
 
11
- belongs_to :super_action, class_name: "Action", inverse_of: :sub_actions
12
- has_many :sub_actions, class_name: "Action", inverse_of: :super_action
10
+ belongs_to :super_action, class_name: 'Action', inverse_of: :sub_actions
11
+ has_many :sub_actions, class_name: 'Action', inverse_of: :super_action
13
12
 
14
- scope :created_by, lambda { |actor_id| joins(:act).where('card_acts.actor_id = ?', actor_id) }
13
+ scope :created_by, lambda { |actor_id|
14
+ joins(:act).where 'card_acts.actor_id = ?', actor_id
15
+ }
15
16
 
16
17
  # replace with enum if we start using rails 4
17
18
  TYPE = [:create, :update, :delete]
@@ -28,13 +29,14 @@ class Card
28
29
  end
29
30
 
30
31
  def fetch id
31
- cache.read(id.to_s) or begin
32
+ cache.read(id.to_s) || begin
32
33
  cache.write id.to_s, Action.find(id.to_i)
33
34
  end
34
35
  end
35
36
 
36
37
  def delete_cardless
37
- Card::Action.joins('LEFT JOIN cards ON card_actions.card_id = cards.id').where('cards.id IS NULL').delete_all
38
+ left_join = 'LEFT JOIN cards ON card_actions.card_id = cards.id'
39
+ Card::Action.joins(left_join).where('cards.id IS NULL').delete_all
38
40
  end
39
41
 
40
42
  def delete_old
@@ -50,19 +52,21 @@ class Card
50
52
  # See also create_act_and_action, which needs to happen before this or we
51
53
  # don't have the action to call this method on.
52
54
  #
53
- # When changes are stored for versioned attributes, this is the signal method
54
- # By overriding this method in a module, the module takes over handling of
55
- # changes. Although the standard version stores the Changes in active record
56
- # models (Act, Action and Change records), these could be /dev/nulled for a
57
- # history-less implementation, or handled by an external service.
58
- #
59
- # If change streams are generated from database triggers, and we aren't writing
60
- # here (disabled history), we still have to generate change stream events in
61
- # another way.
55
+ # When changes are stored for versioned attributes, this is the signal
56
+ # method. By overriding this method in a module, the module takes over
57
+ # handling of changes. Although the standard version stores the Changes in
58
+ # ActiveRecord models (Act, Action and Change records), these could be
59
+ # /dev/nulled for a history-less implementation, or handled by an external
60
+ # service.
62
61
  #
62
+ # If change streams are generated from database triggers, and we aren't
63
+ # writing here (disabled history), we still have to generate change stream
64
+ # events in another way.
65
+
63
66
  def changed_fields obj, changed_fields
64
- #changed_fields.each{ |f| changes.build field: f, value: self[f] }
65
- changed_fields.each{ |f| Card::Change.create field: f, value: obj[f], card_action_id: id }
67
+ changed_fields.each do |f|
68
+ Card::Change.create field: f, value: obj[f], card_action_id: id
69
+ end
66
70
  end
67
71
 
68
72
  def edit_info
@@ -82,7 +86,8 @@ class Card
82
86
  {
83
87
  content: new_value_for(:db_content),
84
88
  name: new_value_for(:name),
85
- cardtype: ( typecard = Card[new_value_for(:type_id).to_i] and typecard.name.capitalize )
89
+ cardtype: ((typecard = Card[new_value_for(:type_id).to_i]) &&
90
+ typecard.name.capitalize)
86
91
  }
87
92
  end
88
93
 
@@ -90,13 +95,15 @@ class Card
90
95
  @old_values ||= {
91
96
  content: last_value_for(:db_content),
92
97
  name: last_value_for(:name),
93
- cardtype: ( value = last_value_for(:type_id) and
94
- typecard = Card.find(value) and typecard.name.capitalize )
98
+ cardtype: ((value = last_value_for(:type_id)) &&
99
+ (typecard = Card.find(value)) &&
100
+ typecard.name.capitalize)
95
101
  }
96
102
  end
97
103
 
98
104
  def last_value_for field
99
- ch = self.card.last_change_on(field, before: self) and ch.value
105
+ ch = card.last_change_on(field, before: self)
106
+ ch && ch.value
100
107
  end
101
108
 
102
109
  def field_index field
@@ -108,7 +115,8 @@ class Card
108
115
  end
109
116
 
110
117
  def new_value_for field
111
- ch = card_changes.find_by(field: field_index(field)) and ch.value
118
+ ch = card_changes.find_by(field: field_index(field))
119
+ ch && ch.value
112
120
  end
113
121
 
114
122
  def change_for field
@@ -116,19 +124,19 @@ class Card
116
124
  end
117
125
 
118
126
  def new_type?
119
- new_value_for(:type_id)
127
+ new_value_for :type_id
120
128
  end
121
129
 
122
130
  def new_content?
123
- new_value_for(:db_content)
131
+ new_value_for :db_content
124
132
  end
125
133
 
126
134
  def new_name?
127
- new_value_for(:name)
135
+ new_value_for :name
128
136
  end
129
137
 
130
- def action_type=(value)
131
- write_attribute(:action_type, TYPE.index(value))
138
+ def action_type= value
139
+ write_attribute :action_type, TYPE.index(value)
132
140
  end
133
141
 
134
142
  def action_type
@@ -136,11 +144,11 @@ class Card
136
144
  end
137
145
 
138
146
  def set_act
139
- self.set_act ||= self.acts.last
147
+ self.set_act ||= acts.last
140
148
  end
141
149
 
142
150
  def revision_nr
143
- self.card.actions.index_of(self)
151
+ card.actions.index_of self
144
152
  end
145
153
 
146
154
  def red?
@@ -156,38 +164,35 @@ class Card
156
164
  # end
157
165
 
158
166
  def name_diff opts={}
159
- if new_name?
160
- Card::Diff.complete old_values[:name], new_values[:name], opts
161
- end
167
+ return unless new_name?
168
+ Card::Diff.complete old_values[:name], new_values[:name], opts
162
169
  end
163
170
 
164
171
  def cardtype_diff opts={}
165
- if new_type?
166
- Card::Diff.complete old_values[:cardtype], new_values[:cardtype], opts
167
- end
172
+ return unless new_type?
173
+ Card::Diff.complete old_values[:cardtype], new_values[:cardtype], opts
168
174
  end
169
175
 
170
176
  def content_diff diff_type=:expanded, opts=nil
171
- if new_content?
172
- if diff_type == :summary
173
- content_diff_builder(opts).summary
174
- else
175
- content_diff_builder(opts).complete
176
- end
177
+ return unless new_content?
178
+ if diff_type == :summary
179
+ content_diff_builder(opts).summary
180
+ else
181
+ content_diff_builder(opts).complete
177
182
  end
178
183
  end
179
184
 
180
185
  def content_diff_builder opts=nil
181
186
  @content_diff_builder ||= begin
182
- Card::Diff::DiffBuilder.new(old_values[:content], new_values[:content], opts || card.include_set_modules.diff_args)
187
+ diff_args = opts || card.include_set_modules.diff_args
188
+ Card::Diff::DiffBuilder.new(
189
+ old_values[:content], new_values[:content], diff_args
190
+ )
183
191
  end
184
192
  end
185
193
 
186
194
  def card
187
195
  Card.fetch card_id, look_in_trash: true
188
196
  end
189
-
190
197
  end
191
198
  end
192
-
193
-
@@ -1,10 +1,9 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  def select_action_by_params params
4
- if (action = find_action_by_params(params))
5
- run_callbacks :select_action do
6
- self.selected_action_id = action.id
7
- end
4
+ return unless (action = find_action_by_params(params))
5
+ run_callbacks :select_action do
6
+ self.selected_action_id = action.id
8
7
  end
9
8
  end
10
9
 
@@ -12,28 +11,32 @@ def find_action_by_params args
12
11
  if args[:rev]
13
12
  nth_action args[:rev]
14
13
  elsif Integer === args[:rev_id] || args[:rev_id] =~ /^\d+$/
15
- if action = Action.fetch(args[:rev_id]) and action.card_id == id
14
+ if (action = Action.fetch(args[:rev_id])) && action.card_id == id
16
15
  action
17
16
  end
18
- elsif args[:rev_id] # revision id is probalby a mod (e.g. if you request files/:logo/05_standard.png)
17
+ # revision id is probalby a mod (e.g. if you request
18
+ # files/:logo/05_standard.png)
19
+ elsif args[:rev_id]
19
20
  last_action
20
21
  end
21
22
  end
22
23
 
23
24
  def nth_action index
24
25
  index = index.to_i
25
- if id and index > 0
26
- Action.where("draft is not true AND card_id = #{id}").order(:id).limit(1).offset(index-1).first
27
- end
26
+ return unless id && index > 0
27
+ Action.where("draft is not true AND card_id = #{id}")
28
+ .order(:id).limit(1).offset(index - 1).first
28
29
  end
29
30
 
30
31
  def revision action
31
- # a "revision" refers to the state of all tracked fields at the time of a given action
32
+ # a "revision" refers to the state of all tracked fields
33
+ # at the time of a given action
32
34
  if action.is_a? Integer
33
35
  action = Card::Action.fetch(action)
34
36
  end
35
- action and Card::TRACKED_FIELDS.inject({}) do |attr_changes, field|
36
- last_change = action.card_changes.find_by_field_name(field) || last_change_on(field, not_after: action)
37
+ action && Card::TRACKED_FIELDS.inject({}) do |attr_changes, field|
38
+ last_change = action.card_changes.find_by_field_name(field) ||
39
+ last_change_on(field, not_after: action)
37
40
  attr_changes[field.to_sym] = (last_change ? last_change.value : self[field])
38
41
  attr_changes
39
42
  end
@@ -42,11 +45,12 @@ end
42
45
  def delete_old_actions
43
46
  Card::TRACKED_FIELDS.each do |field|
44
47
  # assign previous changes on each tracked field to the last action
45
- if (la = last_action) && !la.change_for(field).present? and (last_change = last_change_on(field))
46
- last_change = Card::Change.find(last_change.id) # last_change comes as readonly record
48
+ if (la = last_action) && !la.change_for(field).present? &&
49
+ (last_change = last_change_on(field))
50
+ # last_change comes as readonly record
51
+ last_change = Card::Change.find(last_change.id)
47
52
  last_change.update_attributes!(card_action_id: last_action_id)
48
53
  end
49
54
  end
50
- actions.where('id != ?', last_action_id ).delete_all
55
+ actions.where('id != ?', last_action_id).delete_all
51
56
  end
52
-
@@ -23,18 +23,22 @@ event :assign_action, after: :assign_act do
23
23
  end
24
24
  end
25
25
 
26
+ def finalize_action?
27
+ (history? || respond_to?(:attachment)) && current_action
28
+ end
29
+
26
30
  # stores changes in the changes table and assigns them to the current action
27
31
  # removes the action if there are no changes
28
- event :finalize_action,
29
- after: :stored,
30
- when: proc { |c|
31
- (c.history? || c.respond_to?(:attachment)) && c.current_action
32
- } do
32
+ event :finalize_action, after: :stored, when: proc { |c| c.finalize_action? } do
33
33
  @changed_fields = Card::TRACKED_FIELDS.select do |f|
34
34
  changed_attributes.member? f
35
35
  end
36
36
  if @changed_fields.present?
37
- @changed_fields.each{ |f| Card::Change.create field: f, value: self[f], card_action_id: @current_action.id }
37
+ @changed_fields.each do |f|
38
+ Card::Change.create field: f,
39
+ value: self[f],
40
+ card_action_id: @current_action.id
41
+ end
38
42
  @current_action.update_attributes! card_id: id
39
43
  elsif @current_action.card_changes(true).empty?
40
44
  @current_action.delete
@@ -198,8 +202,10 @@ format :html do
198
202
  card.current_rev_nr
199
203
  hide_diff = (params['hide_diff'] == ' true') || args[:hide_diff]
200
204
  args[:slot_class] = "revision-#{act.id} history-slot list-group-item"
205
+ draft = (last_action = act.actions.last) && last_action.draft
206
+
201
207
  wrap(args) do
202
- render_haml card: card, act: act, act_view: act_view,
208
+ render_haml card: card, act: act, act_view: act_view, draft: draft,
203
209
  current_rev_nr: current_rev_nr, rev_nr: rev_nr,
204
210
  hide_diff: hide_diff do
205
211
  <<-HAML
@@ -213,7 +219,7 @@ format :html do
213
219
  .time.timeago
214
220
  = time_ago_in_words(act.acted_at)
215
221
  ago
216
- - if act.actions.last.draft
222
+ - if draft
217
223
  |
218
224
  %em.info
219
225
  Autosave
@@ -221,14 +227,14 @@ format :html do
221
227
  %em.label.label-info
222
228
  Current
223
229
  - elsif act_view == :expanded
224
- = rollback_link act.relevant_actions_for(card, act.actions.last.draft)
230
+ = rollback_link act.relevant_actions_for(card, draft)
225
231
  = show_or_hide_changes_link hide_diff, act_id: act.id, act_view: act_view, rev_nr: rev_nr, current_rev_nr: current_rev_nr
226
232
  .toggle
227
233
  = fold_or_unfold_link act_id: act.id, act_view: act_view, rev_nr: rev_nr, current_rev_nr: current_rev_nr
228
234
 
229
235
  .action-container{style: ("clear: left;" if act_view == :expanded)}
230
236
  - act.relevant_actions_for(card).each do |action|
231
- = send("_render_action_#{ act_view }", action: action )
237
+ = send("_render_action_#{act_view}", action: action )
232
238
  HAML
233
239
  end
234
240
  end
@@ -242,7 +248,6 @@ HAML
242
248
  render_action :expanded, args
243
249
  end
244
250
 
245
-
246
251
  def render_action action_view, args
247
252
  action = args[:action] || card.last_action
248
253
  hide_diff = Env.params['hide_diff'] == 'true' || args[:hide_diff]
@@ -347,8 +352,8 @@ HAML
347
352
  toggled_view = args[:act_view] == :expanded ? :act_summary : :act_expanded
348
353
  arrow_dir = args[:act_view] == :expanded ? 'arrow-down' : 'arrow-right'
349
354
  link_to '', args.merge(view: toggled_view),
350
- class: "slotter revision-#{args[:act_id]} #{arrow_dir}",
351
- remote: true
355
+ class: "slotter revision-#{args[:act_id]} #{arrow_dir}",
356
+ remote: true
352
357
  end
353
358
 
354
359
  def show_or_hide_changes_link hide_diff, args