refinerycms 0.9.5.17 → 0.9.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,9 @@
5
5
  # ENV['RAILS_ENV'] ||= 'production'
6
6
 
7
7
  # Specifies gem version of Rails to use when vendor/rails is not present
8
- RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
8
+ RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
9
9
  # Freeze to a specific version of refinerycms when running as a gem
10
- # REFINERY_GEM_VERSION = '0.9.5.15' unless defined? REFINERY_GEM_VERSION
10
+ # REFINERY_GEM_VERSION = '0.9.5.18' unless defined? REFINERY_GEM_VERSION
11
11
 
12
12
  # Bootstrap the Rails environment, frameworks, and default configuration
13
13
  require File.join(File.dirname(__FILE__), 'boot')
@@ -0,0 +1,15 @@
1
+ class AddDownForMaintenancePage < ActiveRecord::Migration
2
+ def self.up
3
+ page = Page.create(:title => "Down for maintenance", :menu_match => "^/maintenance$", :show_in_menu => false)
4
+ page.parts.create(:title => "body", :body => "<p>Our site is currently down for maintenance. Please try back later.</p>")
5
+ end
6
+
7
+ def self.down
8
+ page = Page.find_by_menu_match("^/maintenance$")
9
+ unless page.nil?
10
+ page.parts.delete_all
11
+ page.update_attributes({:menu_match => nil, :link_url => nil, :deletable => true})
12
+ page.destroy
13
+ end
14
+ end
15
+ end
data/db/schema.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # It's strongly recommended to check this file into your version control system.
11
11
 
12
- ActiveRecord::Schema.define(:version => 20091109012126) do
12
+ ActiveRecord::Schema.define(:version => 20091130040711) do
13
13
 
14
14
  create_table "images", :force => true do |t|
15
15
  t.integer "parent_id"
data/db/seeds.rb CHANGED
@@ -107,3 +107,12 @@ Page.create(:title => "Privacy Policy",
107
107
  :title => "side_body",
108
108
  :body => ""
109
109
  })
110
+
111
+ Page.create(:title => "Down for maintenance",
112
+ :menu_match => "^/maintenance$",
113
+ :show_in_menu => false,
114
+ :position => 7).parts.create(
115
+ {
116
+ :title => "body",
117
+ :body => "<p>Our site is currently down for maintenance. Please try back later.</p>"
118
+ })
@@ -2,30 +2,32 @@
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
3
  <html xmlns="http://www.w3.org/1999/xhtml">
4
4
  <head>
5
- <title><%= yield :title %> - <%= RefinerySetting.find_or_set(:site_name, "Company Name") %></title>
5
+ <title>
6
+ <%= yield :title %> - <%= RefinerySetting.find_or_set(:site_name, "Company Name") %>
7
+ </title>
6
8
  <%= stylesheet_link_tag 'application' %>
7
9
  <%= stylesheet_link_tag 'formatting', 'theme' %>
8
10
  <%= stylesheet_link_tag 'home' if @page.home? %>
9
- <!--[if IE 7]>
10
- <%= stylesheet_link_tag 'ie7' %>
11
- <![endif]-->
11
+ <!--[if IE 7]><%= stylesheet_link_tag 'ie7' %><![endif]-->
12
12
  <link rel="shortcut icon" href="/favicon.ico" />
13
13
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
14
14
  <%= yield :head %>
15
15
  </head>
16
16
  <body>
17
17
  <%= render :partial => "/shared/ie6check" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ %>
18
- <div id='page' class='clearfix'>
19
- <div id='header' class='clearfix'>
20
- <%= render :partial => "/shared/header" %>
21
- </div>
22
- <div id='body' class='clearfix'>
23
- <%= yield %>
24
- </div>
25
- <div id='footer' class='clearfix'>
26
- <%= render :partial => "/shared/footer" %>
18
+ <div id='page_container'>
19
+ <div id='page' class='clearfix'>
20
+ <div id='header' class='clearfix'>
21
+ <%= render :partial => "/shared/header" %>
22
+ </div>
23
+ <div id='body' class='clearfix'>
24
+ <%= yield %>
25
+ </div>
26
+ <div id='footer' class='clearfix'>
27
+ <%= render :partial => "/shared/footer" %>
28
+ </div>
27
29
  </div>
28
30
  </div>
29
31
  <%= render :partial => 'shared/google_analytics' unless local_request? %>
30
32
  </body>
31
- </html>
33
+ </html>
@@ -16,6 +16,9 @@ class Refinery::AdminBaseController < ApplicationController
16
16
 
17
17
  protected
18
18
 
19
+ # never take the backend down for maintenance.
20
+ def take_down_for_maintenance?;end
21
+
19
22
  def error_404
20
23
  @page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])
21
24
  @page[:body] = @page[:body].gsub(/href=(\'|\")\/(\'|\")/, "href='/admin'").gsub("home page", "Dashboard")
@@ -1,53 +1,64 @@
1
1
  class Refinery::ApplicationController < ActionController::Base
2
2
 
3
- helper_method :home_page?, :local_request?, :just_installed?, :from_dialog?, :admin?
3
+ helper_method :home_page?, :local_request?, :just_installed?, :from_dialog?, :admin?
4
4
 
5
- protect_from_forgery # See ActionController::RequestForgeryProtection
5
+ protect_from_forgery # See ActionController::RequestForgeryProtection
6
6
 
7
- include Crud # basic create, read, update and delete methods
8
- include AuthenticatedSystem
7
+ include Crud # basic create, read, update and delete methods
8
+ include AuthenticatedSystem
9
9
 
10
- before_filter :find_pages_for_menu, :show_welcome_page
11
- rescue_from ActiveRecord::RecordNotFound, :with => :error_404
12
- rescue_from ActionController::UnknownAction, :with => :error_404
10
+ before_filter :find_pages_for_menu, :show_welcome_page, :take_down_for_maintenance?
11
+ rescue_from ActiveRecord::RecordNotFound, :with => :error_404
12
+ rescue_from ActionController::UnknownAction, :with => :error_404
13
13
 
14
- def error_404
15
- @page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])
16
- render :template => "/pages/show", :status => 404
17
- end
14
+ def error_404
15
+ @page = Page.find_by_menu_match("^/404$", :include => [:parts, :slugs])
16
+ render :template => "/pages/show", :status => 404
17
+ end
18
18
 
19
- def home_page?
20
- params[:action] == "home" and params[:controller] == "pages"
21
- end
19
+ def home_page?
20
+ params[:action] == "home" and params[:controller] == "pages"
21
+ end
22
22
 
23
- def local_request?
24
- request.remote_ip =~ /(::1)|(127.0.0.1)|((192.168).*)/ or ENV["RAILS_ENV"] == "development"
25
- end
23
+ def local_request?
24
+ request.remote_ip =~ /(::1)|(127.0.0.1)|((192.168).*)/ or ENV["RAILS_ENV"] == "development"
25
+ end
26
26
 
27
- def just_installed?
28
- User.count == 0
29
- end
27
+ def just_installed?
28
+ User.count == 0
29
+ end
30
30
 
31
- def from_dialog?
32
- params[:dialog] == "true" or params[:modal] == "true"
33
- end
31
+ def from_dialog?
32
+ params[:dialog] == "true" or params[:modal] == "true"
33
+ end
34
34
 
35
- def admin?
36
- params[:controller] =~ /admin\/(.*)/
37
- end
35
+ def admin?
36
+ params[:controller] =~ /admin\/(.*)/
37
+ end
38
38
 
39
- def wymiframe
40
- render :template => "/wymiframe", :layout => false
41
- end
39
+ def wymiframe
40
+ render :template => "/wymiframe", :layout => false
41
+ end
42
42
 
43
- protected
43
+ protected
44
44
 
45
- def show_welcome_page
46
- render :template => "/welcome", :layout => "admin" if just_installed? and params[:controller] != "users"
45
+ def take_down_for_maintenance?
46
+ if RefinerySetting.find_or_set(:down_for_maintenance, false)
47
+ @page = Page.find_by_menu_match("^/maintenance$", :include => [:parts, :slugs])
48
+ unless @page.nil?
49
+ render :template => "/pages/show", :status => 503
50
+ else
51
+ render :text => "Our website is currently down for maintenance. Please try back soon."
52
+ end
47
53
  end
54
+ end
48
55
 
49
- def find_pages_for_menu
50
- @menu_pages = Page.top_level(include_children=true) unless admin?
51
- end
56
+ def show_welcome_page
57
+ render :template => "/welcome", :layout => "admin" if just_installed? and params[:controller] != "users"
58
+ end
59
+
60
+ def find_pages_for_menu
61
+ @menu_pages = Page.top_level(include_children=true) unless admin?
62
+ end
52
63
 
53
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.17
4
+ version: 0.9.5.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-11-27 00:00:00 +13:00
14
+ date: 2009-11-30 00:00:00 +13:00
15
15
  default_executable: refinery
16
16
  dependencies: []
17
17
 
@@ -53,6 +53,7 @@ files:
53
53
  - config/routes.rb
54
54
  - db/migrate/20091029034951_remove_blurb_from_news_items.rb
55
55
  - db/migrate/20091109012126_add_missing_indexes.rb
56
+ - db/migrate/20091130040711_add_down_for_maintenance_page.rb
56
57
  - db/schema.rb
57
58
  - db/seeds.rb
58
59
  - lib/refinery_initializer.rb