From 94c1d7d5a037bb0701dd56454a830d043b641eb2 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 21 Oct 2013 11:13:15 +0800 Subject: [PATCH] Fix homepage in structure, ajaxStop for structure edit, setForm in pageslide.js --- app/assets/javascripts/lib/pageslide.js | 10 +--------- app/controllers/pages_controller.rb | 10 +++++++++- app/views/layouts/page_layout.html.erb | 12 +++++------- lib/tasks/new_ui.rake | 1 + 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/lib/pageslide.js b/app/assets/javascripts/lib/pageslide.js index bb96f3601..d8f09e525 100644 --- a/app/assets/javascripts/lib/pageslide.js +++ b/app/assets/javascripts/lib/pageslide.js @@ -327,15 +327,7 @@ function setForm(data) { $.each(data, function(key, value) { - switch($("#pageslide form #" + key).prop("tagName")) - { - case "INPUT": - $("#pageslide form #" + key).val(value); - break; - case "SELECT": - $("#pageslide form #" + key).val(value); - break; - } + $("#pageslide form #" + key).val(value); }); } diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 48261bf74..430bc4084 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -9,7 +9,15 @@ class PagesController < ApplicationController if @item delayed_impressionist(@item) - render_page + if params[:edit] + if request.referer && request.referer.ends_with?("admin/items") + redirect_to admin_page_url(@item) + else + render :file => "#{Rails.root}/public/403.html", :status => 403 + end + else + render_page + end else redirect_to '/admin/dashboards',:notice=>t(:need_home) # render :text => t(:need_home) diff --git a/app/views/layouts/page_layout.html.erb b/app/views/layouts/page_layout.html.erb index 0d45f3430..2e1cae09e 100644 --- a/app/views/layouts/page_layout.html.erb +++ b/app/views/layouts/page_layout.html.erb @@ -29,13 +29,11 @@ <% end -%> <% if @edit %>