Set location filter label
authorChloe Laisne <chloe.laisne@gmail.com>
Thu, 23 Jun 2016 11:35:26 +0200
changeset 199 b7c691c6179d
parent 198 541e26eb356f
child 200 a441c40f9c5e
Set location filter label Fix query parameters when navigating through tabs
cms/app-client/app/index.html
cms/app-client/app/router.js
cms/app-client/app/routes/application.js
cms/app-client/app/styles/components/filter-component.scss
cms/app-client/app/templates/components/filter-component.hbs
--- a/cms/app-client/app/index.html	Thu Jun 23 10:41:57 2016 +0200
+++ b/cms/app-client/app/index.html	Thu Jun 23 11:35:26 2016 +0200
@@ -33,7 +33,6 @@
 
     <div id="corpus-app" class="corpus-app"></div>
 
-    <!--script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['treemap']}]}"></script-->
     <script src="assets/vendor.js"></script>
     <script src="assets/app-client.js"></script>
     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
--- a/cms/app-client/app/router.js	Thu Jun 23 10:41:57 2016 +0200
+++ b/cms/app-client/app/router.js	Thu Jun 23 11:35:26 2016 +0200
@@ -14,9 +14,4 @@
   this.route('tabs/chrono', { path: '/chronologie' });
 });
 
-Router.reopen({
-  onUrlChange: function() {
-  }.observes('currentPath')
-});
-
 export default Router;
--- a/cms/app-client/app/routes/application.js	Thu Jun 23 10:41:57 2016 +0200
+++ b/cms/app-client/app/routes/application.js	Thu Jun 23 11:35:26 2016 +0200
@@ -27,16 +27,23 @@
     actions: {
 
         willTransition: function() {
-            var _this = this;
-            var queryParams = {};
-            this.controller.get('queryParams').map(function(elt){
-                queryParams[elt] = _this.controller.get(elt);
+            // Prevent navigation from removing query parameters
+            var _this = this,
+                queryParams = {};
+            this.controller.get('queryParams').map(function(parameter){
+                if(typeof parameter === 'object') {
+                    Object.keys(parameter).forEach(function(value, key, array) {
+                        queryParams[value] = _this.controller.get(value);
+                    });
+                } else {
+                    queryParams[parameter] = _this.controller.get(parameter);
+                }
             });
             this.transitionTo({ queryParams: queryParams });
         },
 
         didTransition: function() {
-            this._super(...arguments);
+            // Append body classname depending on the route
             Ember.$('body').removeClass((this.controller.get('currentPath') || '').replace(/\//g, '-').dasherize());
             Ember.run.once(this, function() {
                 Ember.$('body').addClass((this.controller.get('currentPath') ||'').replace(/\//g, '-').dasherize());
--- a/cms/app-client/app/styles/components/filter-component.scss	Thu Jun 23 10:41:57 2016 +0200
+++ b/cms/app-client/app/styles/components/filter-component.scss	Thu Jun 23 11:35:26 2016 +0200
@@ -30,4 +30,20 @@
 
 .filter-component ul li span {
     padding-left: 10px;
+}
+
+.filter-component ul li .label {
+    margin: 0;
+    padding: 0;
+}
+
+.filter-component ul li .label,
+.filter-component ul li .label a {
+    display: inline-block;
+}
+
+.filter-component ul li .label a {
+    text-decoration: none;
+    text-transform: capitalize;
+    color: inherit;
 }
\ No newline at end of file
--- a/cms/app-client/app/templates/components/filter-component.hbs	Thu Jun 23 10:41:57 2016 +0200
+++ b/cms/app-client/app/templates/components/filter-component.hbs	Thu Jun 23 11:35:26 2016 +0200
@@ -4,7 +4,7 @@
     <li class="filter location">{{filter.location}}<span{{action 'removeFilter' 'location'}}>&#10005;</span></li>
 {{/if}}
 {{#if filter.language}}
-    <li class="filter language">{{filter.language}}<span{{action 'removeFilter' 'language'}}>&#10005;</span></li>
+    <li class="filter language">{{doc-language class="label" url=filter.language}}<span{{action 'removeFilter' 'language'}}>&#10005;</span></li>
 {{/if}}
 {{#if filter.discourse}}
 <li class="filter discourse">{{filter.discourse}}<span{{action 'removeFilter' 'discourse'}}>&#10005;</span></li>