diff --git a/app/assets/stylesheets/cards.css b/app/assets/stylesheets/cards.css
index 4a5e318d7..1ffc3f740 100644
--- a/app/assets/stylesheets/cards.css
+++ b/app/assets/stylesheets/cards.css
@@ -97,6 +97,10 @@
}
}
+ .card--golden {
+ outline: 5px solid orange;
+ }
+
.card__actions {
position: absolute;
inset: var(--actions-block-inset) auto auto calc(var(--actions-inline-inset) * -1);
diff --git a/app/controllers/cards/goldenesses_controller.rb b/app/controllers/cards/goldenesses_controller.rb
new file mode 100644
index 000000000..974610569
--- /dev/null
+++ b/app/controllers/cards/goldenesses_controller.rb
@@ -0,0 +1,13 @@
+class Cards::GoldenessesController < ApplicationController
+ include CardScoped
+
+ def create
+ @card.promote_to_golden
+ redirect_to @card
+ end
+
+ def destroy
+ @card.demote_from_golden
+ redirect_to @card
+ end
+end
diff --git a/app/models/card.rb b/app/models/card.rb
index c58507125..46907bf3d 100644
--- a/app/models/card.rb
+++ b/app/models/card.rb
@@ -1,6 +1,7 @@
class Card < ApplicationRecord
- include Assignable, Boostable, Colored, Commentable, Engageable, Eventable,
- Messages, Notifiable, Pinnable, Closeable, Scorable, Searchable, Staged, Statuses, Taggable, Watchable
+ include Assignable, Boostable, Colored, Commentable, Engageable, Eventable, Golden,
+ Messages, Notifiable, Pinnable, Closeable, Scorable, Searchable, Staged,
+ Statuses, Taggable, Watchable
belongs_to :collection, touch: true
belongs_to :creator, class_name: "User", default: -> { Current.user }
diff --git a/app/models/card/golden.rb b/app/models/card/golden.rb
new file mode 100644
index 000000000..339b8cab6
--- /dev/null
+++ b/app/models/card/golden.rb
@@ -0,0 +1,22 @@
+module Card::Golden
+ extend ActiveSupport::Concern
+
+ included do
+ scope :golden, -> { joins(:goldness) }
+ scope :non_golden, -> { where.missing(:goldness) }
+
+ has_one :goldness, dependent: :destroy, class_name: "Card::Goldness"
+ end
+
+ def golden?
+ goldness.present?
+ end
+
+ def promote_to_golden
+ create_goldness! unless golden?
+ end
+
+ def demote_from_golden
+ goldness&.destroy
+ end
+end
diff --git a/app/models/card/goldness.rb b/app/models/card/goldness.rb
new file mode 100644
index 000000000..5ef88fc0b
--- /dev/null
+++ b/app/models/card/goldness.rb
@@ -0,0 +1,3 @@
+class Card::Goldness < ApplicationRecord
+ belongs_to :card
+end
diff --git a/app/views/cards/_golden_toggle.html.erb b/app/views/cards/_golden_toggle.html.erb
new file mode 100644
index 000000000..e1c475484
--- /dev/null
+++ b/app/views/cards/_golden_toggle.html.erb
@@ -0,0 +1,11 @@
+<% if @card.golden? %>
+ <%= button_to card_goldeness_path(@card), method: :delete, class: "btn btn--reversed" do %>
+ <%= icon_tag "star" %>
+ Demote to normal
+ <% end %>
+<% else %>
+ <%= button_to card_goldeness_path(@card), class: "btn" do %>
+ <%= icon_tag "star" %>
+ Promote to golden
+ <% end %>
+<% end %>
diff --git a/app/views/cards/display/_perma.html.erb b/app/views/cards/display/_perma.html.erb
index 4b205e33b..309a6dd86 100644
--- a/app/views/cards/display/_perma.html.erb
+++ b/app/views/cards/display/_perma.html.erb
@@ -1,5 +1,5 @@
<% cache card do %>
-