Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
SAMBA\bernat 2018-02-14 12:09:50 +01:00
commit e79beaa13f
18 changed files with 602 additions and 471 deletions

View File

@ -5,3 +5,4 @@ import './validation';
import './acl';
import './on-error-src';
import './zoom-image';
import './visible-by';

View File

@ -55,17 +55,17 @@ describe('Directive zoomImage', () => {
let image = getCompiledImage(`<img src="${srcDefault}" zoom-image>`);
image[0].click();
findContainer = document.getElementById(idContainer);
let findNewImage = findContainer.querySelector('img');
let findNewImage = findContainer.querySelector('.zoomImage-background');
expect(findNewImage.src).toEqual(srcDefault);
expect(findNewImage.style.backgroundImage).toEqual(`url("${srcDefault}")`);
});
it('should create new image, into zoom container, with src likes zoomImage value', () => {
let image = getCompiledImage(`<img src="${srcDefault}" zoom-image="${srcZoom}">`);
image[0].click();
findContainer = document.getElementById(idContainer);
let findNewImage = findContainer.querySelector('img');
let findNewImage = findContainer.querySelector('.zoomImage-background');
expect(findNewImage.src).toEqual(srcZoom);
expect(findNewImage.style.backgroundImage).toEqual(`url("${srcZoom}")`);
});
});

View File

@ -0,0 +1,17 @@
import ngModule from '../module';
function vnVisibleBy(aclService) {
return {
restrict: 'A',
priority: -1,
link: function($scope, $element, $attrs) {
let acls = $attrs.vnVisibleBy.split(',');
if (!aclService.aclPermission(acls)) {
$element[0].style.visibility = 'hidden';
}
}
};
}
vnVisibleBy.$inject = ['aclService'];
ngModule.directive('vnVisibleBy', vnVisibleBy);

View File

@ -4,7 +4,6 @@ export function directive($timeout) {
let idContainer = 'zoomImage';
let container;
let background;
let image;
function createContainers(src) {
if (document.getElementById(idContainer)) {
@ -15,31 +14,21 @@ export function directive($timeout) {
background = document.createElement('div');
background.className = 'zoomImage-background';
background.style.backgroundImage = `url(${src})`;
container.appendChild(background);
image = document.createElement('img');
image.src = src;
container.appendChild(image);
document.body.appendChild(container);
$timeout(() => {
resizeImage();
container.className = 'open';
}, 250);
}
function addListeners() {
background.addEventListener('click', destroyContainers);
document.addEventListener('keydown', e => keyDownHandler(e));
window.addEventListener('resize', resizeImage);
}
function removeListeners() {
if (container) {
background.removeEventListener('click', destroyContainers);
document.removeEventListener('keydown', e => keyDownHandler(e));
window.removeEventListener('resize', resizeImage);
}
}
@ -57,14 +46,6 @@ export function directive($timeout) {
container = undefined;
background = undefined;
image = undefined;
}
function resizeImage() {
if (image) {
image.style.marginLeft = `-${Math.floor(image.clientWidth / 2)}px`;
image.style.marginTop = `-${Math.floor(image.clientHeight / 2)}px`;
}
}
return {

View File

@ -9,32 +9,11 @@ div#zoomImage, div#zoomImage .zoomImage-background {
top: 0;
z-index: 11;
}
div#zoomImage{
opacity: 0;
transition: visibility 0s, opacity 0.5s linear;
}
div#zoomImage .zoomImage-background{
background: rgba(0, 0, 0, 0.7);
background-color: rgba(0, 0, 0, 0.7);
cursor: zoom-out;
}
div#zoomImage img{
z-index: 12;
position: fixed;
max-height: 98%;
max-width: 98%;
left: 50%;
top: 50%;
opacity: 0;
transition: visibility 0s, opacity 1s linear;
}
div#zoomImage.open {
visibility: visible;
opacity: 1;
}
div#zoomImage.open img{
visibility: visible;
opacity: 1;
background-repeat: no-repeat;
background-position: center center;
background-size: auto 98%;
}

View File

@ -79,17 +79,6 @@
"description": "Botanical",
"icon": "folder"
}
},{
"url" : "/picture",
"state": "item.card.picture",
"component": "vn-item-picture",
"params": {
"item": "$ctrl.item"
},
"menu": {
"description": "Picture",
"icon": "folder"
}
},{
"url" : "/barcode",
"state": "item.card.barcode",

View File

@ -3,10 +3,14 @@
<vn-auto class="descriptor-header pointer" ui-sref="item.index">
<img ng-src="/static/images/icon_item.png"/>
</vn-auto>
<vn-auto pad-medium text-center>
<vn-auto style="position: relative" pad-medium text-center>
<img
ng-src="http://verdnatura.es/vn-image-data/catalog/200x200/{{$ctrl.item.image}}"
zoom-image="http://verdnatura.es/vn-image-data/catalog/900x900/{{$ctrl.item.image}}" on-error-src/>
ng-src="http://verdnatura.es/vn-image-data/catalog/200x200/{{::$ctrl.item.image}}"
zoom-image="http://verdnatura.es/vn-image-data/catalog/900x900/{{::$ctrl.item.image}}" on-error-src/>
<a href="https://www.verdnatura.es/#!form=admin/items&filter={{::$ctrl.item.id}}" target="_blank"><vn-float-button icon="edit"
style="position: absolute; bottom: 1em; right: 1em;"
vn-visible-by="administrative"></vn-float-button>
</a>
</vn-auto>
<vn-auto pad-medium>
<div><span translate>Id</span>: <b>{{$ctrl.item.id}}</b></div>

View File

@ -11,6 +11,5 @@ import './tags/item-tags';
import './history/item-history';
import './niche/item-niche';
import './botanical/item-botanical';
import './picture/item-picture';
import './barcode/item-barcode';

View File

@ -8,8 +8,7 @@
on-search="$ctrl.search(index)"
advanced="true"
popover="vn-item-filter-panel"
ignore-keys = "['page', 'size', 'search']"
>
ignore-keys = "['page', 'size', 'search']">
</vn-searchbar>
</vn-horizontal>
</vn-card>

View File

@ -13,7 +13,6 @@ Item history: Historial del artículo
Item tags: Tags del artículo
Niche: Nicho
Picture: Foto
Item pictures: Fotos del artículo
Barcode: Código barras
Item barcode: Código de barras del artículo
Changed by: Cambiado por

View File

@ -1,5 +0,0 @@
<vn-card>
<vn-vertical pad-large>
<vn-title>Item pictures</vn-title>
</vn-vertical>
</vn-card>

View File

@ -1,5 +0,0 @@
import ngModule from '../module';
ngModule.component('vnItemPicture', {
template: require('./item-picture.html')
});

View File

@ -1,14 +1,5 @@
<div style="position: fixed; top: 0; right: 0; padding: .8em 1.5em; z-index: 10;">
<vn-icon icon="apps" id="apps" translate-attr="{title: 'Applications'}"></vn-icon>
<ul for="langs" class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-small>
<li
ng-repeat="lang in ::$ctrl.langs"
class="mdl-menu__item"
ng-click="$ctrl.onChangeLangClick(lang)">
<span>{{::lang}}</span>
</li>
</ul>
<vn-icon icon="language" id="langs" translate-attr="{title: 'Change language'}"></vn-icon>
<ul for="apps" class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-small>
<li ng-repeat="mod in ::$ctrl.modules" class="mdl-menu__item" ui-sref="{{::mod.route.state}}">
<vn-icon ng-if="::mod.icon && !mod.icon.startsWith('/')" icon="{{::mod.icon}}"></vn-icon>
@ -16,6 +7,16 @@
<span translate="{{::mod.name}}"></span>
</li>
</ul>
<vn-icon id="lang-button" icon="language" translate-attr="{title: 'Change language'}"></vn-icon>
<ul id="langs" for="lang-button" class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-small>
<li
ng-repeat="lang in ::$ctrl.langs"
name="{{::lang}}"
class="mdl-menu__item"
ng-click="$ctrl.onChangeLangClick(lang)">
<span>{{::lang}}</span>
</li>
</ul>
<vn-icon icon="exit_to_app" translate-attr="{title: 'Logout'}" ng-click="$ctrl.onLogoutClick()"></vn-icon>
<!--
TODO: Keep it commented until they are functional

View File

@ -128,17 +128,17 @@ Nightmare.action('waitForTextInElement', function(selector, name, done) {
});
Nightmare.action('changeLanguageToEnglish', function(done) {
this.wait(selectors.globalItems.languageButton)
this.wait('#lang-button')
.evaluate(selector => {
return document.querySelector(selector).title;
}, selectors.globalItems.languageButton)
.then(result => {
if (result === 'Cambiar idioma') {
this.click(selectors.globalItems.languageButton)
.then(done);
}
if (result === 'Change language') {
}, '#lang-button')
.then(title => {
if (title === 'Change language') {
this.then(done);
} else {
this.click('#lang-button')
.click('#langs > li[name="en"]')
.then(done);
}
});
});

View File

@ -10,7 +10,6 @@ export default {
globalItems: {
topBar: `${components.vnTopbar}`,
logOutButton: `${components.vnIcon}[icon="exit_to_app"]`,
languageButton: `${components.vnIcon}[icon="language"]`,
snackbarIsActive: '.mdl-snackbar--active > .mdl-snackbar__text',
applicationsMenuButton: `${components.vnIcon}[icon="apps"]`,
applicationsMenuVisible: `${components.vnMainMenu} .is-visible > div`,
@ -54,7 +53,7 @@ export default {
socialNameInput: `${components.vnTextfield}[name="socialName"]`,
fiscalIdInput: `${components.vnTextfield}[name="fi"]`,
equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`,
acceptPropagationButton: `body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(2)`,
acceptPropagationButton: `vn-client-fiscal-data vn-confirm button[response="ACCEPT"]`,
addressInput: `${components.vnTextfield}[name="street"]`,
cityInput: `${components.vnTextfield}[name="city"]`,
postcodeInput: `${components.vnTextfield}[name="postcode"]`,
@ -77,7 +76,7 @@ export default {
payMethodOptionOne: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
IBANInput: `${components.vnTextfield}[name="iban"]`,
dueDayInput: `${components.vnTextfield}[name="dueDay"]`,
cancelNotificationButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-billing-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)',
cancelNotificationButton: 'vn-client-billing-data > vn-dialog tpl-buttons > button:nth-child(1)',
receivedCoreVNHCheckbox: `${components.vnCheck}[label='Received core VNH'] > label > input`,
receivedCoreVNLCheckbox: `${components.vnCheck}[label='Received core VNL'] > label > input`,
receivedB2BVNLCheckbox: `${components.vnCheck}[label='Received B2B VNL'] > label > input`,

View File

@ -52,7 +52,7 @@ gulp.task('services', async () => {
});
/**
* Starts all backend services.
* Starts backend services.
*/
gulp.task('services-only', async () => {
const services = await getServices();

916
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,5 +4,6 @@
"Unable to mark the equivalence surcharge": "Unable to mark the equivalence surcharge",
"The default consignee can not be unchecked": "The default consignee can not be unchecked",
"Unable to default a disabled consignee": "Unable to default a disabled consignee",
"El método de pago seleccionado requiere que se especifique el IBAN": "El método de pago seleccionado requiere que se especifique el IBAN"
"El método de pago seleccionado requiere que se especifique el IBAN": "El método de pago seleccionado requiere que se especifique el IBAN",
"Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre"
}