Files
shop-old/themes/admin/media/js/admin_site_designer.js
T

81 lines
2.5 KiB
JavaScript

$(document).ready(function () {
$('#sortable').sortable({
update: function (e, ui) {
var i = 1;
$(this).children().each(function() {
$('input[name="' + $(this).attr('title') + '"]').attr('value', i++);
});
},
start: function(e, ui) {
$('textarea.content_box_textbox').tinymce().remove();
},
stop: function(e, ui) {
$('textarea.content_box_textbox').tinymce({
script_url : '../../../libs/tinymce/tinymce.min.js',
language : "en",
plugins : 'pagebreak table save preview media searchreplace print contextmenu paste directionality visualchars nonbreaking link code',
width: "290",
height: "250",
branding: false,
toolbar: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink code | preview',
statusbar: true
// readonly : 1
});
}
});
$('#admin_site_designer').rsTabs();
// sort on load
$('#sortable li.1').appendTo('#sortable');
$('#sortable li.2').appendTo('#sortable');
$('#sortable li.3').appendTo('#sortable');
$('#sortable li.4').appendTo('#sortable');
$('textarea.content_box_textbox').tinymce({
script_url : '../../../libs/tinymce/tinymce.min.js',
language : "en",
plugins : 'pagebreak table save preview media searchreplace print contextmenu paste directionality visualchars nonbreaking link code',
width: "290",
height: "250",
branding: false,
toolbar: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink code | preview',
statusbar: true
});
$('#sortable input[type="checkbox"]').click(function () {
var name = $(this).attr('name');
$('.' + name).attr('disabled', !$(this).attr('checked'));
// if(name == 'content_box_textbox') {
// if(name.attr('disabled')) {
// $('textarea.content_box_textbox').tinymce({
// readonly: true
// });
// } else {
// $('textarea.content_box_textbox').tinymce({
// readonly: false
// });
// }
// }
});
$('form.data').submit(function(e) {
e.preventDefault();
var jqxhr = $.ajax({
type: 'POST',
url: $(this).attr('action'),
data: $(this).serialize()
});
jqxhr.success(function(data) {
alert('Daten gespeichert');
});
jqxhr.error(function(data) {
alert('FEHLER');
});
});
});