diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index dc062448..cde4a425 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -40,6 +40,8 @@ class Admin::PagePartsController < ApplicationController @part = PagePart.find(params[:id]) if @part.update_attributes(params[:page_part]) flash.now[:notice] = t('admin.update_success_content') + @part.build_content(@site_valid_locales) + @part.save respond_to do |format| format.html { redirect_to admin_page_url( @part.page ) diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 87eedbea..811ed6d4 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -31,12 +31,20 @@ class Admin::PagesController < ApplicationController def create @item = Page.new(params[:page]) - @item.content = parse_content(@item.content, {:locale => 'create'}) if @item.save - flash[:notice] = t('admin.create_success_page') - redirect_to admin_items_url( :parent_id => @item.parent_id ) + @item.create_parts + @item.save + flash.now[:notice] = t('admin.create_success_page') + respond_to do |format| + format.html { + redirect_to admin_item_url(@item) + } + format.js {} + end else - render :action => "new" + flash.now[:error] = t('admin.create_error_page') + @i18n_variable = @item.i18n_variable + render :action => "new" end end diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb new file mode 100644 index 00000000..816e6a58 --- /dev/null +++ b/app/helpers/admin/item_helper.rb @@ -0,0 +1,23 @@ +module Admin::ItemHelper + + def render_node_and_children(node) + ret = '' + if node + case node._type + when 'Page' + dest = admin_page_path(node) + when 'Link' + dest = admin_link_path(node) + end + ret << "
@@ -18,11 +19,6 @@ <%= f.select :layout_id, Layout.all.map{ |l| [l.description, l.id] } %>
--<%= f.label "content", t('admin.content') %> -<%= f.text_area "content", :size => '100x30' %> -
-<%= f.label :is_published, "#{t('admin.is_published')} ?" %> <%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No diff --git a/app/views/admin/pages/_new.html.erb b/app/views/admin/pages/_new.html.erb new file mode 100644 index 00000000..a2991bec --- /dev/null +++ b/app/views/admin/pages/_new.html.erb @@ -0,0 +1,13 @@ +
+ <%= f.submit t('create') %> <%= link_back %> +
+ +<% end %> \ No newline at end of file diff --git a/app/views/admin/pages/create.js.erb b/app/views/admin/pages/create.js.erb new file mode 100644 index 00000000..5d59fd1d --- /dev/null +++ b/app/views/admin/pages/create.js.erb @@ -0,0 +1,2 @@ +$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>"); +$('#main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); \ No newline at end of file diff --git a/app/views/admin/pages/new.html.erb b/app/views/admin/pages/new.html.erb index 5ba7cae0..cf930b91 100644 --- a/app/views/admin/pages/new.html.erb +++ b/app/views/admin/pages/new.html.erb @@ -1,11 +1,5 @@ -- <%= f.submit t('create') %> <%= link_back %> -
- -<% end %> +<%= render 'new' %> \ No newline at end of file diff --git a/app/views/admin/pages/new.js.erb b/app/views/admin/pages/new.js.erb new file mode 100644 index 00000000..7dd4e048 --- /dev/null +++ b/app/views/admin/pages/new.js.erb @@ -0,0 +1 @@ +$('#main').html("<%= escape_javascript(render(:partial => 'admin/pages/new')) %>"); \ No newline at end of file diff --git a/app/views/layouts/content.html.erb b/app/views/layouts/content.html.erb index f3e8d4db..c69eb22a 100644 --- a/app/views/layouts/content.html.erb +++ b/app/views/layouts/content.html.erb @@ -9,8 +9,7 @@ <%= stylesheet_link_tag "easyprint", :media => "print" %> <%= javascript_include_tag :ckeditor %> - <%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", :cache => 'all' %> - <%= javascript_include_tag "application", :cache => 'all' %> + <%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", "application", :cache => 'all' %> <%= yield :page_specific_javascript %>