From e40c76bf5f3208e1f6c559d97aff1e7bc26a0e46 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Sun, 13 May 2012 23:48:34 +0800 Subject: [PATCH] Fix new page form Redirect to home when not authorized Get only module_apps with app_pages for new and edit page Change web_resource.json --- app/controllers/admin/pages_controller.rb | 4 ++-- app/controllers/orbit_backend_controller.rb | 2 +- app/views/admin/pages/_new.html.erb | 2 +- vendor/built_in_modules/web_resource/web_resource.json | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 65754319..71153a14 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -20,14 +20,14 @@ class Admin::PagesController < ApplicationController def new @item = Page.new @item.parent = Item.find(params[:parent_id]) rescue nil - @apps = ModuleApp.all + @apps = ModuleApp.excludes(app_pages: nil).entries @designs = Design.all.entries @design = Design.first end def edit @item = Page.find(params[:id]) - @apps = ModuleApp.all + @apps = ModuleApp.excludes(app_pages: nil).entries @designs = Design.all.entries @design = @item.design ? @item.design : @designs.first @app_frontend_urls = @item.module_app.app_pages if @item.module_app diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index a03a1f6c..bdddfb43 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -23,7 +23,7 @@ class OrbitBackendController< ApplicationController def check_user_can_use unless check_permission #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) - render :text => '403 Forbidden' + redirect_to root_url end end diff --git a/app/views/admin/pages/_new.html.erb b/app/views/admin/pages/_new.html.erb index d3190e0e..ecbda3de 100644 --- a/app/views/admin/pages/_new.html.erb +++ b/app/views/admin/pages/_new.html.erb @@ -1,7 +1,7 @@ <%= flash_messages %>

<%= t('admin.new_page') %>

- <%= form_for @item, :url => admin_page_path, :html => { :class => 'form-horizontal edit_page' } do |f| %> + <%= form_for @item, :url => admin_pages_path, :html => { :class => 'form-horizontal edit_page' } do |f| %> <%= render :partial => "form", :locals => { :f => f } %>
<%= f.submit t('update'), :class => 'btn btn-primary' %> diff --git a/vendor/built_in_modules/web_resource/web_resource.json b/vendor/built_in_modules/web_resource/web_resource.json index f87f06a2..a854d31b 100644 --- a/vendor/built_in_modules/web_resource/web_resource.json +++ b/vendor/built_in_modules/web_resource/web_resource.json @@ -6,7 +6,6 @@ "intro": "A simple blog……", "update_info": "Some info", "create_date": "11-11-2011", - "app_pages": ["web_links"], "widgets": ["home_list"], "enable_frontend": true }