From d3ca1647be9078589f7f23acbb9912b6143c54f9 Mon Sep 17 00:00:00 2001 From: Matthew Fu Date: Fri, 23 Dec 2011 13:54:28 +0800 Subject: [PATCH] fix page form bugs --- app/assets/javascripts/page_edit.js | 4 ++-- app/controllers/admin/pages_controller.rb | 1 + app/controllers/application_controller.rb | 2 +- app/views/admin/module_apps/_app_selector.html.erb | 2 +- app/views/admin/pages/_form.html.erb | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/page_edit.js b/app/assets/javascripts/page_edit.js index 50e974b4..25348105 100644 --- a/app/assets/javascripts/page_edit.js +++ b/app/assets/javascripts/page_edit.js @@ -6,7 +6,7 @@ $("#page_design_id").live('change', function() { $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes'); }); -$("#page_module_app").live('change', function() { +$("#page_module_app_id").live('change', function() { var app_id = $(this).val(); if(app_id!=''){ $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_frontend_pages',function(data, textStatus){ @@ -16,6 +16,6 @@ $("#page_module_app").live('change', function() { }); } else{ - $("#app_page_url").remove(); + $("#app_page_url").children().remove(); } }); diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 23f58444..c547d5f2 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -32,6 +32,7 @@ class Admin::PagesController < ApplicationController @i18n_variable = @item.i18n_variable @designs = Design.all.entries @design = @item.design + @app_frontend_urls = @item.module_app.app_pages end def create diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 481c893f..d9c0156c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery - include ParserFrontEnd + include ParserFrontEnd,ParserBackEnd helper :all before_filter :set_locale, :set_site diff --git a/app/views/admin/module_apps/_app_selector.html.erb b/app/views/admin/module_apps/_app_selector.html.erb index 90c2aee1..f6220cf8 100644 --- a/app/views/admin/module_apps/_app_selector.html.erb +++ b/app/views/admin/module_apps/_app_selector.html.erb @@ -1 +1 @@ -<%= f.select :module_app, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> \ No newline at end of file +<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> \ No newline at end of file diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index d0c00d16..8223f0bb 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -33,7 +33,7 @@

<%= t('admin.module_app') %> <%= render :partial => "admin/module_apps/app_selector", :locals => { :f => f } %> - + <%= select('page','app_frontend_url', @app_frontend_urls ) rescue ''%>

<%= f.label :is_published, "#{t('admin.is_published')} ?" %>