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
This commit is contained in:
Christophe Vilayphiou 2012-05-13 23:48:34 +08:00
parent 01d0c002f5
commit e40c76bf5f
4 changed files with 4 additions and 5 deletions

View File

@ -20,14 +20,14 @@ class Admin::PagesController < ApplicationController
def new def new
@item = Page.new @item = Page.new
@item.parent = Item.find(params[:parent_id]) rescue nil @item.parent = Item.find(params[:parent_id]) rescue nil
@apps = ModuleApp.all @apps = ModuleApp.excludes(app_pages: nil).entries
@designs = Design.all.entries @designs = Design.all.entries
@design = Design.first @design = Design.first
end end
def edit def edit
@item = Page.find(params[:id]) @item = Page.find(params[:id])
@apps = ModuleApp.all @apps = ModuleApp.excludes(app_pages: nil).entries
@designs = Design.all.entries @designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first @design = @item.design ? @item.design : @designs.first
@app_frontend_urls = @item.module_app.app_pages if @item.module_app @app_frontend_urls = @item.module_app.app_pages if @item.module_app

View File

@ -23,7 +23,7 @@ class OrbitBackendController< ApplicationController
def check_user_can_use def check_user_can_use
unless check_permission unless check_permission
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) #redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
render :text => '403 Forbidden' redirect_to root_url
end end
end end

View File

@ -1,7 +1,7 @@
<%= flash_messages %> <%= flash_messages %>
<div id="poststuff"> <div id="poststuff">
<h1><%= t('admin.new_page') %></h1> <h1><%= t('admin.new_page') %></h1>
<%= 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 } %> <%= render :partial => "form", :locals => { :f => f } %>
<div class="form-actions"> <div class="form-actions">
<%= f.submit t('update'), :class => 'btn btn-primary' %> <%= f.submit t('update'), :class => 'btn btn-primary' %>

View File

@ -6,7 +6,6 @@
"intro": "A simple blog……", "intro": "A simple blog……",
"update_info": "Some info", "update_info": "Some info",
"create_date": "11-11-2011", "create_date": "11-11-2011",
"app_pages": ["web_links"],
"widgets": ["home_list"], "widgets": ["home_list"],
"enable_frontend": true "enable_frontend": true
} }