Skip to content

Commit

Permalink
v1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zack9433 committed May 10, 2016
2 parents f54ffda + e67c557 commit bfe6298
Show file tree
Hide file tree
Showing 31 changed files with 157 additions and 257 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"plugins": ["transform-runtime", "add-module-exports"]
}
30 changes: 16 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"parser": "babel-eslint",
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"node": 1,
"browser": 1,
"es6": 1
"es6": true,
"browser": true,
"node": true
},
"globals": {
"angular": 1
"__DEV__": true,
"__TEST__": true,
"__RELEASE__": true,
"__BASE_PATH__": true
},
"rules": {
"quotes": [2, "single", "avoid-escape"],
"eqeqeq": 0,
"no-use-before-define": 0,
"no-shadow": 0,
"brace-style": [2, "stroustrup"],
"eol-last": 0,
"no-nested-ternary": 1,
"padded-blocks": [1, "never"],
"space-before-function-paren": [1, "never"],
"space-before-blocks": [1, "always"]
"indent": [ 2, 2 ],
"quotes": [ 2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"linebreak-style": [ 2, "unix" ],
"semi": [ 2, "always" ]
}
}
33 changes: 0 additions & 33 deletions app/component/component-window.directive.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/component/component.i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export default $translateProvider => {
'ngInject';
$translateProvider.translations('en', require('./lang/en.json'));
$translateProvider.translations('zh-tw', require('./lang/zh-tw.json'));
}
};
56 changes: 28 additions & 28 deletions app/component/component.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@ class CellularService {
constructor(...injects) {
CellularService.$inject.forEach((item, index) => this[item] = injects[index]);
switch(config.get.type) {
case 'collection':
this.data = [];
break;
case 'model':
this.data = {};
break;
default:
this.data = [];
case 'collection':
this.data = [];
break;
case 'model':
this.data = {};
break;
default:
this.data = [];
}
}

_transform(data) {
switch(config.get.type) {
case 'collection':
return this._.map(data, (item, index) => {
return {
title: (config.get.titlePrefix || 'tab') + index,
content: item,
formOptions: {},
fields: config.fields
};
});
case 'model':
case 'collection':
return this._.map(data, (item, index) => {
return {
content: data,
title: (config.get.titlePrefix || 'tab') + index,
content: item,
formOptions: {},
fields: config.fields
};
default:
return this._.map(data, (item, index) => {
return {
title: (config.get.titlePrefix || 'tab') + index,
content: item,
formOptions: {},
fields: config.fields
};
});
});
case 'model':
return {
content: data,
formOptions: {},
fields: config.fields
};
default:
return this._.map(data, (item, index) => {
return {
title: (config.get.titlePrefix || 'tab') + index,
content: item,
formOptions: {},
fields: config.fields
};
});
}
}

Expand Down
23 changes: 0 additions & 23 deletions app/component/form/component-container.directive.js

This file was deleted.

26 changes: 0 additions & 26 deletions app/component/form/component.directive.js

This file was deleted.

6 changes: 6 additions & 0 deletions app/component/form/container.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const CellularFormContainerComponent = {
template: `<sanji-cellular-form data="vm.data" on-submit="vm.onSave(data)"></sanji-cellular-form>`,
controller: 'CellularFormContainerController',
controllerAs: 'vm'
};
export default CellularFormContainerComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ class CellularFormContainerController {

this.sanjiWindowMgr = this.sanjiWindowService.get(WINDOW_ID);
this.data = this.cellularService.data;

this.activate();

this.$scope.$on('sj:window:refresh', this.onRefresh.bind(this))
}

activate() {
this.sanjiWindowMgr.promise = this.cellularService.get().then(() => {
this.data = this.cellularService.data;
});
this.$scope.$on('sj:window:refresh', this.onRefresh.bind(this));
}

onRefresh(event, args) {
if (args.id === WINDOW_ID) {
this.activate();
this.sanjiWindowMgr.promise = this.cellularService.get().then(() => {
this.data = this.cellularService.data;
});
}
}

Expand Down
10 changes: 10 additions & 0 deletions app/component/form/form.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const CellularFormComponent = {
bindings: {
tabs: '<data',
submitCallback: '&onSubmit'
},
templateUrl: 'sanji-cellular-form.tpl.html',
controller: 'CellularFormController',
controllerAs: 'vm'
};
export default CellularFormComponent;
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions app/component/form/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import angular from 'angular';
import sjCore from 'sanji-core-ui';

import './component.tpl.html';
import CellularFormContainerController from './component-container.controller';
import CellularFormController from './component.controller';
import CellularFormContainerDirective from './component-container.directive';
import CellularFormDirective from './component.directive';
import './form.tpl.html';
import CellularFormContainerController from './container.controller';
import CellularFormController from './form.controller';
import CellularFormContainerComponent from './container.component';
import CellularFormComponent from './form.component';

let app = angular.module('sanji.cellular.form', [sjCore]);
app.controller('CellularFormContainerController', CellularFormContainerController);
app.controller('CellularFormController', CellularFormController);
app.directive('sanjiCellularFormContainer', CellularFormContainerDirective.directiveFactory);
app.directive('sanjiCellularForm', CellularFormDirective.directiveFactory);
export default app = app.name
app.component('sanjiCellularFormContainer', CellularFormContainerComponent);
app.component('sanjiCellularForm', CellularFormComponent);
export default app = app.name;
6 changes: 3 additions & 3 deletions app/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sjCellularForm from './form';

import i18nConfig from './component.i18n';
import CellularService from './component.service';
import CellularWindowDirective from './component-window.directive';
import CellularWindowComponent from './window.component';

let app = angular.module('sanji.cellular', [
sjCore,
Expand All @@ -14,5 +14,5 @@ let app = angular.module('sanji.cellular', [
]);
app.config(i18nConfig);
app.service('cellularService', CellularService);
app.directive('sanjiCellularWindow', CellularWindowDirective.directiveFactory);
export default app = app.name
app.component('sanjiCellularWindow', CellularWindowComponent);
export default app = app.name;
10 changes: 10 additions & 0 deletions app/component/info/cellular-signal.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// reference from http://codepen.io/shorepound/details/GpXVwW/
const CellularSignalComponent = {
bindings: {
signal: '<'
},
templateUrl: 'sanji-cellular-signal.tpl.html',
controller: 'CellularSignalController',
controllerAs: 'vm'
};
export default CellularSignalComponent;
26 changes: 0 additions & 26 deletions app/component/info/cellular-signal.directive.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/component/info/cellular-signal.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
<div class="circle">
<div class="circle-text">
{{vm.signal}}</br>
<span ng-bind="vm.signal"></span></br>
<span class="circle-text-under">dBm</span>
</div>
</div>
Expand Down
23 changes: 0 additions & 23 deletions app/component/info/component-container.directive.js

This file was deleted.

25 changes: 0 additions & 25 deletions app/component/info/component.directive.js

This file was deleted.

6 changes: 6 additions & 0 deletions app/component/info/container.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const CellularInfoContainerComponent = {
template: `<sanji-cellular-info data="vm.data"></sanji-cellular-info>`,
controller: 'CellularInfoContainerController',
controllerAs: 'vm'
};
export default CellularInfoContainerComponent;
Loading

0 comments on commit bfe6298

Please sign in to comment.