A platform for community discussion. Free, open, simple.
DEV: Allow `{{d-button}}` to include a href
Robin Ward86f3e747991b
diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6index c41ad2a53ee..2665e6e83b0 100644--- a/app/assets/javascripts/discourse/components/d-button.js.es6+++ b/app/assets/javascripts/discourse/components/d-button.js.es6@@ -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") {- this.sendAction("action", this.actionParam);- } else if (typeof this.action === "object" && this.action.value) {- this.action.value(this.actionParam);- } else if (typeof this.action === "function") {- this.action(this.actionParam);+ let { action } = this;++ if (action) {+ if (typeof action === "string") {+ this.sendAction("action", this.actionParam);+ } else if (typeof action === "object" && action.value) {+ action.value(this.actionParam);+ } else if (typeof this.action === "function") {+ action(this.actionParam);+ }+ }++ if (this.href && this.href.length) {+ DiscourseURL.routeTo(this.href);}return false;