card 1.19.2 → 1.19.3
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/VERSION +1 -1
- data/lib/card/content/diff.rb +2 -2
- data/mod/admin/set/self/trash.rb +38 -17
- data/mod/carrierwave/lib/carrier_wave/image_card_uploader.rb +2 -2
- data/mod/core/set/all/fetch.rb +1 -1
- data/mod/email/set/all/notify.rb +7 -1
- data/mod/history/lib/card/action/differ.rb +10 -11
- data/mod/history/set/all/history.rb +31 -12
- data/mod/machines/lib/stylesheets/style_cards.scss +10 -2
- data/mod/standard/spec/set/all/history_spec.rb +2 -2
- data/spec/lib/card/diff_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 057086042ff26905bb50428aa1e697887464f1ed
|
4
|
+
data.tar.gz: 159c9cd1236f61f566ed10a4b132e84aadc3c369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d9330f1f0e0e30a5bf642e80695ec4b460534e04c34843b9f316b154eb72aa56f3feb1d47b639bee6a55568e2e8fef3d14e1391eb8a406656aa86e2f26702ef
|
7
|
+
data.tar.gz: cf1908a395f06b908b57f9dbbfcf67ef0d734ee51f30a93272725ddfe27d583256e326a416a149fd91ac4db5fc971eb0da1c8a1c957b38ccb9d6855094426062
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.19.
|
1
|
+
1.19.3
|
data/lib/card/content/diff.rb
CHANGED
@@ -13,11 +13,11 @@ class Card
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def render_added_chunk text
|
16
|
-
"<ins class='diffins diff-
|
16
|
+
"<ins class='diffins diff-added'>#{text}</ins>"
|
17
17
|
end
|
18
18
|
|
19
19
|
def render_deleted_chunk text, _count=true
|
20
|
-
"<del class='diffdel diff-
|
20
|
+
"<del class='diffdel diff-deleted'>#{text}</del>"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
data/mod/admin/set/self/trash.rb
CHANGED
@@ -1,29 +1,50 @@
|
|
1
1
|
format :html do
|
2
|
+
view :core do |_args|
|
3
|
+
rows = trashed_cards.map { |tc| trash_table_row(tc) }
|
4
|
+
output [
|
5
|
+
restored,
|
6
|
+
(empty_trash_link if rows.present?),
|
7
|
+
table(rows, header: ["card", "deleted", "by", ""])
|
8
|
+
]
|
9
|
+
end
|
10
|
+
|
2
11
|
def trashed_cards
|
3
|
-
Card.where(trash: true)
|
12
|
+
Card.where(trash: true).order(updated_at: :desc)
|
4
13
|
end
|
5
14
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
(content_tag(:p, empty_trash_link) if rows.present?),
|
13
|
-
table(rows, header: ["card", "deleted by", ""])
|
15
|
+
def trash_table_row card
|
16
|
+
[
|
17
|
+
card.name,
|
18
|
+
"#{time_ago_in_words(card.updated_at)} ago",
|
19
|
+
Card[card.updater_id].name,
|
20
|
+
restore_link(card)
|
14
21
|
]
|
15
22
|
end
|
16
23
|
|
24
|
+
def restored
|
25
|
+
return unless (res_id = Env.params[:restore]) &&
|
26
|
+
(res_card = Card[res_id.to_i])
|
27
|
+
alert :success, dismissible: true do
|
28
|
+
content_tag(:h5, "restored") + subformat(res_card).render_closed
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
17
32
|
def empty_trash_link
|
18
|
-
|
19
|
-
|
20
|
-
|
33
|
+
button =
|
34
|
+
button_link "empty trash",
|
35
|
+
{ card: :admin, action: :update,
|
36
|
+
task: :empty_trash, success: { id: "~#{card.id}" } },
|
37
|
+
btn_type: :default,
|
38
|
+
"data-confirm" => "Are you sure you want to delete all "\
|
39
|
+
"cards in the trash"
|
40
|
+
content_tag :p, button
|
21
41
|
end
|
22
42
|
|
23
|
-
def
|
24
|
-
before_delete =
|
25
|
-
link_path = path action: :update, view: :open,
|
26
|
-
|
27
|
-
link_to "
|
43
|
+
def restore_link trashed_card
|
44
|
+
before_delete = trashed_card.actions[-2]
|
45
|
+
link_path = path action: :update, view: :open, restore: trashed_card.id,
|
46
|
+
action_ids: [before_delete]
|
47
|
+
link_to "restore", link_path, method: :post, rel: "nofollow",
|
48
|
+
remote: true, class: "slotter"
|
28
49
|
end
|
29
50
|
end
|
@@ -20,10 +20,10 @@ module CarrierWave
|
|
20
20
|
process resize_to_fit: [75, 75]
|
21
21
|
end
|
22
22
|
version :medium, if: :create_versions? do
|
23
|
-
process
|
23
|
+
process resize_to_limit: [200, 200]
|
24
24
|
end
|
25
25
|
version :large, if: :create_versions? do
|
26
|
-
process
|
26
|
+
process resize_to_limit: [500, 500]
|
27
27
|
end
|
28
28
|
|
29
29
|
# version :small_square, if: :create_versions?,
|
data/mod/core/set/all/fetch.rb
CHANGED
data/mod/email/set/all/notify.rb
CHANGED
@@ -68,9 +68,15 @@ def silent_change
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def silent_change?
|
71
|
-
silent_change
|
71
|
+
silent_change
|
72
72
|
end
|
73
73
|
|
74
|
+
event :only_notify_on_web_requests, :initialize,
|
75
|
+
when: proc { !Card::Env[:controller] } do
|
76
|
+
@silent_change = true
|
77
|
+
end
|
78
|
+
|
79
|
+
|
74
80
|
def notable_change?
|
75
81
|
!silent_change? && current_act_card? &&
|
76
82
|
Card::Auth.current_id != WagnBotID && followable?
|
@@ -36,6 +36,14 @@ class Card
|
|
36
36
|
content_diff_object.green?
|
37
37
|
end
|
38
38
|
|
39
|
+
def raw_view content=nil
|
40
|
+
original_content = card.db_content
|
41
|
+
card.db_content = content || value(:db_content)
|
42
|
+
card.format.render_raw
|
43
|
+
ensure
|
44
|
+
card.db_content = original_content
|
45
|
+
end
|
46
|
+
|
39
47
|
private
|
40
48
|
|
41
49
|
def diff_object field, opts
|
@@ -45,20 +53,11 @@ class Card
|
|
45
53
|
def content_diff_object opts=nil
|
46
54
|
@diff ||= begin
|
47
55
|
diff_args = opts || card.include_set_modules.diff_args
|
48
|
-
previous = raw_view previous_value(:content)
|
49
|
-
current = raw_view
|
50
|
-
|
56
|
+
previous = raw_view previous_value(:content)
|
57
|
+
current = raw_view
|
51
58
|
Card::Content::Diff.new previous, current, diff_args
|
52
59
|
end
|
53
60
|
end
|
54
|
-
|
55
|
-
def raw_view content, format=:text
|
56
|
-
original_content = card.db_content
|
57
|
-
card.db_content = content
|
58
|
-
card.format(format).render_raw
|
59
|
-
ensure
|
60
|
-
card.db_content = original_content
|
61
|
-
end
|
62
61
|
end
|
63
62
|
end
|
64
63
|
end
|
@@ -164,13 +164,17 @@ format :html do
|
|
164
164
|
%span.slotter
|
165
165
|
= paginate intr, remote: true, theme: 'twitter-bootstrap-3'
|
166
166
|
%div.history-legend
|
167
|
-
|
167
|
+
= glyphicon "plus-sign", "added-mark"
|
168
168
|
%span
|
169
169
|
= Card::Content::Diff.render_added_chunk('Added')
|
170
170
|
|
|
171
|
-
|
171
|
+
= glyphicon "minus-sign", "deleted-mark"
|
172
172
|
%span
|
173
|
-
= Card::Content::Diff.render_deleted_chunk('
|
173
|
+
= Card::Content::Diff.render_deleted_chunk('Removed')
|
174
|
+
|
|
175
|
+
= glyphicon "trash", "deleted-mark"
|
176
|
+
%span
|
177
|
+
card deleted
|
174
178
|
HAML
|
175
179
|
end
|
176
180
|
end
|
@@ -265,7 +269,7 @@ format :html do
|
|
265
269
|
def view_action action_view, args
|
266
270
|
action = args[:action] || card.last_action
|
267
271
|
hide_diff = args[:hide_diff] || hide_diff?
|
268
|
-
|
272
|
+
return trashed_view(action) if action.action_type == :delete
|
269
273
|
render_haml action: action,
|
270
274
|
action_view: action_view,
|
271
275
|
name_diff: name_diff(action, hide_diff),
|
@@ -275,8 +279,8 @@ format :html do
|
|
275
279
|
.action
|
276
280
|
.summary
|
277
281
|
%span.ampel
|
278
|
-
= glyphicon 'minus-sign', (action.red? ? '
|
279
|
-
= glyphicon 'plus-sign', (action.green? ? '
|
282
|
+
= glyphicon 'minus-sign', (action.red? ? 'deleted-mark' : 'diff-invisible')
|
283
|
+
= glyphicon 'plus-sign', (action.green? ? 'added-mark' : 'diff-invisible')
|
280
284
|
= wrap_diff :name, name_diff
|
281
285
|
= wrap_diff :type, type_diff
|
282
286
|
-if content_diff
|
@@ -290,6 +294,18 @@ format :html do
|
|
290
294
|
end
|
291
295
|
end
|
292
296
|
|
297
|
+
def trashed_view action
|
298
|
+
render_haml action: action do
|
299
|
+
<<-HAML.strip_heredoc
|
300
|
+
.action
|
301
|
+
.summary
|
302
|
+
%span.ampel
|
303
|
+
= glyphicon 'trash', 'deleted-mark'
|
304
|
+
= wrap_diff :name, action.card.name, ('label label-default' if action.card != card)
|
305
|
+
HAML
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
293
309
|
def name_diff action, hide_diff
|
294
310
|
if action.card == card
|
295
311
|
name_changes(action, hide_diff)
|
@@ -315,10 +331,10 @@ format :html do
|
|
315
331
|
)
|
316
332
|
end
|
317
333
|
|
318
|
-
def wrap_diff field, content
|
334
|
+
def wrap_diff field, content, extra_class=nil
|
319
335
|
return "" unless content.present?
|
320
336
|
%(
|
321
|
-
<span class="#{field}-diff">
|
337
|
+
<span class="#{field}-diff #{extra_class}">
|
322
338
|
#{content}
|
323
339
|
</span>
|
324
340
|
)
|
@@ -345,7 +361,7 @@ format :html do
|
|
345
361
|
|
346
362
|
view :content_changes do |args|
|
347
363
|
if args[:hide_diff]
|
348
|
-
args[:action].
|
364
|
+
args[:action].raw_view
|
349
365
|
else
|
350
366
|
args[:action].content_diff(args[:diff_type])
|
351
367
|
end
|
@@ -357,7 +373,8 @@ format :html do
|
|
357
373
|
act_seq: args[:act_seq],
|
358
374
|
hide_diff: args[:hide_diff],
|
359
375
|
act_context: args[:act_context],
|
360
|
-
action_view: (args[:action_view] == :expanded ? :summary : :expanded)
|
376
|
+
action_view: (args[:action_view] == :expanded ? :summary : :expanded),
|
377
|
+
look_in_trash: true
|
361
378
|
}
|
362
379
|
arrow_dir = args[:action_view] == :expanded ? "arrow-down" : "arrow-right"
|
363
380
|
view_link "", :act, path_opts: path_opts,
|
@@ -368,7 +385,8 @@ format :html do
|
|
368
385
|
not_current =
|
369
386
|
actions.select { |action| action.card.last_action_id != action.id }
|
370
387
|
return unless card.ok?(:update) && not_current.present?
|
371
|
-
link_path = path action: :update, view: :open, action_ids: not_current
|
388
|
+
link_path = path action: :update, view: :open, action_ids: not_current,
|
389
|
+
look_in_trash: true
|
372
390
|
link = link_to(
|
373
391
|
"Save as current", link_path,
|
374
392
|
class: "slotter", "data-slot-selector" => ".card-slot.history-view",
|
@@ -384,7 +402,8 @@ format :html do
|
|
384
402
|
act_seq: args[:act_seq],
|
385
403
|
hide_diff: !args[:hide_diff],
|
386
404
|
action_view: :expanded,
|
387
|
-
act_context: args[:act_context]
|
405
|
+
act_context: args[:act_context],
|
406
|
+
look_in_trash: true
|
388
407
|
}
|
389
408
|
link = view_link("#{toggle} changes", :act,
|
390
409
|
path_opts: path_opts, class: "slotter", remote: true)
|
@@ -623,14 +623,22 @@ $act-gray: #b7b7b7;
|
|
623
623
|
}
|
624
624
|
}
|
625
625
|
|
626
|
-
.
|
626
|
+
.deleted-mark {
|
627
|
+
color: $diff-red;
|
628
|
+
}
|
629
|
+
|
630
|
+
.added-mark {
|
631
|
+
color: $diff-green;
|
632
|
+
}
|
633
|
+
|
634
|
+
.diff-deleted {
|
627
635
|
text-decoration: line-through;
|
628
636
|
color: $diff-red;
|
629
637
|
img {
|
630
638
|
border: 2px solid $diff-red;
|
631
639
|
}
|
632
640
|
}
|
633
|
-
.diff-
|
641
|
+
.diff-added {
|
634
642
|
color: $diff-green;
|
635
643
|
img {
|
636
644
|
margin: 0px 4px 0px 4px;
|
@@ -16,9 +16,9 @@ describe Card::Set::All::History do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should have a summary" do
|
19
|
-
assert_view_select subject, 'del[class="diffdel diff-
|
19
|
+
assert_view_select subject, 'del[class="diffdel diff-deleted"]',
|
20
20
|
text: "chicken"
|
21
|
-
assert_view_select subject, 'ins[class="diffins diff-
|
21
|
+
assert_view_select subject, 'ins[class="diffins diff-added"]',
|
22
22
|
text: "chick"
|
23
23
|
end
|
24
24
|
end
|
data/spec/lib/card/diff_spec.rb
CHANGED
@@ -5,11 +5,11 @@ require "card/content/diff"
|
|
5
5
|
|
6
6
|
describe Card::Content::Diff do
|
7
7
|
def del text
|
8
|
-
"<del class='diffdel diff-
|
8
|
+
"<del class='diffdel diff-deleted'>#{text}</del>"
|
9
9
|
end
|
10
10
|
|
11
11
|
def ins text
|
12
|
-
"<ins class='diffins diff-
|
12
|
+
"<ins class='diffins diff-added'>#{text}</ins>"
|
13
13
|
end
|
14
14
|
|
15
15
|
def tag text
|