--- a/src/pyams_content/skin/resources/js/pyams_content.js Wed Mar 14 09:43:08 2018 +0100
+++ b/src/pyams_content/skin/resources/js/pyams_content.js Wed Mar 14 09:43:32 2018 +0100
@@ -173,39 +173,6 @@
},
/**
- * Milestones paragraph management
- */
- milestones: {
-
- refreshMilestones: function(options) {
- // Reload widget
- var widget = MyAMS.skin.refreshTable(options);
- // Check fieldset state
- var legend = widget.siblings('legend');
- if (legend.parents('fieldset:first').hasClass('switched')) {
- legend.click();
- }
- },
-
- switchVisibility: function (element) {
- return function () {
- var source = $(this);
- var milestone = source.parents('tr');
- var container = milestone.parents('table');
- MyAMS.ajax.post(container.data('ams-location') + '/set-milestone-visibility.json',
- {object_name: milestone.data('ams-element-name')},
- function (result, status) {
- if (result.visible) {
- $('i', source).attr('class', 'fa fa-fw fa-eye');
- } else {
- $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
- }
- });
- };
- }
- },
-
- /**
* Paragraphs management
*/
paragraphs: {
@@ -352,6 +319,91 @@
},
/**
+ * Milestones paragraph management
+ */
+ milestones: {
+
+ refreshMilestones: function(options) {
+ // Reload widget
+ var widget = MyAMS.skin.refreshTable(options);
+ // Check fieldset state
+ var legend = widget.siblings('legend');
+ if (legend.parents('fieldset:first').hasClass('switched')) {
+ legend.click();
+ }
+ },
+
+ switchVisibility: function (element) {
+ return function () {
+ var source = $(this);
+ var milestone = source.parents('tr');
+ var container = milestone.parents('table');
+ MyAMS.ajax.post(container.data('ams-location') + '/set-milestone-visibility.json',
+ {object_name: milestone.data('ams-element-name')},
+ function (result, status) {
+ if (result.visible) {
+ $('i', source).attr('class', 'fa fa-fw fa-eye');
+ } else {
+ $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
+ }
+ });
+ };
+ }
+ },
+
+ /**
+ * Pictograms management
+ */
+ pictograms: {
+
+ initManagerSelection: function() {
+ var form = $(this);
+ var selected = $('input[type="hidden"]', $('.selected-pictograms', form)).listattr('value');
+ return {
+ selected: JSON.stringify(selected)
+ };
+ },
+
+ switchPictogram: function() {
+ var pictogram = $(this);
+ var parent = pictogram.parents('.pictograms');
+ var manager = parent.parents('.pictograms-manager');
+ if (parent.hasClass('available-pictograms')) {
+ $('.selected-pictograms', manager).append(pictogram);
+ } else {
+ $('.available-pictograms', manager).append(pictogram);
+ }
+ },
+
+ refreshPictograms: function(options) {
+ // Reload widget
+ var widget = MyAMS.skin.refreshTable(options);
+ // Check fieldset state
+ var legend = widget.siblings('legend');
+ if (legend.parents('fieldset:first').hasClass('switched')) {
+ legend.click();
+ }
+ },
+
+ switchVisibility: function (element) {
+ return function () {
+ var source = $(this);
+ var pictogram = source.parents('tr');
+ var container = pictogram.parents('table');
+ MyAMS.ajax.post(container.data('ams-location') + '/set-pictogram-visibility.json',
+ {object_name: pictogram.data('ams-element-name')},
+ function (result, status) {
+ if (result.visible) {
+ $('i', source).attr('class', 'fa fa-fw fa-eye');
+ } else {
+ $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
+ }
+ });
+ };
+ }
+ },
+
+ /**
* Themes management
*/
themes: {
@@ -457,20 +509,6 @@
},
/**
- * Pictograms management
- */
- pictogram: {
-
- initManagerSelection: function() {
- var form = $(this);
- var selected = $('input[type="hidden"]', $('.selected-pictograms', form)).listattr('value');
- return {
- selected: JSON.stringify(selected)
- };
- }
- },
-
- /**
* Types management
*/
types: {