card 1.96.7 → 1.96.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +2 -2
  4. data/db/migrate_core_cards/20130823192433_add_style_cards.rb +5 -5
  5. data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +1 -1
  6. data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +1 -1
  7. data/db/migrate_core_cards/20131016172445_common_css_patch.rb +1 -1
  8. data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +1 -1
  9. data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +1 -1
  10. data/db/migrate_core_cards/20140512155840_add_script_cards.rb +1 -1
  11. data/db/migrate_core_cards/20140629222005_add_email_cards.rb +2 -2
  12. data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +1 -1
  13. data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +1 -1
  14. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +4 -4
  15. data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +1 -1
  16. data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +3 -3
  17. data/db/migrate_core_cards/20150331135745_new_card_menu.rb +1 -1
  18. data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +1 -1
  19. data/db/migrate_core_cards/20150510031118_fix_skin_codenames.rb +1 -1
  20. data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +1 -1
  21. data/db/migrate_core_cards/20150627205133_fix_script_bootstrap_card_type.rb +1 -1
  22. data/db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb +1 -1
  23. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +2 -2
  24. data/db/migrate_core_cards/20150824135418_update_file_history.rb +1 -1
  25. data/db/migrate_core_cards/20150910085603_remove_performance_log_card.rb +1 -1
  26. data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +1 -1
  27. data/db/migrate_core_cards/20160811115836_rename_stats_to_admin.rb +1 -1
  28. data/db/migrate_core_cards/20170830210517_correct_signup_success_message.rb +1 -1
  29. data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +0 -9
  30. data/db/seed/test/seed.rb +3 -3
  31. data/lib/card/act_manager.rb +1 -1
  32. data/lib/card/cache.rb +5 -1
  33. data/lib/card/codename.rb +1 -1
  34. data/lib/card/model/save_helper.rb +3 -4
  35. data/lib/card/query.rb +15 -9
  36. data/lib/card/query/abstract_query/tie.rb +1 -0
  37. data/lib/card/query/card_query/interpretation.rb +1 -1
  38. data/lib/card/query/card_query/match_attributes.rb +2 -2
  39. data/lib/card/query/card_query/normalization.rb +6 -3
  40. data/lib/card/query/value.rb +3 -2
  41. data/lib/card/set/event/delayed_event.rb +1 -0
  42. data/mod/account/set/right/account.rb +4 -12
  43. data/mod/account/set/type/signup.rb +4 -0
  44. data/mod/account/spec/set/all/account_spec.rb +3 -3
  45. data/mod/account/spec/set/right/account_spec.rb +27 -20
  46. data/mod/account/spec/set/right/email_spec.rb +3 -3
  47. data/mod/account/spec/set/right/password_spec.rb +4 -5
  48. data/mod/account/spec/set/self/signin_spec.rb +8 -9
  49. data/mod/account/spec/set/type/signup_spec.rb +3 -3
  50. data/mod/admin/spec/set/self/admin_spec.rb +4 -4
  51. data/mod/bootstrap/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +2 -2
  52. data/mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb +1 -1
  53. data/mod/bootstrap/db/migrate_core_cards/20180601133753_migrate_skins.rb +1 -1
  54. data/mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb +2 -2
  55. data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +3 -0
  56. data/mod/bootstrap/set/abstract/bootswatch_theme.rb +1 -1
  57. data/mod/bootstrap/spec/set/type/bootswatch_skin_spec.rb +1 -1
  58. data/mod/bootstrap/spec/set/type/customized_bootswatch_skin_spec.rb +1 -1
  59. data/mod/carrierwave/lib/carrier_wave/file_card_uploader.rb +2 -2
  60. data/mod/carrierwave/set/abstract/attachment.rb +1 -1
  61. data/mod/carrierwave/set/abstract/attachment/storage_type.rb +2 -2
  62. data/mod/carrierwave/set/abstract/attachment/upload_cache.rb +2 -2
  63. data/mod/carrierwave/spec/set/type/file_spec.rb +9 -12
  64. data/mod/carrierwave/spec/set/type/image_spec.rb +2 -2
  65. data/mod/core/set/all/actify.rb +5 -2
  66. data/mod/core/set/all/cache.rb +1 -1
  67. data/mod/core/set/all/content.rb +12 -30
  68. data/mod/core/set/all/contextual_content.rb +28 -0
  69. data/mod/core/set/all/name.rb +1 -1
  70. data/mod/core/set/all/rules.rb +1 -0
  71. data/mod/core/set/all/trash.rb +2 -2
  72. data/mod/core/set/all/utils.rb +2 -2
  73. data/mod/core/spec/set/all/actify_spec.rb +45 -2
  74. data/mod/core/spec/set/all/codename_spec.rb +2 -2
  75. data/mod/core/spec/set/all/event_conditions_spec.rb +15 -16
  76. data/mod/core/spec/set/all/name_events_spec.rb +2 -2
  77. data/mod/core/spec/set/all/observer_spec.rb +1 -1
  78. data/mod/core/spec/set/all/permissions_spec.rb +3 -3
  79. data/mod/core/spec/set/all/references_spec.rb +1 -1
  80. data/mod/core/spec/set/all/rename_spec.rb +2 -2
  81. data/mod/core/spec/set/all/trash_spec.rb +1 -1
  82. data/mod/follow/set/all/follow/follow_link.rb +7 -1
  83. data/mod/follow/spec/set/all/notify_spec.rb +2 -2
  84. data/mod/follow/spec/set/right/account_spec.rb +2 -2
  85. data/mod/follow/spec/set/right/followers_spec.rb +2 -2
  86. data/mod/follow/spec/set/self/follow_defaults_spec.rb +1 -1
  87. data/mod/follow/spec/set/type/notification_template_spec.rb +1 -1
  88. data/mod/history/set/all/history.rb +1 -1
  89. data/mod/history/set/all/history/act_listing.rb +2 -1
  90. data/mod/history/set/all/history/events.rb +3 -3
  91. data/mod/machines/lib/stylesheets/style_cards.scss +17 -16
  92. data/mod/machines/set/abstract/machine.rb +3 -2
  93. data/mod/machines/set/abstract/machine/output_cache.rb +1 -1
  94. data/mod/machines/set/abstract/machine_input.rb +1 -1
  95. data/mod/machines/spec/set/right/machine_cache_spec.rb +2 -2
  96. data/mod/machines/spec/set/type/skin_spec.rb +2 -2
  97. data/mod/pointer/spec/set/abstract/pointer/events_spec.rb +2 -2
  98. data/mod/search/set/abstract/01_filter_form_helper.rb +5 -1
  99. data/mod/search/set/abstract/search/views.rb +1 -1
  100. data/mod/settings/spec/set/right/comment_spec.rb +1 -1
  101. data/mod/solid_cache/set/right/solid_cache.rb +1 -1
  102. data/mod/solid_cache/spec/set/abstract/solid_cache_spec.rb +4 -4
  103. data/mod/standard/set/self/activity_toolbar_button.rb +1 -1
  104. data/mod/standard/spec/content/chunk/include_spec.rb +1 -1
  105. data/mod/standard/spec/set/all/history_spec.rb +5 -5
  106. data/mod/standard/spec/set/type/email_template/email_config_spec.rb +2 -2
  107. data/mod/standard/spec/set/type/list_spec.rb +9 -9
  108. data/mod/standard/spec/set/type/listed_by_spec.rb +9 -9
  109. data/mod/standard/spec/set/type/search_type_spec.rb +2 -3
  110. data/mod/virtual/lib/card/virtual.rb +1 -1
  111. data/mod/virtual/set/abstract/virtual_cache.rb +2 -2
  112. metadata +5 -4
@@ -3,13 +3,13 @@ describe Card::Set::All::Codename do
3
3
  let(:card) { Card["a"] }
4
4
 
5
5
  it "requires admin permission" do
6
- card.update_attributes codename: "structure"
6
+ card.update codename: "structure"
7
7
  expect(card.errors[:codename].first).to match(/only admins/)
8
8
  end
9
9
 
10
10
  it "checks uniqueness" do
11
11
  Card::Auth.as_bot do
12
- card.update_attributes codename: "structure"
12
+ card.update codename: "structure"
13
13
  expect(card.errors[:codename].first).to match(/already in use/)
14
14
  end
15
15
  end
@@ -18,7 +18,7 @@ RSpec.describe Card::Set::All::EventConditions do
18
18
  end
19
19
 
20
20
  def change_content
21
- Card["A"].update_attributes! content: "changed content"
21
+ Card["A"].update! content: "changed content"
22
22
  end
23
23
 
24
24
  before do
@@ -57,12 +57,11 @@ RSpec.describe Card::Set::All::EventConditions do
57
57
  test_event :validate, on: :update, trigger: :required, for: "A" do
58
58
  add_to_log "triggered"
59
59
  end
60
- Card["A"].update_attributes! content: "changed content"
60
+ Card["A"].update! content: "changed content"
61
61
 
62
62
  aggregate_failures do
63
63
  expect(@log).to be_empty
64
- Card["A"].update_attributes! content: "changed content",
65
- trigger: :test_event_0
64
+ Card["A"].update! content: "changed content", trigger: :test_event_0
66
65
  expect(@log).to contain_exactly "triggered"
67
66
  end
68
67
  end
@@ -75,11 +74,11 @@ RSpec.describe Card::Set::All::EventConditions do
75
74
  test_event :validate, on: :update, skip: :allowed, for: "A" do
76
75
  add_to_log "executed"
77
76
  end
78
- Card["A"].update_attributes! content: "changed content", skip: :test_event_0
77
+ Card["A"].update! content: "changed content", skip: :test_event_0
79
78
 
80
79
  aggregate_failures do
81
80
  expect(@log).to be_empty
82
- Card["A"].update_attributes! content: "changed content"
81
+ Card["A"].update! content: "changed content"
83
82
  expect(@log).to contain_exactly "executed"
84
83
  end
85
84
  end
@@ -90,14 +89,14 @@ RSpec.describe Card::Set::All::EventConditions do
90
89
  test_event :validate, on: :update, skip: :allowed, for: "A+B" do
91
90
  add_to_log "not skipped"
92
91
  end
93
- Card["A"].update_attributes! content: "changed content",
94
- skip: :test_event_0,
95
- subcards: { "+B" => "changed +B content" }
92
+ Card["A"].update! content: "changed content",
93
+ skip: :test_event_0,
94
+ subcards: { "+B" => "changed +B content" }
96
95
 
97
96
  aggregate_failures do
98
97
  expect(@log).to be_empty
99
- Card["A"].update_attributes! content: "changed content",
100
- subcards: { "+B" => "changed +B content" }
98
+ Card["A"].update! content: "changed content",
99
+ subcards: { "+B" => "changed +B content" }
101
100
  expect(@log).to contain_exactly "not skipped"
102
101
  end
103
102
  end
@@ -108,14 +107,14 @@ RSpec.describe Card::Set::All::EventConditions do
108
107
  test_event :validate, on: :update, skip: :allowed do
109
108
  add_to_log "#{name} not skipped"
110
109
  end
111
- Card["A"].update_attributes! content: "changed content",
112
- skip_in_action: :test_event_0,
113
- subcards: { "+B" => "changed +B content" }
110
+ Card["A"].update! content: "changed content",
111
+ skip_in_action: :test_event_0,
112
+ subcards: { "+B" => "changed +B content" }
114
113
 
115
114
  aggregate_failures do
116
115
  expect(@log).to contain_exactly "A+B not skipped"
117
- Card["A"].update_attributes! content: "changed content",
118
- subcards: { "+B" => "changed +B content" }
116
+ Card["A"].update! content: "changed content",
117
+ subcards: { "+B" => "changed +B content" }
119
118
  expect(@log).to contain_exactly "A+B not skipped",
120
119
  "A not skipped",
121
120
  "A+B not skipped"
@@ -2,7 +2,7 @@ describe Card::Set::All::NameEvents do
2
2
  describe "event: set_name" do
3
3
  it "handles case variants" do
4
4
  c = Card.create! name: "chump"
5
- c.update_attributes! name: "Chump"
5
+ c.update! name: "Chump"
6
6
  expect(c.name).to eq("Chump")
7
7
  end
8
8
 
@@ -10,7 +10,7 @@ describe Card::Set::All::NameEvents do
10
10
  let(:card) { Card.create! name: "four+five" }
11
11
 
12
12
  before do
13
- card.update_attributes! name: "nine"
13
+ card.update! name: "nine"
14
14
  end
15
15
 
16
16
  it "assigns the cardname" do
@@ -19,7 +19,7 @@ describe Card::Set::All::Observer do
19
19
  content: "[[mail template]]"
20
20
  end
21
21
  card = Card.fetch "mail test"
22
- expect { Card::Auth.as_bot { card.update_attributes(content: "test") } }
22
+ expect { Card::Auth.as_bot { card.update(content: "test") } }
23
23
  .to change { Mail::TestMailer.deliveries.count }.by(1)
24
24
  end
25
25
 
@@ -227,7 +227,7 @@ RSpec.describe Card::Set::All::Permissions do
227
227
  # set up cards of type TestType, 2 with nil reader, 1 with role1 reader
228
228
  Card::Auth.as_bot do
229
229
  [@c1, @c2, @c3].each do |c|
230
- c.update_attributes content: "WeirdWord"
230
+ c.update content: "WeirdWord"
231
231
  end
232
232
  Card.create(name: "c1+*self+*read", type: "Pointer", content: "[[u1]]")
233
233
  end
@@ -251,7 +251,7 @@ RSpec.describe Card::Set::All::Permissions do
251
251
  # set up cards of type TestType, 2 with nil reader, 1 with role1 reader
252
252
  Card::Auth.as_bot do
253
253
  [@c1, @c2, @c3].each do |c|
254
- c.update_attributes content: "WeirdWord"
254
+ c.update content: "WeirdWord"
255
255
  end
256
256
  Card.create(name: "c1+*self+*read", type: "Pointer", content: "[[r3]]")
257
257
  end
@@ -374,7 +374,7 @@ RSpec.describe Card::Set::All::Permissions do
374
374
  example "changing cardtype needs new cardtype's create permission", with_user: "u2" do
375
375
  # u3 can update but not create cardtype b
376
376
  c = Card["basicname"]
377
- c.update_attributes type: "cardtype_b"
377
+ c.update type: "cardtype_b"
378
378
 
379
379
  expect(c.errors[:permission_denied])
380
380
  .to include(/You don't have permission to change to this type/)
@@ -46,7 +46,7 @@ RSpec.describe Card::Set::All::References do
46
46
 
47
47
  describe "event :update_referer_content" do
48
48
  it "handles self references" do
49
- Card["A"].update_attributes! name: "AAA", update_referers: true
49
+ Card["A"].update! name: "AAA", update_referers: true
50
50
  expect(Card["X"].content).to eq("[[AAA]] [[AAA+B]] [[T]]")
51
51
  end
52
52
  end
@@ -107,7 +107,7 @@ RSpec.describe Card::Set::All::Rename do
107
107
  end
108
108
 
109
109
  c = Card["Joe Card"]
110
- c.update_attributes! name: "Card of Joe", update_referers: true
110
+ c.update! name: "Card of Joe", update_referers: true
111
111
  assert_equal "[[Card of Joe]]", Card["Admin Card"].content
112
112
  end
113
113
 
@@ -118,7 +118,7 @@ RSpec.describe Card::Set::All::Rename do
118
118
  Card.create! name: "Fruit+*type+*structure", content: "this [[Pit]]"
119
119
 
120
120
  assert_equal "this [[Pit]]", Card["Orange"].content
121
- c.update_attributes! name: "Seed", update_referers: true
121
+ c.update! name: "Seed", update_referers: true
122
122
  assert_equal "this [[Seed]]", Card["Orange"].content
123
123
  end
124
124
  end
@@ -66,7 +66,7 @@ describe Card::Set::All::Trash do
66
66
  # @signup =
67
67
  # create_signup "born to die",
68
68
  # "+*account" => { "+*email" => "wolf@wagn.org", "+*password" => "wolf" }
69
- # @signup.update_attributes!({})
69
+ # @signup.update!({})
70
70
  # Card::Cache.reset_all
71
71
  #
72
72
  # Card::Auth.as_bot do
@@ -1,6 +1,12 @@
1
1
  format do
2
2
  def show_follow?
3
- Auth.signed_in? && !card.new_card? && card.followable?
3
+ follower? && !card.new_card? && card.followable?
4
+ end
5
+
6
+ def follower?
7
+ # only User cards can follow until preferences are generalized to all
8
+ # accounted cards.
9
+ Auth.signed_in? && Auth.current.type_id == UserID
4
10
  end
5
11
 
6
12
  def follow_link_hash
@@ -149,11 +149,11 @@ RSpec.describe Card::Set::All::Notify do
149
149
  end
150
150
 
151
151
  def update card_name, new_content="updated content"
152
- Card[card_name].update_attributes! content: new_content
152
+ Card[card_name].update! content: new_content
153
153
  end
154
154
 
155
155
  def update_name card_name, new_name="updated content"
156
- Card[card_name].update_attributes! name: new_name, update_referers: true
156
+ Card[card_name].update! name: new_name, update_referers: true
157
157
  end
158
158
 
159
159
  def self.notify_on_create user, trigger, create_name
@@ -32,8 +32,8 @@ describe "#send_change_notice" do
32
32
  u2.add_item "A"
33
33
 
34
34
  a = Card.fetch "A"
35
- a.update_attributes(content: "new content",
36
- subcards: { "+B" => { content: "hidden content" } })
35
+ a.update content: "new content",
36
+ subcards: { "+B" => { content: "hidden content" } }
37
37
  end
38
38
 
39
39
  it "sends no email if changes not visible" do
@@ -39,7 +39,7 @@ RSpec.describe Card::Set::Right::Followers do
39
39
  it "recognizes card name changes" do
40
40
  card = Card["Look At Me"]
41
41
  card.update_referers = true
42
- card.update_attributes! name: "Look away"
42
+ card.update! name: "Look away"
43
43
  expect(followers_of(card)).to eq ["Big Brother"]
44
44
  end
45
45
 
@@ -96,7 +96,7 @@ RSpec.describe Card::Set::Right::Followers do
96
96
 
97
97
  card = Card.create! name: "edited by Sara"
98
98
  Card::Auth.current_id = Card["Sara"].id
99
- card.update_attributes! content: "some content"
99
+ card.update! content: "some content"
100
100
  expect(followers_of(card)).to include("Sara")
101
101
  end
102
102
  end
@@ -6,7 +6,7 @@ describe Card::Set::Self::FollowDefaults do
6
6
  Card::Auth.as_bot do
7
7
  card = Card[:follow_defaults]
8
8
  card.update_all_users = true
9
- card.update_attributes! content: "[[A+*self+*always]]"
9
+ card.update! content: "[[A+*self+*always]]"
10
10
  end
11
11
  end
12
12
 
@@ -27,7 +27,7 @@ RSpec.describe Card::Set::Type::NotificationTemplate do
27
27
  it "is called on update" do
28
28
  notify_card = Card["success"]
29
29
  allow(notify_card).to receive(:deliver)
30
- Card["A"].update_attributes! content: "change"
30
+ Card["A"].update! content: "change"
31
31
  expect(notify_card).to have_received(:deliver).once
32
32
  end
33
33
  end
@@ -39,7 +39,7 @@ end
39
39
  def make_last_action_the_initial_action
40
40
  delete_all_changes
41
41
  old_actions.delete_all
42
- last_action.update_attributes! action_type: :create
42
+ last_action.update! action_type: :create
43
43
  end
44
44
 
45
45
  def clear_history
@@ -23,8 +23,9 @@ format :html do
23
23
  end
24
24
 
25
25
  def act_list acts, context
26
+ fmt = context == :relative ? self : act.card.format(:html)
26
27
  act_accordion acts, context do |act, seq|
27
- act.card.format(:html).act_listing act, seq, context
28
+ fmt.act_listing act, seq, context
28
29
  end
29
30
  end
30
31
 
@@ -33,7 +33,7 @@ end
33
33
  # removes the action if there are no changes
34
34
  event :finalize_action, :finalize, when: :finalize_action? do
35
35
  if changed_fields.present?
36
- @current_action.update_attributes! card_id: id
36
+ @current_action.update! card_id: id
37
37
 
38
38
  # Note: #last_change_on uses the id to sort by date
39
39
  # so the changes for the create changes have to be created before the first change
@@ -75,13 +75,13 @@ end
75
75
  event :rollback_actions, :prepare_to_validate, on: :update, when: :rollback_request? do
76
76
  update_args = process_revert_actions
77
77
  Env.params["revert_actions"] = nil
78
- update_attributes! update_args
78
+ update! update_args
79
79
  clear_drafts
80
80
  abort :success
81
81
  end
82
82
 
83
83
  event :finalize_act, after: :finalize_action, when: :act_card? do
84
- Card::ActManager.act.update_attributes! card_id: id
84
+ Card::ActManager.act.update! card_id: id
85
85
  end
86
86
 
87
87
  event :remove_empty_act, :integrate_with_delay_final, when: :remove_empty_act? do
@@ -259,11 +259,13 @@ $d-yellow-2: #ffa;
259
259
  display: inline;
260
260
  }
261
261
 
262
-
263
262
  .navbox-item-label {
264
263
  float: left;
265
264
  position: relative;
266
265
  }
266
+ .navbox-item-value mark {
267
+ padding: 0.2em 0;
268
+ }
267
269
 
268
270
 
269
271
  /*-- misc --*/
@@ -888,24 +890,23 @@ html>body .open-view {
888
890
  }
889
891
  }
890
892
 
891
- .closed-content a.external-link,
892
893
  a.external-link {
893
- color: #03998d !important;
894
- background: none !important;
895
- padding-right: 2px !important;
896
- position: relative;
894
+ // color: $warning;
895
+ &:after {
896
+ content: "\f08e";
897
+ right: -2px;
898
+ position: relative;
899
+ bottom: 4px;
900
+ font-family: fontAwesome;
901
+ font-size: 8px;
902
+ text-decoration: none !important;
903
+ display: inline;
904
+ }
897
905
  }
898
906
 
899
- .closed-content a.external-link:after,
900
- a.external-link:after {
901
- content: "\f08e";
902
- right: -2px;
903
- position: relative;
904
- bottom: 4px;
905
- font-family: fontAwesome;
906
- font-size: 8px;
907
- text-decoration: none !important;
908
- display: inline;
907
+ a.external-link,
908
+ .closed-content a.external-link {
909
+ padding-right: 2px !important;
909
910
  }
910
911
 
911
912
  /*-------------------------- */
@@ -164,8 +164,9 @@ end
164
164
  def make_machine_output_coded mod=:machines
165
165
  update_machine_output
166
166
  Card::Auth.as_bot do
167
- machine_output_card.update_attributes! storage_type: :coded, mod: mod,
168
- codename: machine_output_codename
167
+ machine_output_card.update! storage_type: :coded,
168
+ mod: mod,
169
+ codename: machine_output_codename
169
170
  end
170
171
  end
171
172
 
@@ -11,6 +11,6 @@ def cache_output_part input_card, output
11
11
  input_card.save! if input_card.new_card?
12
12
 
13
13
  cache_card = fetch_cache_card(input_card, true)
14
- cache_card.update_attributes! content: output
14
+ cache_card.update! content: output
15
15
  end
16
16
  end
@@ -67,6 +67,6 @@ def expire_machine_cache
67
67
  return: :name).each do |machine_name|
68
68
  cache_card = Card.fetch(name, machine_name, :machine_cache)
69
69
  next unless cache_card&.content?
70
- Auth.as_bot { cache_card.update_attributes! trash: true }
70
+ Auth.as_bot { cache_card.update! trash: true }
71
71
  end
72
72
  end
@@ -24,7 +24,7 @@ RSpec.describe Card::Set::Right::MachineCache, as_bot: true do
24
24
  end
25
25
 
26
26
  def update_virtual
27
- Card.fetch(:all, :machine_cache).update_attributes! content: virtual_content
27
+ Card.fetch(:all, :machine_cache).update! content: virtual_content
28
28
  end
29
29
 
30
30
  context "when content is updated" do
@@ -41,7 +41,7 @@ RSpec.describe Card::Set::Right::MachineCache, as_bot: true do
41
41
  before do
42
42
  create_virtual
43
43
  card = Card.fetch(:all, :machine_cache)
44
- card.update_attributes! trash: true
44
+ card.update! trash: true
45
45
  end
46
46
 
47
47
  it "deletes content in virtual table" do
@@ -49,9 +49,9 @@ describe Card::Set::Type::Skin do
49
49
  skin.putty
50
50
 
51
51
  Card::Auth.as_bot do
52
- Card["skin_item"].update_attributes content: changed_css
52
+ Card["skin_item"].update content: changed_css
53
53
  machine.machine_output_url
54
- Card["skin_item"].update_attributes content: new_css
54
+ Card["skin_item"].update content: new_css
55
55
  end
56
56
  updated_machine = Card.gimme machine.name
57
57
  path = updated_machine.machine_output_path
@@ -5,7 +5,7 @@ describe Card::Set::Abstract::Pointer do
5
5
  end
6
6
 
7
7
  def pointer_update content
8
- -> { Card["tp"].update_attributes! content: content }
8
+ -> { Card["tp"].update! content: content }
9
9
  end
10
10
 
11
11
  describe "#added_item_names" do
@@ -72,7 +72,7 @@ describe Card::Set::Abstract::Pointer do
72
72
 
73
73
  describe "#standardize_item" do
74
74
  it "handles unlinked items" do
75
- pointer.update_attributes! content: "bracketme"
75
+ pointer.update! content: "bracketme"
76
76
  expect(pointer.content).to eq("[[bracketme]]")
77
77
  end
78
78
 
@@ -83,6 +83,10 @@ format :html do
83
83
  type_card = Card[type_codename]
84
84
  res = Card.search type_id: type_card.id, return: :name, sort: "name", dir: order
85
85
  return res unless max_length
86
- res.map { |i| i.size > max_length ? "#{i[0..max_length]}..." : i }
86
+ res.map { |i| [trim_option(i, max_length), i] }
87
+ end
88
+
89
+ def trim_option option, max_length
90
+ option.size > max_length ? "#{option[0..max_length]}..." : option
87
91
  end
88
92
  end