corrected some eslint errors and small refactor

This commit is contained in:
Carlos 2017-11-13 22:15:44 +01:00
parent ed64c3b50a
commit 29149b1b58
12 changed files with 57 additions and 40 deletions

View File

@ -1,18 +1,18 @@
<div>
<div class="box-wrapper">
<div class="box">
<img src="./logo.svg"/>
<form name="form" ng-submit="$ctrl.submit()">
<vn-textfield vn-id="userField" label="User" model="$ctrl.user" vn-focus></vn-textfield>
<vn-textfield label="Password" model="$ctrl.password" type="password"></vn-textfield>
<div class="footer">
<vn-submit label="Enter"></vn-submit>
<div class="spinner-wrapper">
<vn-spinner enable="$ctrl.loading"></vn-spinner>
<div class="box">
<img src="./logo.svg"/>
<form name="form" ng-submit="$ctrl.submit()">
<vn-textfield vn-id="userField" label="User" model="$ctrl.user" vn-focus></vn-textfield>
<vn-textfield label="Password" model="$ctrl.password" type="password"></vn-textfield>
<div class="footer">
<vn-submit label="Enter"></vn-submit>
<div class="spinner-wrapper">
<vn-spinner enable="$ctrl.loading"></vn-spinner>
</div>
</div>
</div>
</form>
</div>
</form>
</div>
</div>
<vn-snackbar vn-id="snackbar"></vn-snackbar>
</div>

View File

@ -16,6 +16,7 @@ vn-login > div {
margin: auto;
height: inherit;
}
.box {
box-sizing: border-box;
position: absolute;
@ -27,15 +28,18 @@ vn-login > div {
box-shadow: 0 0 1em 0 rgba(1,1,1,.6);
border-radius: .5em;
}
img {
width: 100%;
padding-bottom: 1em;
}
.footer {
margin-top: 1em;
text-align: center;
position: relative;
}
.spinner-wrapper {
position: absolute;
width: 0;

View File

@ -1,3 +1,3 @@
vn-descriptor{
vn-descriptor {
font-family: raleway-bold;
}

View File

@ -11,6 +11,6 @@ vn-item-client a:hover {
background-color: #424242;
}
.vn-item-client-name{
.vn-item-client-name {
font-family: raleway-bold;
}

View File

@ -6,11 +6,13 @@ export default class Controller {
this.$http = $http;
this.$state = $state;
}
$onChanges() {
if (this.client) {
this.getObservation(this.client.id);
}
}
getObservation(clientId) {
let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'});
this.$http.get(`/client/api/clientObservations?filter=${json}`).then(
@ -19,6 +21,7 @@ export default class Controller {
}
);
}
newObservation() {
this.$state.go("clientCard.notes.create", {id: this.client.id});
}

View File

@ -1,3 +1,3 @@
.notes-date{
.notes-date {
font-family: raleway-bold;
}

View File

@ -6,15 +6,18 @@ export default class Controller {
// onSubmit() is defined by @vnSearchbar
this.onSubmit = () => {};
}
onSearch() {
this.setStorageValue();
this.onSubmit(this.filter);
}
$onChanges() {
var value = JSON.parse(this.$window.sessionStorage.getItem('filter'));
if (value !== undefined)
this.filter = value;
}
setStorageValue() {
this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter));
}

View File

@ -17,7 +17,7 @@ describe('Client', () => {
}));
describe('onSearch()', () => {
it(`should call setStorageValue() and onSubmit()`, () => {
it('should call setStorageValue() and onSubmit()', () => {
spyOn(controller, 'setStorageValue');
spyOn(controller, 'onSubmit');
controller.setStorageValue();
@ -29,7 +29,7 @@ describe('Client', () => {
});
describe('$onChanges()', () => {
it(`should set filter properties using the search values`, () => {
it('should set filter properties using the search values', () => {
expect(controller.filter).not.toBeDefined();
spyOn(JSON, 'parse').and.returnValue({data: 'data'});
controller.$onChanges();

View File

@ -29,6 +29,7 @@ export default class Controller {
this.repeatPassword = '';
this.$.$apply();
}
onPassChange(response) {
if (response == 'ACCEPT' && this.canChangePassword)
try {

View File

@ -32,6 +32,7 @@ class Autocomplete extends Component {
get showDropDown() {
return this._showDropDown;
}
set showDropDown(value) {
if (value && this.url && !this._preLoad) {
this._preLoad = true;
@ -77,6 +78,7 @@ class Autocomplete extends Component {
get field() {
return this.multiple ? this._multiField : this._field;
}
set field(value) {
if (!angular.equals(value, this.field)) {
this.finding = true;
@ -103,7 +105,7 @@ class Autocomplete extends Component {
if (value && value.hasOwnProperty(this.valueField)) {
this._field = value[this.valueField];
if (this.multiple) {
this._multiField = [value[this.valueField]]
this._multiField = [value[this.valueField]];
}
if (value.hasOwnProperty(this.showField)) {
this.displayValue = value[this.showField];
@ -164,6 +166,7 @@ class Autocomplete extends Component {
json => this.onItemRequest(null)
);
}
onItemRequest(data) {
if (data && data.length > 0)
this.showItem(data[0]);
@ -222,6 +225,7 @@ class Autocomplete extends Component {
this.getItems();
}
}
getItems() {
if (this.url === undefined) {
this.items = copyObject(this.data);
@ -273,6 +277,7 @@ class Autocomplete extends Component {
}
}
}
$onInit() {
this.findMore = this.url && this.maxRow;
this.mouseFocus = false;
@ -321,7 +326,6 @@ class Autocomplete extends Component {
}
}
Autocomplete.$inject = ['$element', '$scope', '$http', '$timeout', '$filter'];
module.component('vnAutocomplete', {

View File

@ -1,6 +1,8 @@
{
"initial:before": {
"loopback#favicon": {}
"loopback#favicon": {
"params": "$!../favicon.ico"
}
},
"initial": {
"compression": {},

View File

@ -1,24 +1,24 @@
<!doctype html>
<html ng-app="salix">
<head>
<meta charset="UTF-8">
<title>Salix</title>
<script src="/acl"></script>
</head>
<body>
<vn-app></vn-app>
<script type="text/javascript"
src="/static/routes.js">
</script>
<script type="text/javascript"
src="/static/bundle.manifest.js">
</script>
<script type="text/javascript"
src="/static/bundle.vendor.js">
</script>
<script type="text/javascript"
src="/static/bundle.salix.js">
</script>
</body>
<head>
<meta charset="UTF-8">
<title>Salix</title>
<script src="/acl"></script>
</head>
<body>
<vn-app></vn-app>
<script type="text/javascript"
src="/static/routes.js">
</script>
<script type="text/javascript"
src="/static/bundle.manifest.js">
</script>
<script type="text/javascript"
src="/static/bundle.vendor.js">
</script>
<script type="text/javascript"
src="/static/bundle.salix.js">
</script>
</body>
</html>