Skip to content

Commit

Permalink
Merge pull request #16 from rox163/master
Browse files Browse the repository at this point in the history
comsume frost-core. update ember imports
  • Loading branch information
rox163 committed Apr 7, 2016
2 parents 1e82054 + b211067 commit f5a11e2
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 46 deletions.
16 changes: 9 additions & 7 deletions addon/components/frost-login/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import layout from '../../templates/components/frost-login'
import {default as loginFormModel} from './form-model'
import {default as loginFormView} from './form-view'

export default Ember.Component.extend({
const {Component, computed} = Ember

export default Component.extend({
layout: layout,
classNames: ['frost-login'],

Expand All @@ -15,9 +17,9 @@ export default Ember.Component.extend({
form: {form: true},
actions: {actions: true}
},
hasError: Ember.computed.notEmpty('error'),
hasError: computed.notEmpty('error'),

_product: Ember.computed('product', function () {
_product: computed('product', function () {
if (this.get('product')) {
return this.get('product').toUpperCase()
}
Expand All @@ -26,7 +28,7 @@ export default Ember.Component.extend({

didInsertElement () {
// Fetch a list of all login input fields
let loginInputFields = this.$('.login input')
let loginInputFields = this.$('.frost-bunsen-form input')

// Auto-focus the first empty login input field
loginInputFields.each(function () {
Expand All @@ -40,7 +42,7 @@ export default Ember.Component.extend({
loginInputFields.keypress((e) => {
if (e.which === 13) {
this.send('submitLogin') // send an action to the local submitLogin handler
this.sendAction('on-enter') // send an action to custom forms
this.sendAction('onEnter') // send an action to custom forms
}
})
},
Expand All @@ -50,13 +52,13 @@ export default Ember.Component.extend({
this.set('loginFormValue', value)
},

onValidation (e) {
onValidationHandler (e) {
this.set('valid', e.valid)
},

submitLogin: function () {
let data = this.get('loginFormValue')
this.sendAction('on-submit', data)
this.sendAction('onSubmit', data)
this.set('loginFormValue', {})
}
}
Expand Down
2 changes: 1 addition & 1 deletion addon/styles/addon.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'node_modules/ember-frost-theme/scss/frost-theme';
@import 'node_modules/ember-frost-core/addon/styles/frost-theme';

$frost-login-width: 500px;
$frost-login-separator-width: 5px;
Expand Down
6 changes: 3 additions & 3 deletions addon/templates/components/frost-login.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
{{else}}
{{frost-bunsen-form
model=loginFormModel
on-change=(action "loginFormValueChanged")
on-validation=(action 'onValidation')
onChange=(action "loginFormValueChanged")
onValidation=(action 'onValidationHandler')
view=loginFormView
}}
<div class="submission-error">{{error}}</div>
<div class="footer">
{{frost-button
disabled=(not valid)
on-click=(action "submitLogin")
onClick=(action "submitLogin")
priority="primary"
size="medium"
text="Log in"
Expand Down
4 changes: 1 addition & 3 deletions blueprints/ember-frost-login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ module.exports = {
afterInstall: function () {
return this.addAddonsToProject({
packages: [
{name: 'ember-frost-theme', target: '^1.3.1'},
{name: 'ember-frost-icons', target: '^1.4.0'},
{name: 'ember-frost-bunsen', target: '^2.1.5'}
{name: 'ember-frost-core', target: '>=0.0.14 <2.0.0'}
]
})
}
Expand Down
6 changes: 0 additions & 6 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ module.exports = function (defaults) {
},
'ember-cli-mocha': {
useLintTree: false
},
sassOptions: {
includePaths: [
'node_modules/ember-frost-css-core/scss/frost-core',
'node_modules/ember-frost-theme/scss'
]
}
})

Expand Down
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,8 @@
"ember-data": "~2.3.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-frost-bunsen": "^2.1.5",
"ember-frost-button": "^1.4.1",
"ember-frost-checkbox": "^1.1.1",
"ember-frost-css-core": "^1.1.3",
"ember-frost-icons": "^1.4.0",
"ember-frost-link": "^1.0.0",
"ember-frost-select": "^1.3.1",
"ember-frost-text": "^1.3.0",
"ember-frost-theme": "^1.3.1",
"ember-frost-bunsen": "^3.1.0",
"ember-frost-core": ">=0.0.14 <2.0.0",
"ember-load-initializers": "^0.5.0",
"ember-lodash": "~0.0.6",
"ember-resolver": "^2.0.3",
Expand All @@ -70,4 +63,4 @@
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
}
13 changes: 8 additions & 5 deletions tests/dummy/app/pods/custom-login/controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Ember from 'ember'
import {default as loginFormModel} from './model'

export default Ember.Controller.extend({
const {Controller} = Ember

export default Controller.extend({
loginFormModel,
valid: false,

Expand All @@ -10,15 +12,16 @@ export default Ember.Controller.extend({
this.set('loginFormValue', value)
},

onValidation (e) {
onValidationHandler (e) {
this.set('valid', e.valid)
},

submitLogin: function () {
submitLogin () {
let data = this.get('loginFormValue')
this.notifications.addNotification({
message: 'server: ' + data.server + ', username: ' + data.username +
', password: ' + data.password + ', rememberme: ' + data.rememberMe,
message: 'username: ' + data.username +
', password: ' + data.password + ', rememberme: ' + data.rememberMe +
', server: ' + data.server,
type: 'success',
autoClear: true,
clearDuration: 2000
Expand Down
14 changes: 7 additions & 7 deletions tests/dummy/app/pods/custom-login/template.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{{#frost-login logo='' brandingStrip='' on-enter='submitLogin' as |section|}}
{{#frost-login logo='' brandingStrip='' onEnter='submitLogin' as |section|}}
{{#if section.form}}
{{frost-bunsen-form
model=loginFormModel
on-change=(action "loginFormValueChanged")
on-validation=(action 'onValidation')
onChange=(action 'loginFormValueChanged')
onValidation=(action 'onValidationHandler')
value=loginFormValue
}}
{{/if}}
{{#if section.actions}}
{{frost-button
disabled=(not valid)
on-click=(action "submitLogin")
priority="primary"
size="medium"
text="Login"
onClick=(action 'submitLogin')
priority='primary'
size='medium'
text='Login'
}}
{{/if}}
{{/frost-login}}
3 changes: 2 additions & 1 deletion tests/dummy/app/pods/demo/controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Ember from 'ember'
const {Controller} = Ember

export default Ember.Controller.extend({
export default Controller.extend({
})
4 changes: 3 additions & 1 deletion tests/dummy/app/pods/demo/template.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="dummy-header">
{{#frost-link 'custom-login' class='medium secondary'}}
{{#frost-link 'custom-login'
priority='secondary'
size='medium'}}
Custom login form
{{/frost-link}}
</div>
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/styles/app.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import 'node_modules/ember-frost-css-core/scss/frost-core';
@import 'frost-theme';
@import 'node_modules/ember-frost-core/addon/styles/frost-theme';
@import 'node_modules/ember-frost-core/addon/styles/frost-app';

.dummy-body {
margin-left: 20px;
Expand Down

0 comments on commit f5a11e2

Please sign in to comment.