From 919839fd970f29ecb2ee5a772bb63489cd2fa096 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 25 Feb 2019 09:49:49 +0100 Subject: [PATCH] FIX: allows {{d-button}} to set a form attribute (#7056) This attribute is used when a submit button is out of a form. It makes it explicit which form this button is submitting. It's currently used in our login modal form. --- .../javascripts/discourse/components/d-button.js.es6 | 3 +++ .../javascripts/discourse/templates/modal/login.hbs | 12 +++++++----- test/javascripts/components/d-button-test.js.es6 | 8 ++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6 index 8b964299d85..7fbf32bc184 100644 --- a/app/assets/javascripts/discourse/components/d-button.js.es6 +++ b/app/assets/javascripts/discourse/components/d-button.js.es6 @@ -4,9 +4,12 @@ export default Ember.Component.extend({ // subclasses need this layoutName: "components/d-button", + form: null, + tagName: "button", classNameBindings: [":btn", "noText", "btnType"], attributeBindings: [ + "form", "disabled", "translatedTitle:title", "translatedLabel:aria-label", diff --git a/app/assets/javascripts/discourse/templates/modal/login.hbs b/app/assets/javascripts/discourse/templates/modal/login.hbs index ef9742be6e9..ae8d27a42f7 100644 --- a/app/assets/javascripts/discourse/templates/modal/login.hbs +++ b/app/assets/javascripts/discourse/templates/modal/login.hbs @@ -37,11 +37,13 @@