diff --git a/Gemfile b/Gemfile index a9813caa..1e6ce8fc 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ gem 'rails', '>=3.1.0.rc4' gem 'yajl-ruby', :require => 'yajl' gem 'bson_ext' -gem 'carrierwave', '0.5.6' +gem 'carrierwave', '0.5.4' gem 'ckeditor' gem 'devise' gem 'mini_magick' diff --git a/Gemfile.lock b/Gemfile.lock index 7177ff7e..74e4c8c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,7 +36,7 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (3.0.0) - carrierwave (0.5.6) + carrierwave (0.5.4) activesupport (~> 3.0) chronic (0.6.2) ckeditor (3.6.1) @@ -171,7 +171,7 @@ PLATFORMS DEPENDENCIES bson_ext - carrierwave (= 0.5.6) + carrierwave (= 0.5.4) ckeditor coffee-rails (~> 3.1.0.rc) delorean diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index d6992c71..1fcc7bde 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -21,14 +21,16 @@ class Admin::PagesController < ApplicationController @item = Page.new @item.is_published = true @item.parent_id = @parent_item.id rescue nil + @designs = Design.all.entries + @default_design = @designs.detect {|d| d.title.to_s == 'Bob' } end def edit @item = Page.find(params[:id]) - # @item.content = parse_content(@item.content, {:locale => 'show'}) - @item.content = parse_page_code(@item) @i18n_variable = @item.i18n_variable - @code = params[:code] + @designs = Design.all.entries + @design = @item.design + @default_design = @design.themes.detect {|t| t.id == @item.theme_id } end def create @@ -52,11 +54,10 @@ class Admin::PagesController < ApplicationController def update @item = Page.find(params[:id]) - parse_content_update_code(@item, params[:page][:content]) if @item.update_attributes(params[:item]) flash[:notice] = t('admin.update_success_page') respond_to do |format| - format.html { + format.html { redirect_to admin_page_url(@item) } format.js {} diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index 7994cb25..c28c9b8f 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -12,7 +12,7 @@ module Admin::ItemHelper ret << "
+ <%= f.submit t('update') %> <%= link_back %> +
+<% end %> \ No newline at end of file diff --git a/app/views/admin/pages/_edit_code.html.erb b/app/views/admin/pages/_edit_code.html.erb deleted file mode 100644 index 24069927..00000000 --- a/app/views/admin/pages/_edit_code.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= flash_messages %> - -<%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form' } do |f| %> - <%= render :partial => "admin/pages/form_code", :locals => { :f => f, :locale => locale } %> -- <%= f.submit t(:update) %> <%= link_back %> -
-<% end %> \ 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 54ee892f..208a92f3 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -15,8 +15,14 @@ <% end %>-<%= f.label :design_id, t('admin.design_name') %> -<%= f.select :design_id, Design.all.map{ |l| [l.title, l.id] } %> + <%= t('admin.design_name') %> + <%#= f.select :design_id, @designs.collect { |d| [d.title, d.id] }, :selected => @default_design.id %> + <%= f.select :design_id, @designs.collect { |d| [d.title, d.id] } %> +
++ <%= t('admin.theme') %> + <%#= f.select :theme_id, @default_design.themes.collect { |t| [t.name, t.id] }, :selected => @default_design.themes.detect {|t| t.file_filename.to_s == 'default.css' }.id %> + <%= f.select :theme_id, @design.themes.collect { |t| [t.name, t.id] }%>
diff --git a/app/views/admin/pages/_form_code.html.erb b/app/views/admin/pages/_form_code.html.erb deleted file mode 100644 index ad0e55ed..00000000 --- a/app/views/admin/pages/_form_code.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= f.error_messages %> - -<%= f.text_area :content %> \ No newline at end of file diff --git a/app/views/admin/pages/edit.html.erb b/app/views/admin/pages/edit.html.erb index b4bfc607..23676c93 100644 --- a/app/views/admin/pages/edit.html.erb +++ b/app/views/admin/pages/edit.html.erb @@ -1,15 +1,5 @@ <% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> + <%= render 'admin/items/site_map_left_bar' %> <% end -%> -
- <%= f.submit t('update') %> <%= link_back %> - -
-<% end %> +<%= render 'edit' %> \ No newline at end of file diff --git a/app/views/admin/pages/edit.js.erb b/app/views/admin/pages/edit.js.erb index 9c61245e..67d528b5 100644 --- a/app/views/admin/pages/edit.js.erb +++ b/app/views/admin/pages/edit.js.erb @@ -1 +1 @@ -$('#panel_main').html("<%= escape_javascript(render(:partial => @code ? 'edit_code' : 'edit')) %>"); \ No newline at end of file +$('#panel_main').html("<%= escape_javascript(render 'edit') %>"); \ No newline at end of file diff --git a/app/views/admin/pages/show.html.erb b/app/views/admin/pages/show.html.erb index 6dd0f923..d6b6a8a2 100644 --- a/app/views/admin/pages/show.html.erb +++ b/app/views/admin/pages/show.html.erb @@ -2,4 +2,4 @@ <%= render 'admin/items/site_map_left_bar' %> <% end -%> -<%= render @code ? 'show_code' : 'show' %> \ No newline at end of file +<%= render 'show' %> \ No newline at end of file diff --git a/app/views/admin/pages/update.js.erb b/app/views/admin/pages/update.js.erb index 20cb22c1..4fdd4357 100644 --- a/app/views/admin/pages/update.js.erb +++ b/app/views/admin/pages/update.js.erb @@ -1,2 +1,2 @@ $('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); +history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); \ No newline at end of file diff --git a/lib/fraisier/themes/red.css b/lib/fraisier/themes/red.css new file mode 100644 index 00000000..97097ed2 --- /dev/null +++ b/lib/fraisier/themes/red.css @@ -0,0 +1 @@ +/* Some css */ \ No newline at end of file diff --git a/lib/parser.rb b/lib/parser.rb index 83e5bcf8..a5299af3 100644 --- a/lib/parser.rb +++ b/lib/parser.rb @@ -105,12 +105,6 @@ module Parser end end - def parse_content(page_content, attributes = {}) - context = parser_context(page_content, attributes) - parser = Radius::Parser.new(context, :tag_prefix => 'r') - parser.parse(page_content) - end - def parse_page(page) if page._type == 'Page' layout_content = page.design.layout.content @@ -214,33 +208,6 @@ module Parser end end - def parse_page_code(page) - layout_content = page.design.layout.content - context = parser_context_code(page) - parser = Radius::Parser.new(context, :tag_prefix => 'r') - parser.parse(layout_content) - end - - def parser_context_code(page) #context should be interpretd as the orginally one - Radius::Context.new do |c| - c.define_tag 'stylesheets' do |tag| - res << "