diff --git a/app/controllers/category/index.js b/app/controllers/category/index.js index 52aed1e844c..079a61cecca 100644 --- a/app/controllers/category/index.js +++ b/app/controllers/category/index.js @@ -7,7 +7,7 @@ export default Controller.extend(PaginationMixin, { queryParams: ['page', 'per_page', 'sort'], page: '1', per_page: 10, - sort: 'downloads', + sort: 'recent-downloads', totalItems: computed.readOnly('model.meta.total'), @@ -15,6 +15,12 @@ export default Controller.extend(PaginationMixin, { category: computed.alias('categoryController.model'), currentSortBy: computed('sort', function() { - return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; + if (this.get('sort') === 'downloads') { + return 'All-Time Downloads'; + } else if (this.get('sort') === 'alpha') { + return 'Alphabetical'; + } else { + return 'Recent Downloads'; + } }), }); diff --git a/app/controllers/crates.js b/app/controllers/crates.js index 185d93ca697..274e25ee739 100644 --- a/app/controllers/crates.js +++ b/app/controllers/crates.js @@ -14,6 +14,12 @@ export default Controller.extend(PaginationMixin, { totalItems: computed.readOnly('model.meta.total'), currentSortBy: computed('sort', function() { - return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; + if (this.get('sort') === 'downloads') { + return 'All-Time Downloads'; + } else if (this.get('sort') === 'recent-downloads') { + return 'Recent Downloads'; + } else { + return 'Alphabetical'; + } }), }); diff --git a/app/controllers/keyword/index.js b/app/controllers/keyword/index.js index c0650b00664..76deffc376d 100644 --- a/app/controllers/keyword/index.js +++ b/app/controllers/keyword/index.js @@ -7,11 +7,17 @@ export default Controller.extend(PaginationMixin, { queryParams: ['page', 'per_page', 'sort'], page: '1', per_page: 10, - sort: 'alpha', + sort: 'recent-downloads', totalItems: computed.readOnly('model.meta.total'), currentSortBy: computed('sort', function() { - return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; + if (this.get('sort') === 'downloads') { + return 'All-Time Downloads'; + } else if (this.get('sort') === 'alpha') { + return 'Alphabetical'; + } else { + return 'Recent Downloads'; + } }), }); diff --git a/app/controllers/search.js b/app/controllers/search.js index a590e1348a9..50914fd2fdc 100644 --- a/app/controllers/search.js +++ b/app/controllers/search.js @@ -13,7 +13,13 @@ export default Controller.extend(PaginationMixin, { totalItems: computed.readOnly('model.meta.total'), currentSortBy: computed('sort', function() { - return (this.get('sort') === 'downloads') ? 'Downloads' : 'Relevance'; + if (this.get('sort') === 'downloads') { + return 'All-Time Downloads'; + } else if (this.get('sort') === 'recent-downloads') { + return 'Recent Downloads'; + } else { + return 'Relevance'; + } }), hasItems: computed.bool('totalItems'), diff --git a/app/controllers/team.js b/app/controllers/team.js index 53830bf9153..5b559694086 100644 --- a/app/controllers/team.js +++ b/app/controllers/team.js @@ -12,6 +12,12 @@ export default Controller.extend(PaginationMixin, { totalItems: computed.readOnly('model.crates.meta.total'), currentSortBy: computed('sort', function() { - return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; + if (this.get('sort') === 'downloads') { + return 'All-Time Downloads'; + } else if (this.get('sort') === 'recent-downloads') { + return 'Recent Downloads'; + } else { + return 'Alphabetical'; + } }), }); diff --git a/app/controllers/user.js b/app/controllers/user.js index c2c6a9b0893..ab3088fd4e9 100644 --- a/app/controllers/user.js +++ b/app/controllers/user.js @@ -13,6 +13,12 @@ export default Controller.extend(PaginationMixin, { totalItems: computed.readOnly('model.crates.meta.total'), currentSortBy: computed('sort', function() { - return (this.get('sort') === 'downloads') ? 'Downloads' : 'Alphabetical'; + if (this.get('sort') === 'downloads') { + return 'All-Time Downloads'; + } else if (this.get('sort') === 'recent-downloads') { + return 'Recent Downloads'; + } else { + return 'Alphabetical'; + } }), }); diff --git a/app/models/crate.js b/app/models/crate.js index 67ed18cf4c3..44cf9bb710e 100644 --- a/app/models/crate.js +++ b/app/models/crate.js @@ -4,6 +4,7 @@ import DS from 'ember-data'; export default DS.Model.extend({ name: DS.attr('string'), downloads: DS.attr('number'), + recent_downloads: DS.attr('number'), created_at: DS.attr('date'), updated_at: DS.attr('date'), max_version: DS.attr('string'), diff --git a/app/routes/team.js b/app/routes/team.js index 6a7c642964b..f87e63c9400 100644 --- a/app/routes/team.js +++ b/app/routes/team.js @@ -1,13 +1,13 @@ -import RSVP from 'rsvp'; -import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +import RSVP from 'rsvp'; export default Route.extend({ flashMessages: service(), queryParams: { - page: { refreshedModel: true }, - sort: { refreshedModel: true }, + page: { refreshModel: true }, + sort: { refreshModel: true }, }, data: {}, diff --git a/app/styles/crate.scss b/app/styles/crate.scss index ddf3f99ada5..9a39f5c60ee 100644 --- a/app/styles/crate.scss +++ b/app/styles/crate.scss @@ -119,7 +119,7 @@ padding-top: 5px; @include display-flex; @include flex-direction(column); - width: 85%; + width: 75%; } .info a { @@ -133,10 +133,18 @@ } .stats { - width: 15%; + width: 25%; color: $main-color-light; } - .downloads { @include display-flex; @include align-items(center); } + .downloads { + @include display-flex; + @include align-items(center); + padding-bottom: 5px; + } + .recent-downloads { + @include display-flex; + @include align-items(center); + } .rev-dep-downloads {padding-left: 7px} } diff --git a/app/templates/category/index.hbs b/app/templates/category/index.hbs index da7ceab66b8..d77f15916ce 100644 --- a/app/templates/category/index.hbs +++ b/app/templates/category/index.hbs @@ -61,7 +61,12 @@
  • {{#link-to (query-params sort="downloads")}} - Downloads + All-Time Downloads + {{/link-to}} +
  • +
  • + {{#link-to (query-params sort="recent-downloads")}} + Recent Downloads {{/link-to}}
  • {{/rl-dropdown}} diff --git a/app/templates/components/crate-row.hbs b/app/templates/components/crate-row.hbs index daf61b07799..f9318133dbe 100644 --- a/app/templates/components/crate-row.hbs +++ b/app/templates/components/crate-row.hbs @@ -20,7 +20,11 @@
    {{svg-jar "download"}} - {{ format-num crate.downloads }} + All-Time: {{ format-num crate.downloads }} +
    +
    + {{svg-jar "download"}} + Recent: {{ format-num crate.recent_downloads }}