From 48f0554a6a59f97ef8f3f9ccfea4e1184dd459ba Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 14 Feb 2018 10:06:51 +0100 Subject: [PATCH] Tarea #62 link a la foto --- client/core/src/directives/index.js | 1 + client/core/src/directives/visible-by.js | 17 +++++++++++++++++ client/item/routes.json | 11 ----------- client/item/src/descriptor/item-descriptor.html | 10 +++++++--- client/item/src/item.js | 1 - client/item/src/locale/es.yml | 1 - client/item/src/picture/item-picture.html | 5 ----- client/item/src/picture/item-picture.js | 5 ----- 8 files changed, 25 insertions(+), 26 deletions(-) create mode 100644 client/core/src/directives/visible-by.js delete mode 100644 client/item/src/picture/item-picture.html delete mode 100644 client/item/src/picture/item-picture.js diff --git a/client/core/src/directives/index.js b/client/core/src/directives/index.js index 9a6531b1e..02f922149 100644 --- a/client/core/src/directives/index.js +++ b/client/core/src/directives/index.js @@ -5,3 +5,4 @@ import './validation'; import './acl'; import './on-error-src'; import './zoom-image'; +import './visible-by'; diff --git a/client/core/src/directives/visible-by.js b/client/core/src/directives/visible-by.js new file mode 100644 index 000000000..e05079fb5 --- /dev/null +++ b/client/core/src/directives/visible-by.js @@ -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); diff --git a/client/item/routes.json b/client/item/routes.json index 74dbe6dad..863a8a4b9 100644 --- a/client/item/routes.json +++ b/client/item/routes.json @@ -80,17 +80,6 @@ "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", "component": "vn-item-barcode", diff --git a/client/item/src/descriptor/item-descriptor.html b/client/item/src/descriptor/item-descriptor.html index 3837e838a..a43f7ba0e 100644 --- a/client/item/src/descriptor/item-descriptor.html +++ b/client/item/src/descriptor/item-descriptor.html @@ -3,10 +3,14 @@ - + + 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/> + +
Id: {{$ctrl.item.id}}
diff --git a/client/item/src/item.js b/client/item/src/item.js index 6ba7dd8cf..9ddba12ad 100644 --- a/client/item/src/item.js +++ b/client/item/src/item.js @@ -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'; diff --git a/client/item/src/locale/es.yml b/client/item/src/locale/es.yml index a80590f67..34b6be39a 100644 --- a/client/item/src/locale/es.yml +++ b/client/item/src/locale/es.yml @@ -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 diff --git a/client/item/src/picture/item-picture.html b/client/item/src/picture/item-picture.html deleted file mode 100644 index 93acec3c9..000000000 --- a/client/item/src/picture/item-picture.html +++ /dev/null @@ -1,5 +0,0 @@ - - - Item pictures - - \ No newline at end of file diff --git a/client/item/src/picture/item-picture.js b/client/item/src/picture/item-picture.js deleted file mode 100644 index 20fdd8499..000000000 --- a/client/item/src/picture/item-picture.js +++ /dev/null @@ -1,5 +0,0 @@ -import ngModule from '../module'; - -ngModule.component('vnItemPicture', { - template: require('./item-picture.html') -});