merge
This commit is contained in:
commit
73f464cae5
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import './id';
|
||||
import './focus';
|
||||
import './dialog';
|
||||
import './validation';
|
||||
import './validation';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: {
|
||||
|
|
5
dev.cmd
5
dev.cmd
|
@ -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
11
dev.js
|
@ -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
5
dev.sh
|
@ -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
|
||||
;;
|
||||
*)
|
||||
|
|
28
gulpfile.js
28
gulpfile.js
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue