Skip to content

Commit

Permalink
Merge pull request DockYard#33 from emberobserver/kg-refactor-search
Browse files Browse the repository at this point in the history
Move search up to the application template
  • Loading branch information
kategengler committed Mar 29, 2016
2 parents fff36fb + 6eae284 commit db060ae
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 56 deletions.
3 changes: 1 addition & 2 deletions app/controllers/addons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
6 changes: 5 additions & 1 deletion app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend({
export default Ember.Controller.extend(ControllerWithSearch, {
shouldShowCategories: Ember.computed('currentRouteName', function() {
return this.get('currentRouteName') !== 'addons.show';
})
});
3 changes: 1 addition & 2 deletions app/controllers/categories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
3 changes: 1 addition & 2 deletions app/controllers/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
3 changes: 1 addition & 2 deletions app/controllers/lists.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
3 changes: 1 addition & 2 deletions app/controllers/maintainers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
3 changes: 1 addition & 2 deletions app/controllers/model-not-found.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
3 changes: 1 addition & 2 deletions app/controllers/not-found.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Ember from 'ember';
import ControllerWithSearch from '../mixins/controller-with-search';

export default Ember.Controller.extend(ControllerWithSearch, {
export default Ember.Controller.extend({
});
3 changes: 1 addition & 2 deletions app/routes/addons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
3 changes: 2 additions & 1 deletion app/routes/application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend({
export default Ember.Route.extend(RouteWithSearch, {
beforeModel: function() {
this.get('session').fetch();
},
Expand Down
3 changes: 1 addition & 2 deletions app/routes/categories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
3 changes: 1 addition & 2 deletions app/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
3 changes: 1 addition & 2 deletions app/routes/lists.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
3 changes: 1 addition & 2 deletions app/routes/maintainers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
3 changes: 1 addition & 2 deletions app/routes/model-not-found.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
3 changes: 1 addition & 2 deletions app/routes/not-found.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Ember from 'ember';
import scrollFix from '../mixins/scroll-fix';
import RouteWithSearch from '../mixins/route-with-search';

export default Ember.Route.extend(scrollFix, RouteWithSearch, {
export default Ember.Route.extend(scrollFix, {
});
4 changes: 1 addition & 3 deletions app/templates/addons.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{{#page-layout-with-search query=query showCategories=false}}
{{outlet}}
{{/page-layout-with-search}}
{{outlet}}
4 changes: 3 additions & 1 deletion app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="container">
{{outlet}}
{{#page-layout-with-search query=query showCategories=shouldShowCategories}}
{{outlet}}
{{/page-layout-with-search}}
<footer class="footer" role="contentinfo">
<hr>
<section class="sponsor">
Expand Down
4 changes: 1 addition & 3 deletions app/templates/categories.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{{#page-layout-with-search query=query}}
{{outlet}}
{{/page-layout-with-search}}
{{outlet}}
4 changes: 1 addition & 3 deletions app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{{#page-layout-with-search query=query}}
{{route-index class="route-index"}}
{{/page-layout-with-search}}
{{route-index class="route-index"}}
4 changes: 1 addition & 3 deletions app/templates/lists.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{{#page-layout-with-search query=query}}
{{outlet}}
{{/page-layout-with-search}}
{{outlet}}
4 changes: 1 addition & 3 deletions app/templates/maintainers.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{{#page-layout-with-search query=query}}
{{outlet}}
{{/page-layout-with-search}}
{{outlet}}
8 changes: 3 additions & 5 deletions app/templates/model-not-found.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{#page-layout-with-search query=query}}
<div class="not-found test-not-found">
<h1>Oops! We can't find what you were looking for. Try searching above?</h1>
</div>
{{/page-layout-with-search}}
<div class="not-found test-not-found">
<h1>Oops! We can't find what you were looking for. Try searching above?</h1>
</div>
8 changes: 3 additions & 5 deletions app/templates/not-found.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{#page-layout-with-search query=query}}
<div class="not-found test-not-found">
<h1>Oops! We can't find what you were looking for. Try searching above?</h1>
</div>
{{/page-layout-with-search}}
<div class="not-found test-not-found">
<h1>Oops! We can't find what you were looking for. Try searching above?</h1>
</div>
12 changes: 12 additions & 0 deletions tests/acceptance/addons-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ test('displays 0 for score when addon has zero score', function(assert) {
});
});

test('Does not display category list', function(assert) {
var addon = server.create('addon', {
name: 'test-addon'
});

visit(`/addons/${addon.name}`);

andThen(function() {
assert.notExists('.categories-list');
});
});

test('displays WIP for score when addon is WIP', function(assert) {
var addon = server.create('addon', {
name: 'test-wip',
Expand Down

0 comments on commit db060ae

Please sign in to comment.