src/pyams_content/skin/resources/js/pyams_content.js
changeset 26 7f025cebf19d
parent 19 25e455568b00
child 35 7cdbe0f6e5c2
equal deleted inserted replaced
25:4f51a7d6e18d 26:7f025cebf19d
    70 				plugin.opts.populateResults.call(plugin, plugin.results, options.files, {term: ''});
    70 				plugin.opts.populateResults.call(plugin, plugin.results, options.files, {term: ''});
    71 			},
    71 			},
    72 
    72 
    73 			refreshContainer: function(changes) {
    73 			refreshContainer: function(changes) {
    74 				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]');
    74 				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]');
    75 				var counter = $('span.count', $('td.extfiles', para));
    75 				var counter = $('span.count', $('div.action.extfiles', para));
    76 				if (changes.nb_files > 0) {
    76 				if (changes.nb_files > 0) {
    77 					counter.text('(' + changes.nb_files + ')');
    77 					counter.text('(' + changes.nb_files + ')');
    78 				} else {
    78 				} else {
    79 					counter.text('');
    79 					counter.text('');
    80 				}
    80 				}
   104 				plugin.opts.populateResults.call(plugin, plugin.results, options.links, {term: ''});
   104 				plugin.opts.populateResults.call(plugin, plugin.results, options.links, {term: ''});
   105 			},
   105 			},
   106 
   106 
   107 			refreshContainer: function(changes) {
   107 			refreshContainer: function(changes) {
   108 				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]');
   108 				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]');
   109 				var counter = $('span.count', $('td.links', para));
   109 				var counter = $('span.count', $('div.action.links', para));
   110 				if (changes.nb_links > 0) {
   110 				if (changes.nb_links > 0) {
   111 					counter.text('(' + changes.nb_links + ')');
   111 					counter.text('(' + changes.nb_links + ')');
   112 				} else {
   112 				} else {
   113 					counter.text('');
   113 					counter.text('');
   114 				}
   114 				}
   171 				};
   171 				};
   172 			},
   172 			},
   173 
   173 
   174 			refreshContainer: function(changes) {
   174 			refreshContainer: function(changes) {
   175 				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]');
   175 				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]');
   176 				var counter = $('span.count', $('td.galleries', para));
   176 				var counter = $('span.count', $('div.action.galleries', para));
   177 				if (changes.nb_galleries > 0) {
   177 				if (changes.nb_galleries > 0) {
   178 					counter.text('(' + changes.nb_galleries + ')');
   178 					counter.text('(' + changes.nb_galleries + ')');
   179 				} else {
   179 				} else {
   180 					counter.text('');
   180 					counter.text('');
   181 				}
   181 				}
   249 
   249 
   250 			switchAllEditors: function(element) {
   250 			switchAllEditors: function(element) {
   251 				var source = $(this);
   251 				var source = $(this);
   252 				var switcher = $('i', source);
   252 				var switcher = $('i', source);
   253 				var container = source.parents('table');
   253 				var container = source.parents('table');
   254 				// TODO: afficher le curseur de la roue qui tourne !!
       
   255 				if (switcher.hasClass('fa-plus-square-o')) {
   254 				if (switcher.hasClass('fa-plus-square-o')) {
   256 					switcher.removeClass('fa-plus-square-o')
   255 					switcher.removeClass('fa-plus-square-o')
   257 							.addClass('fa-cog fa-spin');
   256 							.addClass('fa-cog fa-spin');
   258 					MyAMS.ajax.post(container.data('ams-location') + '/get-paragraphs-editors.json',
   257 					MyAMS.ajax.post(container.data('ams-location') + '/get-paragraphs-editors.json',
   259 									{},
   258 									{},
   350 			case 'links_container':
   349 			case 'links_container':
   351 				PyAMS_content.links.refreshContainer(settings);
   350 				PyAMS_content.links.refreshContainer(settings);
   352 				break;
   351 				break;
   353 			case 'galleries_container':
   352 			case 'galleries_container':
   354 				PyAMS_content.galleries.refreshContainer(settings);
   353 				PyAMS_content.galleries.refreshContainer(settings);
   355 				break;		}
   354 				break;
       
   355 		}
   356 	});
   356 	});
   357 
   357 
   358 })(jQuery, this);
   358 })(jQuery, this);