From 0022d192d0b0a07bba99d48d065bbd93246f9be3 Mon Sep 17 00:00:00 2001 From: Seyi Adebajo Date: Mon, 13 Feb 2017 11:45:02 -0800 Subject: [PATCH] Add nav-link component template and component script for bootstrap nav link --- wherehows-web/app/components/nav-link.js | 20 +++++++++++++++++++ .../app/templates/components/nav-link.hbs | 1 + 2 files changed, 21 insertions(+) create mode 100644 wherehows-web/app/components/nav-link.js create mode 100644 wherehows-web/app/templates/components/nav-link.hbs diff --git a/wherehows-web/app/components/nav-link.js b/wherehows-web/app/components/nav-link.js new file mode 100644 index 0000000000..f1a3819030 --- /dev/null +++ b/wherehows-web/app/components/nav-link.js @@ -0,0 +1,20 @@ +import Ember from 'ember'; + +export default Ember.LinkComponent.extend({ + tagName: 'li', + + attributeBindings: ['data-toggle', 'data-target'], + + hrefForA: Ember.computed('models', 'qualifiedRouteName', function () { + let qualifiedRouteName = this.get('qualifiedRouteName'); + let models = this.get('models'); + + if (this.get('loading')) { + return this.get('loadingHref'); + } + + let routing = this.get('_routing'); + let queryParams = this.get('queryParams.values'); + return routing.generateURL(qualifiedRouteName, models, queryParams); + }) +}); diff --git a/wherehows-web/app/templates/components/nav-link.hbs b/wherehows-web/app/templates/components/nav-link.hbs new file mode 100644 index 0000000000..61209dfaa2 --- /dev/null +++ b/wherehows-web/app/templates/components/nav-link.hbs @@ -0,0 +1 @@ +{{yield}} \ No newline at end of file