2012-12-28 07:30:46 +00:00
|
|
|
function get_part_id(){
|
2013-01-21 08:56:37 +00:00
|
|
|
return $(".edit_page_part,.edit_page").attr("action").split('/').pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_object_path(){
|
|
|
|
a = window.location.href.split('/');
|
|
|
|
a.pop();
|
|
|
|
return a.join('/');
|
2012-12-28 07:30:46 +00:00
|
|
|
}
|
|
|
|
|
2011-12-18 02:07:42 +00:00
|
|
|
$("div.editable").live("mouseenter mouseleave", function (event) {
|
|
|
|
$(this).children('.edit_link').toggle();
|
|
|
|
});
|
|
|
|
|
2012-02-23 07:48:23 +00:00
|
|
|
$("#page_design").live('change', function() {
|
2011-12-18 02:07:42 +00:00
|
|
|
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
|
2011-12-20 08:47:17 +00:00
|
|
|
});
|
|
|
|
|
2013-01-21 08:56:37 +00:00
|
|
|
// $("#page_module_app_id").live('change', function() {
|
|
|
|
// var app_id = $(this).val();
|
|
|
|
// if(app_id!=''){
|
|
|
|
// $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_after_module_changed',function(data, textStatus){
|
|
|
|
// if(textStatus == 'success'){
|
|
|
|
// $(this).after(data);
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// else{
|
|
|
|
// $("#app_page_url").children().remove();
|
|
|
|
// }
|
|
|
|
// });
|
2012-02-16 04:16:27 +00:00
|
|
|
|
|
|
|
$("#module_app_list select").live('change', function() {
|
2013-01-21 08:56:37 +00:00
|
|
|
$.getScript(get_object_path() + '/reload_after_module_changed?module_app_id='+$(this).val()); //?part_id=' + get_part_id());
|
2012-02-16 04:16:27 +00:00
|
|
|
});
|
|
|
|
|
2013-01-21 08:56:37 +00:00
|
|
|
$("#widget_list select,#frontend_list select").live('change', function() {
|
|
|
|
$.getScript(get_object_path() +'/reload_after_list_changed?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() );//+ '&part_id=' + get_part_id());
|
2012-07-26 08:39:29 +00:00
|
|
|
});
|
|
|
|
|
2012-04-23 18:30:40 +00:00
|
|
|
$("#tag_list select").live('change', function() {
|
2013-02-23 08:52:37 +00:00
|
|
|
$.getScript($(this).attr('rel') + '?type=' + $(this).val());
|
2012-04-23 18:30:40 +00:00
|
|
|
});
|
|
|
|
|
2013-02-18 07:13:31 +00:00
|
|
|
$("select.widget_field_select").live('change', function() {
|
|
|
|
$.getScript(get_object_path() + '/reload_after_widget_field_changed?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri'));
|
|
|
|
});
|
|
|
|
|
2012-02-16 04:16:27 +00:00
|
|
|
$('.part_kind').live('click', function() {
|
|
|
|
$('.part_kind_partial').hide();
|
|
|
|
$('#part_' + $(this).attr('value')).show();
|
|
|
|
});
|
2012-05-12 14:12:17 +00:00
|
|
|
|
|
|
|
$(document).ready(function(){
|
2012-05-22 09:37:15 +00:00
|
|
|
bindTreeDragHandle();
|
|
|
|
});
|
|
|
|
|
|
|
|
var bindTreeDragHandle = function(){
|
2012-05-12 14:12:17 +00:00
|
|
|
$('ol.sortable').nestedSortable({
|
|
|
|
disableNesting: 'no-nest',
|
|
|
|
forcePlaceholderSize: true,
|
|
|
|
handle: 'i',
|
|
|
|
helper: 'clone',
|
|
|
|
items: 'li',
|
|
|
|
maxLevels: 3,
|
|
|
|
opacity: .5,
|
|
|
|
placeholder: 'placeholder',
|
|
|
|
revert: 250,
|
|
|
|
tabSize: 25,
|
|
|
|
tolerance: 'pointer',
|
|
|
|
toleranceElement: '> div',
|
|
|
|
|
|
|
|
stop: function(event, ui) {
|
|
|
|
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
|
|
|
|
}
|
|
|
|
});
|
2012-05-22 09:37:15 +00:00
|
|
|
}
|