Skip to content
Browse files

adjust namespaces and directories

  • Loading branch information...
1 parent f302b5f commit c3b328ad515e88487e4ad4414d1ca7381bb7a606 @kennyadsl kennyadsl committed Apr 3, 2012
View
22 app/controllers/pages_controller.rb
@@ -1,22 +0,0 @@
-module Spree
- class PagesController < Spree::BaseController
- before_filter { render_404 if params[:id] =~ /(\.|\\)/ }
-
- caches_action :show, :if => Proc.new { Spree::Config[:cache_static_content] }, :layout => false
-
- respond_to :html
-
- # GET /pages/about-us
- def show
- @page = Page.published.find_by_permalink(params[:id])
- if @page.blank?
- render_404
- else
- respond_to do |format|
- format.html # show.html.erb
- end
- end
- end
-
- end
-end
View
2 app/controllers/admin/pages_controller.rb → ...ntrollers/spree/admin/pages_controller.rb
@@ -1,5 +1,5 @@
module Spree
- class Admin::PagesController < Spree::Admin::ResourceController
+ class Admin::PagesController < Admin::ResourceController
cache_sweeper PageSweeper, :only => [ :edit, :update, :destroy ]
View
59 app/controllers/spree/pages_controller.rb
@@ -1,43 +1,22 @@
-class Admin::PagesController < Admin::ResourceController
-
- cache_sweeper PageSweeper, :only => [ :edit, :update, :destroy ]
-
- def index
- @pages = Page.page(params[:page])
- end
-
- def new
- @page = Page.new
- end
-
- def create
- @page = Page.new(params[:page])
- if @page.save
- flash[:notice] = "Successfully created page."
- redirect_to admin_pages_url
- else
- render :action => 'new'
- end
- end
-
- def edit
- @page = Page.find(params[:id])
- end
-
- def update
- @page = Page.find(params[:id])
- if @page.update_attributes(params[:page])
- flash[:notice] = "Successfully updated page."
- redirect_to admin_pages_url
- else
- render :action => 'edit'
+module Spree
+ class PagesController < BaseController
+ before_filter { render_404 if params[:id] =~ /(\.|\\)/ }
+
+ caches_action :show, :if => Proc.new { Config[:cache_static_content] }, :layout => false
+
+ respond_to :html
+
+ # GET /pages/about-us
+ def show
+ @page = Page.published.find_by_permalink(params[:id])
+ if @page.blank?
+ render_404
+ else
+ respond_to do |format|
+ format.html # show.html.erb
+ end
+ end
end
- end
-
- def destroy
- @page = Page.find(params[:id])
- @page.destroy
- flash[:notice] = "Successfully destroyed page."
- redirect_to admin_pages_url
+
end
end
View
0 app/models/page.rb → app/models/spree/page.rb
File renamed without changes.
View
18 app/sweepers/page_sweeper.rb
@@ -1,18 +0,0 @@
-class PageSweeper < ActionController::Caching::Sweeper
- observe Page
-
- def after_update(page)
- expire_page_cache(page)
- end
-
- def after_destroy(page)
- expire_page_cache(page)
- end
-
-private
-
- def expire_page_cache(page)
- expire_action(:controller => 'spree/pages', :action => 'show', :id => page.permalink)
- end
-
-end
View
20 app/sweepers/spree/page_sweeper.rb
@@ -0,0 +1,20 @@
+module Spree
+ class PageSweeper < ActionController::Caching::Sweeper
+ observe Page
+
+ def after_update(page)
+ expire_page_cache(page)
+ end
+
+ def after_destroy(page)
+ expire_page_cache(page)
+ end
+
+ private
+
+ def expire_page_cache(page)
+ expire_action(:controller => 'pages', :action => 'show', :id => page.permalink)
+ end
+
+ end
+end
View
0 app/views/admin/pages/_form.html.erb → app/views/spree/admin/pages/_form.html.erb
File renamed without changes.
View
6 app/views/admin/pages/edit.html.erb → app/views/spree/admin/pages/edit.html.erb
@@ -1,5 +1,5 @@
<%= hook :admin_page_edit_form_header do %>
- <%= render 'shared/error_messages', :target => @page %>
+ <%= render 'spree/shared/error_messages', :target => @page %>
<h1><%= t("editing_page") %></h1>
<% end %>
@@ -8,7 +8,7 @@
<%= render :partial => "form", :locals => { :f => f } %>
<%= hook :admin_page_edit_form_buttons do %>
- <%= render :partial => "admin/shared/edit_resource_links" %>
+ <%= render :partial => "spree/admin/shared/edit_resource_links" %>
<% end %>
<% end %>
-<% end %>
+<% end %>
View
0 app/views/admin/pages/index.html.erb → app/views/spree/admin/pages/index.html.erb
File renamed without changes.
View
6 app/views/admin/pages/new.html.erb → app/views/spree/admin/pages/new.html.erb
@@ -1,5 +1,5 @@
<%= hook :admin_page_new_form_header do %>
- <%= render 'shared/error_messages', :target => @page %>
+ <%= render 'spree/shared/error_messages', :target => @page %>
<h1><%= t("new_page") %></h1>
<% end %>
@@ -8,7 +8,7 @@
<%= render :partial => "form", :locals => { :f => f } %>
<%= hook :admin_page_new_form_buttons do %>
- <%= render :partial => "admin/shared/new_resource_links" %>
+ <%= render :partial => "spree/admin/shared/new_resource_links" %>
<% end %>
<% end %>
-<% end %>
+<% end %>
View
0 app/views/pages/show.html.erb → app/views/spree/pages/show.html.erb
File renamed without changes.

0 comments on commit c3b328a

Please sign in to comment.
Something went wrong with that request. Please try again.