From 74b91c8832edb9b2ba08b2e689bb45597198d0d8 Mon Sep 17 00:00:00 2001 From: Adrien Maston Date: Wed, 25 Feb 2026 17:08:11 +0100 Subject: [PATCH] Add "show label" and "main action" attributes --- .../initializers/bridge/bridge_element.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/javascript/initializers/bridge/bridge_element.js b/app/javascript/initializers/bridge/bridge_element.js index 7ddeb1b33..29aa52549 100644 --- a/app/javascript/initializers/bridge/bridge_element.js +++ b/app/javascript/initializers/bridge/bridge_element.js @@ -1,10 +1,14 @@ import { BridgeElement } from "@hotwired/hotwire-native-bridge" BridgeElement.prototype.getButton = function() { - return { + const button = { title: this.title, - icon: this.getIcon() + icon: this.getIcon(), + showLabel: this.getShowLabel(), + isMainAction: this.getIsMainAction() } + console.log(button) + return button } BridgeElement.prototype.getIcon = function() { @@ -16,3 +20,11 @@ BridgeElement.prototype.getIcon = function() { return null } + +BridgeElement.prototype.getShowLabel = function() { + return !!this.bridgeAttribute(`show-label`) +} + +BridgeElement.prototype.getIsMainAction = function() { + return !!this.bridgeAttribute(`main-action`) +}