diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index 39237cf7d3..f46ea1a064 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -9374,6 +9374,10 @@ var _alert = __webpack_require__(44); var _alert2 = _interopRequireDefault(_alert); +var _dialog = __webpack_require__(1); + +var _dialog2 = _interopRequireDefault(_dialog); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -9464,6 +9468,12 @@ var workzone = function workzone(services) { openExposePublicationAdd(); }); + (0, _jquery2.default)('.refresh-list').on('click', function (event) { + var exposeName = (0, _jquery2.default)('#expose_list').val(); + (0, _jquery2.default)('.publication-list').empty().html('loading'); + updatePublicationList(exposeName); + }); + (0, _jquery2.default)('#expose_list').on('change', function () { (0, _jquery2.default)('.publication-list').empty().html('loading'); updatePublicationList(this.value); @@ -9961,38 +9971,80 @@ var workzone = function workzone(services) { var exposeName = (0, _jquery2.default)('#expose_list').val(); var assetsContainer = (0, _jquery2.default)(this).parents('.expose_drag_drop'); - _jquery2.default.ajax({ - type: 'POST', - url: '/prod/expose/publication/delete-asset/' + publicationId + '/' + assetId + '/?exposeName=' + exposeName, - beforeSend: function beforeSend() { - assetsContainer.addClass('loading'); - }, - success: function success(data) { - if (data.success === true) { - assetsContainer.removeClass('loading'); - getPublicationAssetsList(publicationId, exposeName, assetsContainer); - } else { - console.log(data); - } - } + var buttons = {}; + + var $dialog = _dialog2.default.create(services, { + size: '480x160', + title: localeService.t('warning') }); + + buttons[localeService.t('valider')] = function () { + $dialog.setContent('loading'); + + _jquery2.default.ajax({ + type: 'POST', + url: '/prod/expose/publication/delete-asset/' + publicationId + '/' + assetId + '/?exposeName=' + exposeName, + beforeSend: function beforeSend() { + assetsContainer.addClass('loading'); + }, + success: function success(data) { + if (data.success === true) { + $dialog.close(); + assetsContainer.removeClass('loading'); + getPublicationAssetsList(publicationId, exposeName, assetsContainer); + } else { + $dialog.setContent(data.message); + console.log(data); + } + } + }); + }; + + buttons[localeService.t('annuler')] = function () { + $dialog.close(); + }; + + var texte = '

' + localeService.t('removeAssetPublication') + '

'; + + $dialog.setOption('buttons', buttons); + $dialog.setContent(texte); }); (0, _jquery2.default)('#idFrameC').find('.publication-droppable').on('click', '.delete-publication', function () { var publicationId = (0, _jquery2.default)(this).attr('data-publication-id'); var exposeName = (0, _jquery2.default)('#expose_list').val(); + var buttons = {}; - _jquery2.default.ajax({ - type: 'POST', - url: '/prod/expose/delete-publication/' + publicationId + '/?exposeName=' + exposeName, - success: function success(data) { - if (data.success === true) { - updatePublicationList(exposeName); - } else { - console.log(data); - } - } + var $dialog = _dialog2.default.create(services, { + size: '480x160', + title: localeService.t('warning') }); + + buttons[localeService.t('valider')] = function () { + $dialog.setContent('loading'); + _jquery2.default.ajax({ + type: 'POST', + url: '/prod/expose/delete-publication/' + publicationId + '/?exposeName=' + exposeName, + success: function success(data) { + if (data.success === true) { + $dialog.close(); + updatePublicationList(exposeName); + } else { + $dialog.setContent(data.message); + console.log(data); + } + } + }); + }; + + buttons[localeService.t('annuler')] = function () { + $dialog.close(); + }; + + var texte = '

' + localeService.t('removeExposePublication') + '

'; + + $dialog.setOption('buttons', buttons); + $dialog.setContent(texte); }); } @@ -10021,7 +10073,7 @@ var workzone = function workzone(services) { type: 'GET', url: '/prod/expose/get-publication/' + publicationId + '?exposeName=' + exposeName + '&onlyAssets=1', beforeSend: function beforeSend() { - assetsContainer.addClass('loading'); + assetsContainer.empty().addClass('loading'); }, success: function success(data) { if (typeof data.success === 'undefined') { diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index 39237cf7d3..f46ea1a064 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -9374,6 +9374,10 @@ var _alert = __webpack_require__(44); var _alert2 = _interopRequireDefault(_alert); +var _dialog = __webpack_require__(1); + +var _dialog2 = _interopRequireDefault(_dialog); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -9464,6 +9468,12 @@ var workzone = function workzone(services) { openExposePublicationAdd(); }); + (0, _jquery2.default)('.refresh-list').on('click', function (event) { + var exposeName = (0, _jquery2.default)('#expose_list').val(); + (0, _jquery2.default)('.publication-list').empty().html('loading'); + updatePublicationList(exposeName); + }); + (0, _jquery2.default)('#expose_list').on('change', function () { (0, _jquery2.default)('.publication-list').empty().html('loading'); updatePublicationList(this.value); @@ -9961,38 +9971,80 @@ var workzone = function workzone(services) { var exposeName = (0, _jquery2.default)('#expose_list').val(); var assetsContainer = (0, _jquery2.default)(this).parents('.expose_drag_drop'); - _jquery2.default.ajax({ - type: 'POST', - url: '/prod/expose/publication/delete-asset/' + publicationId + '/' + assetId + '/?exposeName=' + exposeName, - beforeSend: function beforeSend() { - assetsContainer.addClass('loading'); - }, - success: function success(data) { - if (data.success === true) { - assetsContainer.removeClass('loading'); - getPublicationAssetsList(publicationId, exposeName, assetsContainer); - } else { - console.log(data); - } - } + var buttons = {}; + + var $dialog = _dialog2.default.create(services, { + size: '480x160', + title: localeService.t('warning') }); + + buttons[localeService.t('valider')] = function () { + $dialog.setContent('loading'); + + _jquery2.default.ajax({ + type: 'POST', + url: '/prod/expose/publication/delete-asset/' + publicationId + '/' + assetId + '/?exposeName=' + exposeName, + beforeSend: function beforeSend() { + assetsContainer.addClass('loading'); + }, + success: function success(data) { + if (data.success === true) { + $dialog.close(); + assetsContainer.removeClass('loading'); + getPublicationAssetsList(publicationId, exposeName, assetsContainer); + } else { + $dialog.setContent(data.message); + console.log(data); + } + } + }); + }; + + buttons[localeService.t('annuler')] = function () { + $dialog.close(); + }; + + var texte = '

' + localeService.t('removeAssetPublication') + '

'; + + $dialog.setOption('buttons', buttons); + $dialog.setContent(texte); }); (0, _jquery2.default)('#idFrameC').find('.publication-droppable').on('click', '.delete-publication', function () { var publicationId = (0, _jquery2.default)(this).attr('data-publication-id'); var exposeName = (0, _jquery2.default)('#expose_list').val(); + var buttons = {}; - _jquery2.default.ajax({ - type: 'POST', - url: '/prod/expose/delete-publication/' + publicationId + '/?exposeName=' + exposeName, - success: function success(data) { - if (data.success === true) { - updatePublicationList(exposeName); - } else { - console.log(data); - } - } + var $dialog = _dialog2.default.create(services, { + size: '480x160', + title: localeService.t('warning') }); + + buttons[localeService.t('valider')] = function () { + $dialog.setContent('loading'); + _jquery2.default.ajax({ + type: 'POST', + url: '/prod/expose/delete-publication/' + publicationId + '/?exposeName=' + exposeName, + success: function success(data) { + if (data.success === true) { + $dialog.close(); + updatePublicationList(exposeName); + } else { + $dialog.setContent(data.message); + console.log(data); + } + } + }); + }; + + buttons[localeService.t('annuler')] = function () { + $dialog.close(); + }; + + var texte = '

' + localeService.t('removeExposePublication') + '

'; + + $dialog.setOption('buttons', buttons); + $dialog.setContent(texte); }); } @@ -10021,7 +10073,7 @@ var workzone = function workzone(services) { type: 'GET', url: '/prod/expose/get-publication/' + publicationId + '?exposeName=' + exposeName + '&onlyAssets=1', beforeSend: function beforeSend() { - assetsContainer.addClass('loading'); + assetsContainer.empty().addClass('loading'); }, success: function success(data) { if (typeof data.success === 'undefined') { diff --git a/Phraseanet-production-client/src/components/ui/workzone/index.js b/Phraseanet-production-client/src/components/ui/workzone/index.js index 61a1701597..64a224525d 100644 --- a/Phraseanet-production-client/src/components/ui/workzone/index.js +++ b/Phraseanet-production-client/src/components/ui/workzone/index.js @@ -5,6 +5,7 @@ import workzoneFacets from './facets/index'; import workzoneBaskets from './baskets/index'; import Selectable from '../../utils/selectable'; import Alerts from '../../utils/alert'; +import dialog from './../../../phraseanet-common/components/dialog'; const humane = require('humane-js'); require('./../../../phraseanet-common/components/tooltip'); require('./../../../phraseanet-common/components/vendors/contextMenu'); @@ -93,6 +94,12 @@ const workzone = (services) => { openExposePublicationAdd(); }); + $('.refresh-list').on('click',function (event) { + let exposeName = $('#expose_list').val(); + $('.publication-list').empty().html('loading'); + updatePublicationList(exposeName); + }); + $('#expose_list').on('change', function () { $('.publication-list').empty().html('loading'); updatePublicationList(this.value); @@ -592,40 +599,81 @@ const workzone = (services) => { let exposeName = $('#expose_list').val(); let assetsContainer = $(this).parents('.expose_drag_drop'); - $.ajax({ - type: 'POST', - url: `/prod/expose/publication/delete-asset/${publicationId}/${assetId}/?exposeName=${exposeName}`, - beforeSend: function () { - assetsContainer.addClass('loading'); - }, - success: function (data) { - if (data.success === true) { - assetsContainer.removeClass('loading'); - getPublicationAssetsList(publicationId, exposeName, assetsContainer); - } else { - console.log(data); - } - } + let buttons = {}; + + let $dialog = dialog.create(services, { + size: '480x160', + title: localeService.t('warning') }); + + buttons[localeService.t('valider')] = function () { + $dialog.setContent('loading'); + + $.ajax({ + type: 'POST', + url: `/prod/expose/publication/delete-asset/${publicationId}/${assetId}/?exposeName=${exposeName}`, + beforeSend: function () { + assetsContainer.addClass('loading'); + }, + success: function (data) { + if (data.success === true) { + $dialog.close(); + assetsContainer.removeClass('loading'); + getPublicationAssetsList(publicationId, exposeName, assetsContainer); + } else { + $dialog.setContent(data.message); + console.log(data); + } + } + }); + }; + + buttons[localeService.t('annuler')] = function () { + $dialog.close(); + }; + + let texte = '

' + localeService.t('removeAssetPublication') + '

'; + + $dialog.setOption('buttons', buttons); + $dialog.setContent(texte); }); - $('#idFrameC').find('.publication-droppable').on('click', '.delete-publication', function(){ + $('#idFrameC').find('.publication-droppable').on('click', '.delete-publication', function() { let publicationId = $(this).attr('data-publication-id'); let exposeName = $('#expose_list').val(); + let buttons = {}; - $.ajax({ - type: 'POST', - url: `/prod/expose/delete-publication/${publicationId}/?exposeName=${exposeName}`, - success: function (data) { - if (data.success === true) { - updatePublicationList(exposeName); - } else { - console.log(data); - } - } + let $dialog = dialog.create(services, { + size: '480x160', + title: localeService.t('warning') }); - }); + buttons[localeService.t('valider')] = function () { + $dialog.setContent('loading'); + $.ajax({ + type: 'POST', + url: `/prod/expose/delete-publication/${publicationId}/?exposeName=${exposeName}`, + success: function (data) { + if (data.success === true) { + $dialog.close(); + updatePublicationList(exposeName); + } else { + $dialog.setContent(data.message); + console.log(data); + } + } + }); + }; + + buttons[localeService.t('annuler')] = function () { + $dialog.close(); + }; + + let texte = '

' + localeService.t('removeExposePublication') + '

'; + + $dialog.setOption('buttons', buttons); + $dialog.setContent(texte); + }); } function updatePublicationList(exposeName) @@ -655,7 +703,7 @@ const workzone = (services) => { type: 'GET', url: `/prod/expose/get-publication/${publicationId}?exposeName=${exposeName}&onlyAssets=1`, beforeSend: function () { - assetsContainer.addClass('loading'); + assetsContainer.empty().addClass('loading'); }, success: function (data) { if (typeof data.success === 'undefined') { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/LanguageController.php b/lib/Alchemy/Phrasea/Controller/Prod/LanguageController.php index e86b858b92..f0cb5fd244 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/LanguageController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/LanguageController.php @@ -59,6 +59,8 @@ class LanguageController 'feed_require_fields' => $translator->trans('Vous n\'avez pas rempli tous les champ requis'), 'feed_require_feed' => $translator->trans('Vous n\'avez pas selectionne de fil de publication'), 'removeTitle' => $translator->trans('panier::Supression d\'un element d\'un reportage'), + 'removeExposePublication' => $translator->trans('expose::Your are about to delete a publication from expose, please confirm your action !'), + 'removeAssetPublication' => $translator->trans('expose::Your are about to delete an asset from a publication, please confirm your action !'), 'confirmRemoveReg' => $translator->trans('panier::Attention, vous etes sur le point de supprimer un element du reportage. Merci de confirmer votre action.'), 'advsearch_title' => $translator->trans('phraseanet::recherche avancee'), 'bask_rename' => $translator->trans('panier:: renommer le panier'), diff --git a/templates/web/prod/WorkZone/ExposeList.html.twig b/templates/web/prod/WorkZone/ExposeList.html.twig index cee4fd6e14..dac021f3ee 100644 --- a/templates/web/prod/WorkZone/ExposeList.html.twig +++ b/templates/web/prod/WorkZone/ExposeList.html.twig @@ -14,9 +14,13 @@
- - Delete - + {% if publication.children|length == 0 %} + + {% else %} + Parent publication + {% endif %}
diff --git a/templates/web/prod/WorkZone/Macros.html.twig b/templates/web/prod/WorkZone/Macros.html.twig index f3e00f9902..9bbe37aa4a 100644 --- a/templates/web/prod/WorkZone/Macros.html.twig +++ b/templates/web/prod/WorkZone/Macros.html.twig @@ -479,13 +479,21 @@ {% endfor %}
- + +
+{#
#} {% import 'prod/WorkZone/ExposeNew.html.twig' as ExposeNew %}