Errores eslint, scripts dev

This commit is contained in:
Juan Ferrer Toribio 2017-05-16 12:37:48 +02:00
parent 30ad456eea
commit c4978b24fb
13 changed files with 72 additions and 72 deletions

View File

@ -2,12 +2,12 @@
<vn-vertical pad-large>
<vn-title>Notas</vn-title>
<vn-horizontal ng-repeat="n in observation.observations" margin-small-bottom style="align-items: center;">
<vn-auto style="border-radius: .3em;" class="pad-small border-solid">
<div class="notes-date">{{n.created | date:'dd/MM/yyyy HH:mm'}}</div>
<div class="notes-date">{{n.employee.name}}</div>
<div>{{n.text}}</div>
</vn-auto>
</vn-horizontal>
<vn-auto style="border-radius: .3em;" class="pad-small border-solid">
<div class="notes-date">{{n.created | date:'dd/MM/yyyy HH:mm'}}</div>
<div class="notes-date">{{n.employee.name}}</div>
<div>{{n.text}}</div>
</vn-auto>
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-float-button

View File

@ -6,18 +6,17 @@ import {kebabToCamel} from '../lib/string';
* Registers a click handler on the element that opens the dialog id
* specified as value.
*/
directive.$inject = ['$document'];
export function directive($document) {
export function directive() {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
$element.on('click', function(event) {
let dialog = $scope[kebabToCamel($attrs['vnDialog'])];
if(dialog instanceof Dialog)
let dialog = $scope[kebabToCamel($attrs.vnDialog)];
if (dialog instanceof Dialog)
dialog.show();
event.preventDefault();
});
}
}
};
}
module.directive('vnDialog', directive);

View File

@ -11,17 +11,17 @@ export function directive() {
let input = $element[0];
let selector = 'input, textarea, button, submit';
if(!input.matches(selector))
if (!input.matches(selector))
input = input.querySelector(selector);
if(!input) {
if (!input) {
console.warn(`vnFocus: Can't find a focusable element`);
return;
}
input.focus();
if(input.select)
if (input.select)
input.select();
});
}

View File

@ -10,15 +10,15 @@ export function directive() {
restrict: 'A',
link: function($scope, $element, $attrs) {
let id = kebabToCamel($attrs.vnId);
let controller = $element[0].$ctrl;
let controller = $element.controller($element[0].tagName.toLowerCase());
if(!id)
if (!id)
throw new Error(`vnId: Attribute can't be null`);
if(!controller)
if (!controller)
throw new Error(`vnId: Can't find controller for element '${id}'`);
$scope[id] = controller;
}
};
};
}
module.directive('vnId', directive);

View File

@ -1,4 +1,4 @@
import './id';
import './focus';
import './dialog';
import './validation';
import './validation';

View File

@ -14,14 +14,14 @@ export default class Paging {
$scope.$watch('$ctrl.index.model.length', () => this.onModelUpdated());
}
$onChanges() {
if(!this.index) return;
if (!this.index) return;
this.numPerPage = this.index.filter.size;
}
onModelUpdated() {
let index = this.index;
let filter = index.filter;
if(filter.page >= this.numPages
if (filter.page >= this.numPages
&& index.model.length >= this.numPerPage)
this.numItems = filter.page * filter.size + 1;
}

View File

@ -5,13 +5,13 @@ directive.$inject = ['vnPopover'];
export function directive(popover) {
return {
restrict: 'A',
link: function($scope, $element, $attrs, $ctrl) {
link: function($scope, $element, $attrs) {
$element.on('click', function(event) {
popover.showComponent($attrs.vnDialog, $scope, $element);
event.preventDefault();
});
}
}
};
}
module.directive('vnPopover', directive);
@ -24,7 +24,7 @@ export class Popover {
let popover = this.document.createElement('div');
popover.className = 'vn-popover';
popover.addEventListener('mousedown',
(event) => this.onPopoverMouseDown(event));
event => this.onPopoverMouseDown(event));
popover.appendChild(childElement);
this.popover = popover;
@ -39,38 +39,38 @@ export class Popover {
let innerWidth = window.innerWidth;
let innerHeight = window.innerHeight;
if(width + dblMargin > innerWidth) {
if (width + dblMargin > innerWidth) {
width = innerWidth - dblMargin;
style.width = width +'px';
style.width = width + 'px';
}
if(height + dblMargin > innerHeight) {
if (height + dblMargin > innerHeight) {
height = innerHeight - dblMargin;
style.height = height +'px';
style.height = height + 'px';
}
if(parent) {
if (parent) {
let parentNode = parent;
let rect = parentNode.getBoundingClientRect();
let left = rect.left;
let top = rect.top + spacing + parentNode.offsetHeight;
if(left + width > innerWidth)
if (left + width > innerWidth)
left -= (left + width) - innerWidth + margin;
if(top + height > innerHeight)
if (top + height > innerHeight)
top -= height + parentNode.offsetHeight + spacing * 2;
if(left < 0)
if (left < 0)
left = screenMargin;
if(top < 0)
if (top < 0)
top = screenMargin;
style.top = (top) +'px';
style.left = (left) +'px';
style.minWidth = (rect.width) +'px';
style.top = (top) + 'px';
style.left = (left) + 'px';
style.minWidth = (rect.width) + 'px';
}
this.document.body.appendChild(popover);
this.docMouseDownHandler = (event) => this.onDocMouseDown(event);
this.docMouseDownHandler = event => this.onDocMouseDown(event);
this.document.addEventListener('mousedown', this.docMouseDownHandler);
}
showComponent(childComponent, $scope, parent) {
@ -79,7 +79,7 @@ export class Popover {
this.show(childElement, parent);
}
hide() {
if(!this.popover) return;
if (!this.popover) return;
this.document.removeEventListener('mousedown', this.docMouseDownHandler);
this.document.body.removeChild(this.popover);
this.popover = null;

View File

@ -17,7 +17,7 @@ class Controller {
// XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente?
var childCtrl = angular.element(child).isolateScope().$ctrl;
childCtrl.onSubmit = (filter) => this.onChildSubmit(filter);
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
event.preventDefault();
}
@ -36,7 +36,7 @@ class Controller {
}
Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', '$window'];
export const NAME = 'vnSearchbar'
export const NAME = 'vnSearchbar';
export const COMPONENT = {
template: require('./searchbar.html'),
bindings: {

View File

@ -11,14 +11,13 @@ goto caseUsage
:caseStart
call "%0" stop
echo "################################ Starting services"
echo "Starting nginx."
if not exist "%nginxPrefix%\temp" (mkdir "%nginxPrefix%\temp")
start /I nginx -c "%nginxConf%" -p "%nginxPrefix%"
node dev.js
goto caseEnd
:caseStop
echo "################################ Stoping services"
echo "Stoping nginx."
if exist "%nginxPrefix%\temp\nginx.pid" (nginx -c "%nginxConf%" -p "%nginxPrefix%" -s stop)
goto caseEnd

11
dev.js
View File

@ -1,11 +0,0 @@
require('./gulpfile');
var auth = require('./services/auth/server/server.js');
var client = require('./services/client/server/server.js');
var server = require('./services/salix/server/server.js');
var gulp = require('gulp');
gulp.start(['default']);
auth.start();
client.start();
server.start();

5
dev.sh
View File

@ -11,12 +11,11 @@ fi
case "$1" in
start|"")
$0 stop
echo "################################ Starting services"
echo "Starting nginx."
"$nginxBin" -c "$nginxConf" -p "$nginxPrefix"
node dev.js
;;
stop)
echo "################################ Stoping services"
echo "Stoping nginx."
"$nginxBin" -c "$nginxConf" -p "$nginxPrefix" -s stop
;;
*)

View File

@ -18,7 +18,19 @@ var langs = ['es', 'en'];
var modules = require('./spliting/modules.json');
var webpackConfig = require('./webpack.config.js');
// Clean
// Main tasks
gulp.task('build', ['clean'], function() {
return gulp.start('routes', 'locales', 'webpack');
});
gulp.task('default', ['clean'], function() {
return gulp.start('services', 'watch', 'routes', 'locales', 'webpack-dev-server');
});
gulp.task('client', ['clean'], function() {
return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server');
});
gulp.task('clean', function() {
return del(`${buildDir}/*`, {force: true});
@ -140,12 +152,14 @@ gulp.task('watch', function() {
gulp.watch(localeFiles, ['locales']);
});
// Default
// Services
gulp.task('build', ['clean'], function() {
return gulp.start('routes', 'locales', 'webpack');
});
gulp.task('services', function() {
var auth = require('./services/auth/server/server.js');
var client = require('./services/client/server/server.js');
var server = require('./services/salix/server/server.js');
gulp.task('default', ['clean'], function() {
return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server');
auth.start();
client.start();
server.start();
});

View File

@ -8,10 +8,10 @@ var config = {
entry: {
'bundle.salix': ['salix'],
'bundle.auth': ['auth'],
'bundle.vendor': ['vendor']
'bundle.vendor': ['vendor']
},
output: {
path: path.join (__dirname, './services/nginx/static'),
path: path.join(__dirname, './services/nginx/static'),
filename: '[name].js',
publicPath: '/static/',
chunkFilename: 'chunk.[name].[chunkhash].js'
@ -49,22 +49,22 @@ var config = {
path.join(__dirname, 'client'),
__dirname,
'node_modules',
'/usr/lib/node_modules'
'/usr/lib/node_modules'
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['bundle.vendor', 'bundle.manifest']
})
new webpack.optimize.CommonsChunkPlugin({
names: ['bundle.vendor', 'bundle.manifest']
})
],
devtool: 'source-map'
};
if (!devMode) {
config.plugins.push (
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: { warnings: false }
compress: {warnings: false}
})
);
}