mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
fix edit and list
This commit is contained in:
36
Phraseanet-production-client/dist/production.js
vendored
36
Phraseanet-production-client/dist/production.js
vendored
@@ -9461,7 +9461,7 @@ var workzone = function workzone(services) {
|
||||
});
|
||||
|
||||
(0, _jquery2.default)('.add_expose').on('click', function (event) {
|
||||
openExposeModalOnBasket('#DIALOG-expose-add');
|
||||
openExposePublicationAdd();
|
||||
});
|
||||
|
||||
(0, _jquery2.default)('#expose_list').on('change', function () {
|
||||
@@ -9477,7 +9477,7 @@ var workzone = function workzone(services) {
|
||||
(0, _jquery2.default)(this).toggleClass('open');
|
||||
});
|
||||
(0, _jquery2.default)('.edit_expose').on('click', function (event) {
|
||||
openExposeModalOnBasket();
|
||||
openExposePublicationEdit();
|
||||
});
|
||||
|
||||
activeExpose();
|
||||
@@ -10102,10 +10102,8 @@ var workzone = function workzone(services) {
|
||||
});
|
||||
}
|
||||
|
||||
function openExposeModalOnBasket() {
|
||||
var edit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#DIALOG-expose-edit';
|
||||
|
||||
(0, _jquery2.default)(edit).attr('title', localeService.t('Edit expose title')).dialog({
|
||||
function openExposePublicationAdd() {
|
||||
(0, _jquery2.default)('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title')).dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
@@ -10116,10 +10114,34 @@ var workzone = function workzone(services) {
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function close(e, ui) {}
|
||||
}).dialog('open');
|
||||
(0, _jquery2.default)('.ui-dialog').addClass('black-dialog-wrap publish-dialog');
|
||||
(0, _jquery2.default)('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
|
||||
(0, _jquery2.default)('#DIALOG-expose-add').dialog('close');
|
||||
});
|
||||
}
|
||||
|
||||
function openExposePublicationEdit() {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').attr('title', localeService.t('Edit expose title')).dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
width: 900,
|
||||
height: 575,
|
||||
modal: true,
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function close(e, ui) {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').empty();
|
||||
}
|
||||
}).dialog('open');
|
||||
(0, _jquery2.default)('.ui-dialog').addClass('black-dialog-wrap publish-dialog');
|
||||
(0, _jquery2.default)('.close-expose-modal').on('click', function () {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').on('click', '.close-expose-modal', function () {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').dialog('close');
|
||||
});
|
||||
}
|
||||
|
@@ -9461,7 +9461,7 @@ var workzone = function workzone(services) {
|
||||
});
|
||||
|
||||
(0, _jquery2.default)('.add_expose').on('click', function (event) {
|
||||
openExposeModalOnBasket('#DIALOG-expose-add');
|
||||
openExposePublicationAdd();
|
||||
});
|
||||
|
||||
(0, _jquery2.default)('#expose_list').on('change', function () {
|
||||
@@ -9477,7 +9477,7 @@ var workzone = function workzone(services) {
|
||||
(0, _jquery2.default)(this).toggleClass('open');
|
||||
});
|
||||
(0, _jquery2.default)('.edit_expose').on('click', function (event) {
|
||||
openExposeModalOnBasket();
|
||||
openExposePublicationEdit();
|
||||
});
|
||||
|
||||
activeExpose();
|
||||
@@ -10102,10 +10102,8 @@ var workzone = function workzone(services) {
|
||||
});
|
||||
}
|
||||
|
||||
function openExposeModalOnBasket() {
|
||||
var edit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#DIALOG-expose-edit';
|
||||
|
||||
(0, _jquery2.default)(edit).attr('title', localeService.t('Edit expose title')).dialog({
|
||||
function openExposePublicationAdd() {
|
||||
(0, _jquery2.default)('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title')).dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
@@ -10116,10 +10114,34 @@ var workzone = function workzone(services) {
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function close(e, ui) {}
|
||||
}).dialog('open');
|
||||
(0, _jquery2.default)('.ui-dialog').addClass('black-dialog-wrap publish-dialog');
|
||||
(0, _jquery2.default)('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
|
||||
(0, _jquery2.default)('#DIALOG-expose-add').dialog('close');
|
||||
});
|
||||
}
|
||||
|
||||
function openExposePublicationEdit() {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').attr('title', localeService.t('Edit expose title')).dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
width: 900,
|
||||
height: 575,
|
||||
modal: true,
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function close(e, ui) {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').empty();
|
||||
}
|
||||
}).dialog('open');
|
||||
(0, _jquery2.default)('.ui-dialog').addClass('black-dialog-wrap publish-dialog');
|
||||
(0, _jquery2.default)('.close-expose-modal').on('click', function () {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').on('click', '.close-expose-modal', function () {
|
||||
(0, _jquery2.default)('#DIALOG-expose-edit').dialog('close');
|
||||
});
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ const workzone = (services) => {
|
||||
});
|
||||
|
||||
$('.add_expose').on('click',function (event) {
|
||||
openExposeModalOnBasket('#DIALOG-expose-add');
|
||||
openExposePublicationAdd();
|
||||
});
|
||||
|
||||
$('#expose_list').on('change', function () {
|
||||
@@ -106,7 +106,7 @@ const workzone = (services) => {
|
||||
$(this).toggleClass('open');
|
||||
});
|
||||
$('.edit_expose').on('click',function (event) {
|
||||
openExposeModalOnBasket();
|
||||
openExposePublicationEdit();
|
||||
});
|
||||
|
||||
activeExpose();
|
||||
@@ -741,8 +741,8 @@ const workzone = (services) => {
|
||||
});
|
||||
}
|
||||
|
||||
function openExposeModalOnBasket(edit = '#DIALOG-expose-edit') {
|
||||
$(edit).attr('title', localeService.t('Edit expose title'))
|
||||
function openExposePublicationAdd() {
|
||||
$('#DIALOG-expose-add').attr('title', localeService.t('Edit expose title'))
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
@@ -754,10 +754,36 @@ const workzone = (services) => {
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function(e, ui) {
|
||||
}
|
||||
}).dialog('open');
|
||||
$('.ui-dialog').addClass('black-dialog-wrap publish-dialog');
|
||||
$('.close-expose-modal').on('click', function () {
|
||||
$('#DIALOG-expose-add').on('click', '.close-expose-modal', function () {
|
||||
$('#DIALOG-expose-add').dialog('close');
|
||||
});
|
||||
}
|
||||
|
||||
function openExposePublicationEdit() {
|
||||
$('#DIALOG-expose-edit').attr('title', localeService.t('Edit expose title'))
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
width: 900,
|
||||
height: 575,
|
||||
modal: true,
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
},
|
||||
close: function(e, ui) {
|
||||
$('#DIALOG-expose-edit').empty();
|
||||
}
|
||||
}).dialog('open');
|
||||
$('.ui-dialog').addClass('black-dialog-wrap publish-dialog');
|
||||
$('#DIALOG-expose-edit').on('click', '.close-expose-modal', function () {
|
||||
$('#DIALOG-expose-edit').dialog('close');
|
||||
});
|
||||
}
|
||||
|
@@ -65,7 +65,12 @@ class PSExposeController extends Controller
|
||||
]);
|
||||
|
||||
if ($resPublication->getStatusCode() == 200) {
|
||||
$publications[] = json_decode($resPublication->getBody()->getContents(),true);
|
||||
$publication = json_decode($resPublication->getBody()->getContents(),true);
|
||||
$publications[] = $publication;
|
||||
|
||||
foreach ($publication['children'] as $child ) {
|
||||
$publications[] = $child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,14 +25,22 @@
|
||||
<select id="publication_parent" name="parentId" tabindex="-1" aria-hidden="true"
|
||||
class="publication-field">
|
||||
<option value="">Select a parent publication</option>
|
||||
{% if publication.parent %}
|
||||
<option value="{{ publication.parent.id }}" selected="selected">{{ publication.parent.title }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-widget profile-wrapper hide">
|
||||
<label>Profile </label>
|
||||
{% set nbProfile = publication.profile|length %}
|
||||
|
||||
<select id="profile-field" name="profile" tabindex="-1" aria-hidden="true"
|
||||
class="publication-field">
|
||||
<option value="">Select Profile</option>
|
||||
{% if nbProfile %}
|
||||
<option value="{{ publication.profile.id }}">{{ publication.profile.name }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui-widget">
|
||||
@@ -183,8 +191,6 @@
|
||||
publicationParent.empty().html('<option value="">Select a parent publication</option>');
|
||||
for (i = 0; i < data.publications.length; i++) {
|
||||
let selected = '';
|
||||
console.log({{ publication.parent.id }} + '::::' + data.publications[i].id);
|
||||
|
||||
if (data.publications[i].id == '{{ parentId }}') {
|
||||
selected = 'selected="selected"';
|
||||
}
|
||||
@@ -195,6 +201,28 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: `/prod/expose/list-profile?exposeName={{ exposeName }}`,
|
||||
success: function (data) {
|
||||
profileField.empty().html('<option value="">Select Profile</option>');;
|
||||
for (i = 0; i < data.profiles.length; i++) {
|
||||
let selected = '';
|
||||
if ({{ nbProfile }} && data.profiles[i].id === '{{ publication.profile.id }}') {
|
||||
selected = 'selected="selected"';
|
||||
}
|
||||
|
||||
$('#DIALOG-expose-edit select#profile-field').append('<option ' +
|
||||
'value=' + data.basePath + '/' + data.profiles[i].id + ' ' + selected + ' >'
|
||||
+ data.profiles[i].name +
|
||||
'</option>'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**convert Object data to Json**/
|
||||
|
@@ -162,15 +162,15 @@
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".toggleSetting").click(function (e) {
|
||||
$("#DIALOG-expose-add .toggleSetting").click(function (e) {
|
||||
$(this).toggleClass('open');
|
||||
$('#advancedSettingInner').toggleClass('hidden');
|
||||
$('#DIALOG-expose-add #advancedSettingInner').toggleClass('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
function buildData() {
|
||||
try {
|
||||
var allData = $('#publication-data-form').serializeArray();
|
||||
var allData = $('#DIALOG-expose-add #publication-data-form').serializeArray();
|
||||
// console.log(allData);
|
||||
var dataValue = allData.reduce((acc, it) => {
|
||||
acc[it.name] = it.value;
|
||||
@@ -227,11 +227,11 @@
|
||||
function removeSecurityField() {
|
||||
var datavalueMinus = buildData();
|
||||
|
||||
if ($("#publication_parent").val() == "") {
|
||||
if ($("#DIALOG-expose-add #publication_parent").val() == "") {
|
||||
delete datavalueMinus['parentId'];
|
||||
}
|
||||
|
||||
if ($("#profile-field").val() == "") {
|
||||
if ($("#DIALOG-expose-add #profile-field").val() == "") {
|
||||
delete datavalueMinus['profile'];
|
||||
}
|
||||
;
|
||||
@@ -245,12 +245,12 @@
|
||||
delete datavalueMinus['beginsAt'];
|
||||
delete datavalueMinus['expiresAt'];
|
||||
|
||||
$('#advancedSetting').val(JSON.stringify(datavalueMinus, undefined, 4));
|
||||
$('#DIALOG-expose-add #advancedSetting').val(JSON.stringify(datavalueMinus, undefined, 4));
|
||||
console.log(JSON.stringify(datavalueMinus, undefined, 4));
|
||||
|
||||
}
|
||||
|
||||
$('.publication-field').on('keyup change', function (e) {
|
||||
$('#DIALOG-expose-add .publication-field').on('keyup change', function (e) {
|
||||
removeSecurityField();
|
||||
/**Toggle display the Security option field**/
|
||||
$("#publication_securityMethod").change(function (e) {
|
||||
@@ -268,13 +268,13 @@
|
||||
dataValue["securityMethod"] = Svalue;
|
||||
|
||||
if (Svalue == 'authentication') {
|
||||
$("#publication_password").val('');
|
||||
$("#publication_securityMethod_error").removeClass('hidden');
|
||||
$("#DIALOG-expose-add #publication_password").val('');
|
||||
$("#DIALOG-expose-add #publication_securityMethod_error").removeClass('hidden');
|
||||
} else {
|
||||
$("#publication_securityMethod_error").addClass('hidden');
|
||||
$("#DIALOG-expose-add #publication_securityMethod_error").addClass('hidden');
|
||||
}
|
||||
} else {
|
||||
$("#publication_password").val('');
|
||||
$("#DIALOG-expose-add #publication_password").val('');
|
||||
};
|
||||
removeSecurityField();
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
});
|
||||
|
||||
|
||||
$('#publication-json').on('submit', function (e) {
|
||||
$('#DIALOG-expose-add #publication-json').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
try {
|
||||
$("#pub-error").addClass("hidden");
|
||||
@@ -308,7 +308,7 @@
|
||||
dataType: 'json',
|
||||
data: {
|
||||
exposeName: $('#expose_name').val(),
|
||||
publicationData: $('#advancedSetting').val()
|
||||
publicationData: $('#DIALOG-expose-add #advancedSetting').val()
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.success) {
|
||||
@@ -320,7 +320,7 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
$('.publication-field').on('keyup change', function (e) {
|
||||
$('#DIALOG-expose-add .publication-field').on('keyup change', function (e) {
|
||||
try {
|
||||
$("#pub-success").addClass("hidden");
|
||||
$("#pub-error").addClass("hidden");
|
||||
@@ -339,9 +339,9 @@
|
||||
type: "GET",
|
||||
url: `/prod/expose/list-publication/?format=json&exposeName=` + this.value,
|
||||
success: function (data) {
|
||||
$('#publication_parent').empty().html('<option value="">Select a parent publication</option>');
|
||||
$('#DIALOG-expose-add #publication_parent').empty().html('<option value="">Select a parent publication</option>');
|
||||
for (i = 0; i < data.publications.length; i++) {
|
||||
$('select#publication_parent').append('<option value='+data.publications[i].id+' >'+data.publications[i].title+'</option>');
|
||||
$('#DIALOG-expose-add select#publication_parent').append('<option value='+data.publications[i].id+' >'+data.publications[i].title+'</option>');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -351,7 +351,7 @@
|
||||
type: "GET",
|
||||
url: `/prod/expose/list-profile?exposeName=` + this.value,
|
||||
success: function (data) {
|
||||
$('#profile-field').empty().html('<option value="">Select Profile</option>');;
|
||||
$('#DIALOG-expose-add select#profile-field').empty().html('<option value="">Select Profile</option>');;
|
||||
for (i = 0; i < data.profiles.length; i++) {
|
||||
$('select#profile-field').append('<option ' +
|
||||
'value=' + data.basePath + '/' + data.profiles[i].id + ' >'
|
||||
|
Reference in New Issue
Block a user