mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 02:04:10 +08:00
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.
This commit is contained in:
parent
9faf058120
commit
919839fd97
@ -4,9 +4,12 @@ export default Ember.Component.extend({
|
|||||||
// subclasses need this
|
// subclasses need this
|
||||||
layoutName: "components/d-button",
|
layoutName: "components/d-button",
|
||||||
|
|
||||||
|
form: null,
|
||||||
|
|
||||||
tagName: "button",
|
tagName: "button",
|
||||||
classNameBindings: [":btn", "noText", "btnType"],
|
classNameBindings: [":btn", "noText", "btnType"],
|
||||||
attributeBindings: [
|
attributeBindings: [
|
||||||
|
"form",
|
||||||
"disabled",
|
"disabled",
|
||||||
"translatedTitle:title",
|
"translatedTitle:title",
|
||||||
"translatedLabel:aria-label",
|
"translatedLabel:aria-label",
|
||||||
|
@ -37,11 +37,13 @@
|
|||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
{{#if canLoginLocal}}
|
{{#if canLoginLocal}}
|
||||||
{{d-button action=(action "login")
|
{{d-button
|
||||||
icon="unlock"
|
action=(action "login")
|
||||||
label=loginButtonLabel
|
form="login-form"
|
||||||
disabled=loginDisabled
|
icon="unlock"
|
||||||
class='btn btn-large btn-primary'}}
|
label=loginButtonLabel
|
||||||
|
disabled=loginDisabled
|
||||||
|
class='btn btn-large btn-primary'}}
|
||||||
|
|
||||||
{{#if showSignupLink}}
|
{{#if showSignupLink}}
|
||||||
<button class="btn btn-large" id="new-account-link" {{action "createAccount"}}>
|
<button class="btn btn-large" id="new-account-link" {{action "createAccount"}}>
|
||||||
|
@ -35,3 +35,11 @@ componentTest("text only button", {
|
|||||||
assert.ok(this.$("button span.d-button-label").length, "it has the label");
|
assert.ok(this.$("button span.d-button-label").length, "it has the label");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
componentTest("form attribute", {
|
||||||
|
template: '{{d-button form="login-form"}}',
|
||||||
|
|
||||||
|
test(assert) {
|
||||||
|
assert.ok(exists("button[form=login-form]"), "it has the form attribute");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user