mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 19:38:24 +00:00
DEV: Allow {{d-button}}
to include a href
This commit is contained in:
parent
62345a7f8d
commit
86f3e74799
@ -1,4 +1,5 @@
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
|
||||
export default Ember.Component.extend({
|
||||
// subclasses need this
|
||||
@ -53,12 +54,20 @@ export default Ember.Component.extend({
|
||||
},
|
||||
|
||||
click() {
|
||||
if (typeof this.action === "string") {
|
||||
let { action } = this;
|
||||
|
||||
if (action) {
|
||||
if (typeof action === "string") {
|
||||
this.sendAction("action", this.actionParam);
|
||||
} else if (typeof this.action === "object" && this.action.value) {
|
||||
this.action.value(this.actionParam);
|
||||
} else if (typeof action === "object" && action.value) {
|
||||
action.value(this.actionParam);
|
||||
} else if (typeof this.action === "function") {
|
||||
this.action(this.actionParam);
|
||||
action(this.actionParam);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.href && this.href.length) {
|
||||
DiscourseURL.routeTo(this.href);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user