Skip to content

Commit

Permalink
Merge 88f2bae into f97b4f6
Browse files Browse the repository at this point in the history
  • Loading branch information
srowhani committed Dec 18, 2016
2 parents f97b4f6 + 88f2bae commit 841e659
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 63 deletions.
6 changes: 4 additions & 2 deletions addon/components/nav-category.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Ember from 'ember'
import layout from '../templates/components/nav-category'
import computed from 'ember-computed-decorators'
import PropTypesMixin, { PropTypes } from 'ember-prop-types'
import SpreadMixin from 'ember-spread'

const {
Component,
typeOf,
Expand All @@ -15,7 +17,7 @@ const {
set
} = Ember

export default Component.extend(PropTypesMixin, {
export default Component.extend(SpreadMixin, PropTypesMixin, {
// == Services ==============================================================

frostNavigation: service(),
Expand All @@ -30,7 +32,7 @@ export default Component.extend(PropTypesMixin, {

propTypes: {
icon: PropTypes.string,
name: PropTypes.string.isRequired,
name: PropTypes.string,
pack: PropTypes.string
},
getDefaultProps () {
Expand Down
5 changes: 3 additions & 2 deletions addon/components/nav-route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember'
import layout from '../templates/components/nav-route'
import PropTypesMixin, { PropTypes } from 'ember-prop-types'
import SpreadMixin from 'ember-spread'

const {
Component,
Expand All @@ -10,7 +11,7 @@ const {
get
} = Ember

export default Component.extend(PropTypesMixin, {
export default Component.extend(SpreadMixin, PropTypesMixin, {
// == Services ==============================================================

frostNavigation: service(),
Expand All @@ -23,7 +24,7 @@ export default Component.extend(PropTypesMixin, {
// == State properties ======================================================

propTypes: {
name: PropTypes.string.isRequired,
name: PropTypes.string,
description: PropTypes.string,
route: PropTypes.string,
icon: PropTypes.string,
Expand Down
5 changes: 1 addition & 4 deletions addon/templates/components/frost-navigation.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

{{#each categories as |category index|}}
{{nav-category
isVisible=category.isVisible
icon=category.icon
name=category.name
pack=category.pack
options=category
hook=(concat hook '-category-' index)
}}
{{/each}}
Expand Down
8 changes: 5 additions & 3 deletions addon/templates/components/nav-route.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{{#if route}}
{{#frost-link
route
(hash isQueryParams=true values=params)
hook=(concat hook '-link')
options=(hash
route=route
routeModels=routeModels
routeQueryParams=routeQueryParams
)
}}
<div class='content'>
<div class='nav-route-icon'>
Expand Down
10 changes: 1 addition & 9 deletions addon/templates/components/nav-section.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@
}}
{{else}}
{{nav-route
description=item.description
icon=item.icon
pack=item.pack
name=item.name
route=item.route
params=item.params
url=item.url
tabbed=item.tabbed
isVisible=item.isVisible
options=item
hook=(concat hook '-route-' index)
}}
{{/if}}
Expand Down
1 change: 0 additions & 1 deletion addon/utils/asserts.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export default {
ACTION: `${title}action must be nested within this.section or this.column`,
ACTION_CONFIG: `${title}Configuration object requires property as an action`,
ROUTE: `${title}'config.route must be defined'`,
PACKAGE: `${title}config.package must be defined`,
DEPRECATE_ACTION: `${title}Action should exist within the 'actions' hook`
}
28 changes: 6 additions & 22 deletions addon/utils/bind-dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const {
APP,
ROUTE,
ENGINE,
PACKAGE,
ACTION,
ACTION_CONFIG,
LINK
Expand Down Expand Up @@ -53,25 +52,13 @@ export default {
name,
config
}
if (name !== 'application') {
self.route(name, config, function () {
callback.call({
category: obj.category.bind({
top: parent,
parent,
DSL: this
})
})
})
} else {
callback.call({
category: obj.category.bind({
top: parent,
parent,
DSL: self
})
callback.call({
category: obj.category.bind({
top: parent,
parent,
DSL: self
})
}
})
})(args.string, args.object, args.function)
}
/**
Expand Down Expand Up @@ -202,7 +189,6 @@ export default {
assert(APP, self.parent.type === 'section' || self.parent.type === 'column')
;(function (name, config = {}, callback = function () {}) {
assert(ROUTE, config.route)
self.DSL.route(config.route, config)

let e = self.parent.type === 'section' ? self.element.routes : self.element[0].routes
let route = self.top.name !== 'application'
Expand Down Expand Up @@ -240,10 +226,8 @@ export default {
let self = this
assert(ENGINE, self.parent.type === 'section' || self.parent.type === 'column')
;(function (name, config = {}, callback = function () {}) {
assert(PACKAGE, config.package)
assert(ROUTE, config.route)
config.as = config.as || config.route
self.DSL.mount(config.package, config)
let e = self.parent.type === 'section' ? self.element.routes : self.element[0].routes
let route = self.top.name !== 'application'
? `${self.top.name}.${config.route}`
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ember-frost-navigation",
"dependencies": {
"ember": "~2.8.0",
"ember": "~2.8.2",
"ember-cli-shims": "0.1.0",
"ember-inflector": "1.3.1",
"ember-mocha": "~0.8.11",
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@
"ember-cli-uglify": "^1.2.0",
"ember-cli-visual-acceptance": "2.2.0",
"ember-code-snippet": "1.8.0",
"ember-computed-decorators": "~0.2.0",
"ember-concurrency": "~0.7.0",
"ember-computed-decorators": "0.2.2",
"ember-concurrency": "0.7.16",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-elsewhere": "~0.4.0",
"ember-elsewhere": "0.4.1",
"ember-engines": "~0.3.4",
"ember-export-application-global": "^1.0.5",
"ember-frost-core": "^1.0.0",
"ember-hook": "^1.3.1",
"ember-frost-core": "1.3.5",
"ember-hook": "1.4.0",
"ember-load-initializers": "^0.5.1",
"ember-prop-types": "^3.0.0",
"ember-prop-types": "3.2.0",
"ember-redux": "^1.0.0",
"ember-resolver": "^2.0.3",
"ember-sinon": "~0.5.0",
"ember-sinon": "0.5.1",
"ember-test-utils": "1.3.2",
"ember-truth-helpers": "1.2.0",
"eslint": "^3.0.0",
"eslint-config-frost-standard": "^4.0.0",
Expand All @@ -63,8 +64,7 @@
"redux-thunk": "2.1.0",
"remark-cli": "^2.0.0",
"remark-lint": "^5.1.0",
"sass-lint": "^1.0.0",
"svg4everybody": "^2.1.0"
"sass-lint": "^1.0.0"
},
"keywords": [
"ember-addon",
Expand All @@ -83,4 +83,4 @@
"ember-frost-icon-pack": {
"name": "frost-nav"
}
}
}
13 changes: 9 additions & 4 deletions tests/dummy/app/pods/demo/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ export default Controller.extend({
},
init () {
this._super(...arguments)
let customRouteObject = Ember.Object.extend({
let customRouteObject = Ember.Object.extend({}).create({
description: 'custom route',
icon: 'application',
pack: 'frost-nav',
name: 'Custom Route',
route: 'demo.go'
}).create()
route: 'demo.test',
routeModels: ['id0'],
routeQueryParams: {count: 0}
})
set(this, 'customRouteObject', customRouteObject)
let columns = [
[
Expand Down Expand Up @@ -59,8 +61,11 @@ export default Controller.extend({
},
incrementCount () {
let count = get(this, 'count') + 1

set(this, 'count', count)
set(this, 'customRouteObject.params', {count})

set(this, 'customRouteObject.routeModels', [`id${count}`])
set(this, 'customRouteObject.routeQueryParams', {count})
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/pods/demo/go/template.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Went (count is {{count}})
Went
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/dummy/app/pods/demo/test/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Ember from 'ember'

export default Ember.Route.extend({
})
1 change: 1 addition & 0 deletions tests/dummy/app/pods/demo/test/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test route
12 changes: 8 additions & 4 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ var Router = Ember.Router.extend({
})
// BEGIN-SNIPPET router
Router.map(function () {
this.nav('demo', {
path: '/'
}, function () {
this.route('demo', {path: '/'}, function () {
this.route('go')
this.route('test', {path: '/test/:id'})
this.mount('ember-blog-engine', {
as: 'blog'
})
})
this.nav('demo', function () {
this.category('Category 1', {
pack: 'frost-nav',
icon: 'application'
Expand All @@ -33,7 +38,6 @@ Router.map(function () {
this.engine('Blog Engine', {
route: 'blog',
description: 'This is an engine example',
package: 'ember-blog-engine',
pack: 'frost-nav',
icon: 'application'
})
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 841e659

Please sign in to comment.