From 8456a9196854e44b4b5979318b44184a2670ffa7 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 14 Sep 2013 17:26:16 +0800 Subject: [PATCH] Fix structure edit --- .../javascripts/basic/orbit_js_1.0.1.js | 2 +- .../lib/items/page_widget_edit_interface.js | 47 +++++++++---------- app/views/admin/items/index.html.erb | 8 ---- .../admin/pages/reload_frontend_pages.js.erb | 6 --- 4 files changed, 23 insertions(+), 40 deletions(-) diff --git a/app/assets/javascripts/basic/orbit_js_1.0.1.js b/app/assets/javascripts/basic/orbit_js_1.0.1.js index 35c8b13ca..49b8a1417 100644 --- a/app/assets/javascripts/basic/orbit_js_1.0.1.js +++ b/app/assets/javascripts/basic/orbit_js_1.0.1.js @@ -506,7 +506,7 @@ function openSlide() { if($('.item-groups').length) { $os = $openSlide.not('.view-page'); $vp = $openSlide.filter('.view-page.open-slide'); - $os.pageslide({ W: 324 }); + $os.pageslide({ W: 624 }); $vp.pageslide({ W: $pageslideW, iframe: true }); } else { $openSlide.pageslide(); diff --git a/app/assets/javascripts/lib/items/page_widget_edit_interface.js b/app/assets/javascripts/lib/items/page_widget_edit_interface.js index d46da5fa0..53c99e2f0 100644 --- a/app/assets/javascripts/lib/items/page_widget_edit_interface.js +++ b/app/assets/javascripts/lib/items/page_widget_edit_interface.js @@ -7,32 +7,29 @@ function append_id(){ }; } -$("div.editable").live("mouseenter mouseleave", function (event) { - $(this).children('.edit_link').toggle(); +$(document).on('change', 'select', function(e) { + if(!e.target.className == 'widget_field_select') { + switch(e.target.id) { + case 'page_module_app_id': + $.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id()); + break; + case 'page_app_frontend_url': + case 'page_part_widget_path': + $.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() ); + break; + case 'page_design': + $.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id()); + break; + case 'page_part_public_r_tag': + $.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id()); + break; + }; + } else { + $.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() ); + } }); -$("#page_design").live('change', function() { - $.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id()); -}); - - -$("#module_app_list select").live('change', function() { - $.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id()); -}); - -$("#widget_list select, #frontend_list select").live('change', function() { - $.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() ); -}); - -$("#tag_list select").live('change', function() { - $.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id() ); -}); - -$("select.widget_field_select").live('change', function() { - $.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() ); -}); - -$('.part_kind').live('click', function() { +$(document).on('click', '.part_kind', function(event) { $('.part_kind_partial').hide(); $('#part_' + $(this).attr('value')).show(); -}); +}); \ No newline at end of file diff --git a/app/views/admin/items/index.html.erb b/app/views/admin/items/index.html.erb index b78f045c8..c5387e019 100644 --- a/app/views/admin/items/index.html.erb +++ b/app/views/admin/items/index.html.erb @@ -6,12 +6,4 @@ <%= render 'layouts/delete_modal', delete_options: {remote: true} %> - <%= javascript_include_tag "lib/jquery.pageslide.js" %> diff --git a/app/views/admin/pages/reload_frontend_pages.js.erb b/app/views/admin/pages/reload_frontend_pages.js.erb index 9672adfa8..f81d5ad4d 100644 --- a/app/views/admin/pages/reload_frontend_pages.js.erb +++ b/app/views/admin/pages/reload_frontend_pages.js.erb @@ -9,12 +9,6 @@ $('#app_page_url').html("
<%= t('default_widget.no_support_setting')%>
"); <% end %> - <% if @app_frontend_urls.first =='default_widget' %> - $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @selected[:module_app].widgets[@selected[:app_frontend_url]]) %>"); - <% else %> - $('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>"); - <% end %> - <% if show_default_widget_setting_panel %> $('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@item} %>");