diff --git a/app/javascript/controllers/bridge/stamp_controller.js b/app/javascript/controllers/bridge/stamp_controller.js index 6c04d3140..2be17dc35 100644 --- a/app/javascript/controllers/bridge/stamp_controller.js +++ b/app/javascript/controllers/bridge/stamp_controller.js @@ -14,6 +14,14 @@ export default class extends BridgeComponent { } notifyBridgeOfConnect() { - this.send("connect", this.bridgeElement.getStamp()) + this.send("connect", this.#data) + } + + get #data() { + const bridgeElement = this.bridgeElement + return { + title: bridgeElement.title, + description: bridgeElement.bridgeAttribute("description") ?? null + } } } diff --git a/app/javascript/initializers/bridge/bridge_element.js b/app/javascript/initializers/bridge/bridge_element.js index b118c9265..76f0db8a7 100644 --- a/app/javascript/initializers/bridge/bridge_element.js +++ b/app/javascript/initializers/bridge/bridge_element.js @@ -9,14 +9,6 @@ BridgeElement.prototype.getButton = function() { } } -BridgeElement.prototype.getStamp = function() { - return { - title: this.title, - date: this.getDate(), - closedBy: this.getClosedBy() - } -} - BridgeElement.prototype.getIcon = function() { const url = this.bridgeAttribute("icon-url") @@ -27,14 +19,6 @@ BridgeElement.prototype.getIcon = function() { return null } -BridgeElement.prototype.getDate = function() { - return this.bridgeAttribute("date") ?? null -} - -BridgeElement.prototype.getClosedBy = function() { - return this.bridgeAttribute("closed-by") ?? null -} - BridgeElement.prototype.getDisplayTitle = function() { return !!this.bridgeAttribute("display-title") } diff --git a/app/views/cards/display/common/_stamp.html.erb b/app/views/cards/display/common/_stamp.html.erb index 75c11ad4a..3416fff59 100644 --- a/app/views/cards/display/common/_stamp.html.erb +++ b/app/views/cards/display/common/_stamp.html.erb @@ -2,8 +2,7 @@ <%= tag.div class: token_list("card__closed", "card__closed--system": card.postponed_by&.system?), data: { controller: "bridge--stamp", bridge_title: "Not Now", - bridge_date: card.postponed_at.strftime("%b %d, %Y"), - bridge_closed_by: card.postponed_by&.familiar_name + bridge_description: card.postponed_at.strftime("%b %d, %Y") } do %> Not Now <%= card.postponed_at.strftime("%b %d, %Y") %> @@ -15,8 +14,7 @@ <%= tag.div class: "card__closed", data: { controller: "bridge--stamp", bridge_title: "Done", - bridge_date: card.closed_at.strftime("%b %d, %Y"), - bridge_closed_by: card.closed_by.familiar_name + bridge_description: card.closed_at.strftime("%b %d, %Y") } do %> Done <%= card.closed_at.strftime("%b %d, %Y") %>