# HG changeset patch # User Chloe Laisne # Date 1465600077 -7200 # Node ID ca479ef64fb4328d1b0532b43c5a66b83a157cbf # Parent 36e5a67656e69922ba1660cf4d096070b721f356 Default sorting diff -r 36e5a67656e6 -r ca479ef64fb4 cms/app-client/app/components/sorting-component.js --- a/cms/app-client/app/components/sorting-component.js Fri Jun 10 23:42:11 2016 +0200 +++ b/cms/app-client/app/components/sorting-component.js Sat Jun 11 01:07:57 2016 +0200 @@ -3,11 +3,14 @@ export default Ember.Component.extend({ classNames: ['sorting-component'], - sorting: [], + + sorting: ['label'], sortedThemes: Ember.computed.sort('themes', 'sorting'), + isAlphabetical: true, + isPopularity: Ember.computed('isAlphabetical', function() { return !this.get('isAlphabetical'); }), + minimum: Ember.computed('themes', function() { return Math.min(...this.themes.mapBy('count')); }), - maximum: Ember.computed('themes', function() { return Math.max(...this.themes.mapBy('count')); }), actions: { @@ -18,10 +21,16 @@ }, sortBy: function (type) { - this.set('sorting', type === 'popularity' ? ['count:desc'] : ['label']); + if(type === 'alphabetical') { + this.set('isAlphabetical', true); + this.set('sorting', ['label']); + } else { + this.set('isAlphabetical', false); + this.set('sorting', ['count:desc']); + } this.get('sortedThemes'); } } -}); +}); \ No newline at end of file diff -r 36e5a67656e6 -r ca479ef64fb4 cms/app-client/app/styles/components/sorting-component.scss --- a/cms/app-client/app/styles/components/sorting-component.scss Fri Jun 10 23:42:11 2016 +0200 +++ b/cms/app-client/app/styles/components/sorting-component.scss Sat Jun 11 01:07:57 2016 +0200 @@ -48,3 +48,7 @@ ul.tags li.very-popular{ font-size: 24px; } + +ul.options li.active { + font-weight: bold; +} \ No newline at end of file diff -r 36e5a67656e6 -r ca479ef64fb4 cms/app-client/app/templates/components/sorting-component.hbs --- a/cms/app-client/app/templates/components/sorting-component.hbs Fri Jun 10 23:42:11 2016 +0200 +++ b/cms/app-client/app/templates/components/sorting-component.hbs Sat Jun 11 01:07:57 2016 +0200 @@ -5,8 +5,8 @@ Trier par :