diff --git a/app/controllers/admin/layouts_controller.rb b/app/controllers/admin/layouts_controller.rb deleted file mode 100644 index 6661720c..00000000 --- a/app/controllers/admin/layouts_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class Admin::LayoutsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :is_admin? - - def index - @layouts = Layout.all.entries - end - - def show - #TODO -# @layout = Layout.find(params[:id]) -# redirect_to "/#{@layout.name}" - end - - def new - @layout = Layout.new - end - - def edit - @layout = Layout.find(params[:id]) - end - - def create - @layout = Layout.new(params[:layout]) - - if @layout.save - flash[:notice] = t('admin.create_success_layout') - redirect_to admin_layouts_url - else - render :action => 'new' - end - end - - def update - @layout = Layout.find(params[:id]) - - if @layout.update_attributes(params[:layout]) - flash[:notice] = t('admin.update_success_layout') - redirect_to admin_layouts_url - else - render :action => "edit" - end - end - - def destroy - @layout = Layout.find(params[:id]) - @layout.destroy - - redirect_to admin_layouts_url - end - -end diff --git a/app/controllers/admin/purchases_controller.rb b/app/controllers/admin/purchases_controller.rb index 3fbd80d4..f11cc414 100644 --- a/app/controllers/admin/purchases_controller.rb +++ b/app/controllers/admin/purchases_controller.rb @@ -3,6 +3,8 @@ class Admin::PurchasesController < ApplicationController require "uri" require 'zip/zip' + layout "admin" + def index @purchases = Purchase.all.entries end diff --git a/app/controllers/sites_controller.rb b/app/controllers/admin/sites_controller.rb similarity index 51% rename from app/controllers/sites_controller.rb rename to app/controllers/admin/sites_controller.rb index a8137715..9475e708 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -1,6 +1,8 @@ -class SitesController < ApplicationController +class Admin::SitesController < ApplicationController - #layout 'set_up' + layout "admin" + before_filter :authenticate_user! + before_filter :is_admin? def index @site = Site.first diff --git a/app/models/design/design.rb b/app/models/design/design.rb index 902a2448..f4eef5df 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -12,6 +12,8 @@ class Design validates_presence_of :title validates_presence_of :author + has_many :pages + embeds_one :layout mount_uploader :structure_css, AssetUploader diff --git a/app/models/page.rb b/app/models/page.rb index 1e2d73c2..d29685ae 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -1,14 +1,11 @@ class Page < Item - - #include LayoutSupport field :content field :design_name - field :design_id validates_presence_of :design_name, :design_id - referenced_in :design + belongs_to :design has_many :page_parts def create_parts diff --git a/app/views/admin/designs/index.html.erb b/app/views/admin/designs/index.html.erb index 2f0210f0..03683e66 100644 --- a/app/views/admin/designs/index.html.erb +++ b/app/views/admin/designs/index.html.erb @@ -1,6 +1,7 @@ <% content_for :secondary do %>
-<%= f.label :name, t('admin.name') %> -<%= f.text_field :name, :class => 'text' %> -
- --<%= f.label :description, t('admin.description') %> -<%= f.text_field :description, :class => 'text' %> -
- --<%= f.label "content", t('admin.content') %> -<%= f.text_area :content, :size => '100x30' %> -
diff --git a/app/views/admin/layouts/edit.html.erb b/app/views/admin/layouts/edit.html.erb deleted file mode 100644 index 6785d1c5..00000000 --- a/app/views/admin/layouts/edit.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -- <%= f.submit t('update') %> <%= link_back %> -
-<% end %> diff --git a/app/views/admin/layouts/index.html.erb b/app/views/admin/layouts/index.html.erb deleted file mode 100644 index b0634d3a..00000000 --- a/app/views/admin/layouts/index.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -<% content_for :secondary do %> -<%= t('admin.name') %> | -<%= t('admin.description') %> | -<%= t('admin.action') %> | -
---|---|---|
<%= layout.name %> | -<%= layout.description %> | -- <%= link_to t(:edit), edit_admin_layout_path(layout) %> | - <%= link_to t(:delete), admin_layout_path(layout), :confirm => t('sure?'), :method => :delete %> - | -
- <%= f.submit t('create') %> <%= link_back %> -
-<% end %> diff --git a/app/views/sites/index.html.erb b/app/views/admin/sites/index.html.erb similarity index 100% rename from app/views/sites/index.html.erb rename to app/views/admin/sites/index.html.erb diff --git a/app/views/sites/new.html.erb b/app/views/admin/sites/new.html.erb similarity index 100% rename from app/views/sites/new.html.erb rename to app/views/admin/sites/new.html.erb diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index eb6b5c3d..c88dc423 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -28,18 +28,17 @@