Skip to content

Commit

Permalink
adds some improvements and removes some annoyances.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Mar 27, 2010
1 parent c4e4169 commit c4ade23
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 56 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.9.6.21
0.9.6.22
6 changes: 3 additions & 3 deletions config/application.rb
Expand Up @@ -2,7 +2,7 @@
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

# Specified gem version of Refinery to use when vendor/plugins/refinery/lib/refinery.rb is not present.
REFINERY_GEM_VERSION = '0.9.6.21' unless defined? REFINERY_GEM_VERSION
REFINERY_GEM_VERSION = '0.9.6.22' unless defined? REFINERY_GEM_VERSION

# Boot Rails
require File.join(File.dirname(__FILE__), 'boot')
Expand All @@ -24,8 +24,8 @@
:secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
}

# Specify your application's gem requirements here. See the example below:
config.gem "refinerycms-news", :lib => "news", :version => "~> 0.9.7"
# Specify your application's gem requirements here. See the examples below:
# config.gem "refinerycms-news", :lib => "news", :version => "~> 0.9.7"
# config.gem "refinerycms-portfolio", :lib => "portfolio", :version => "~> 0.9.3.8"
end

Expand Down
37 changes: 25 additions & 12 deletions db/seeds.rb
Expand Up @@ -7,14 +7,13 @@
{:name => "image_thumbnails", :value => {
:dialog_thumb => 'c106x106',
:grid => 'c135x135',
:thumb => '50x50>',
:medium => '225x255>',
:side_body => '300x500>',
:thumb => '50x50',
:medium => '225x255',
:side_body => '300x500',
:preview => 'c96x96'
}
}].each do |setting|
RefinerySetting[setting[:name].to_sym] = setting[:value]
RefinerySetting.find_by_name(setting[:name].to_s).update_attributes({:destroyable => false})
RefinerySetting.create(:name => setting[:name].to_s, :value => setting[:value], :destroyable => false)
end

InquirySetting.create(:name => "Confirmation Body", :value => "Thank you for your inquiry %name%,\n\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\n\nThanks.", :destroyable => false)
Expand Down Expand Up @@ -46,11 +45,25 @@
:body => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit. Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna. Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.</p>"
})

Page.create(:title => "News",
:link_url => "/news",
:menu_match => "^/news.*$",
:deletable => false,
:position => 3).parts.create(
{
:title => "body",
:body => "<p>Want to know the latest? Here's what has been happening.</p>"
}).page.parts.create(
{
:title => "Side Body",
:body => "<p>Here we post up the latest about us, along with events and updates you don't want to miss!</p>"
})

Page.create(:title => "Contact Us",
:link_url => "/inquiries/new",
:menu_match => "^/inquiries.*$",
:deletable => false,
:position => 3).parts.create(
:position => 4).parts.create(
{
:title => "Body",
:body => "<p>Get in touch with us. Just use the form below and we'll get back to you as soon as we can.</p>"
Expand All @@ -65,7 +78,7 @@
:show_in_menu => false,
:deletable => false,
:position => 0,
:parent_id => 3).parts.create(
:parent_id => 4).parts.create(
{
:title => "Body",
:body => "<p>We've received your inquiry and will get back to you with a response shortly.</p><p><a href='/'>Return to the home page</a></p>"
Expand All @@ -75,7 +88,7 @@
:menu_match => "^/404$",
:show_in_menu => false,
:deletable => false,
:position => 4).parts.create(
:position => 5).parts.create(
{
:title => "Body",
:body => "<h2>Sorry, there was a problem...</h2><p>The page you requested was not found.</p><p><a href='/'>Return to the home page</a></p>"
Expand All @@ -84,10 +97,10 @@
Page.create(:title => "Privacy Policy",
:deletable => true,
:show_in_menu => false,
:position => 5).parts.create(
:position => 6).parts.create(
{
:title => "Body",
:body => "<p>We respect your privacy. We do not market, rent or sell our email list to any outside parties.</p><p>We need your e-mail address so that we can ensure that the people using our forms are bona fide. It also allows us to send you e-mail newsletters and other communications, if you opt-in. Your postal address is required in order to send you information and pricing, if you request it.</p><p>Please call us at 123 456 7890 if you have any questions or concerns.</p>"
:body => "<p><strong>We respect your privacy. We do not market, rent or sell our email list to any outside parties.</p><p>We need your e-mail address so that we can ensure that the people using our forms are bona fide. It also allows us to send you e-mail newsletters and other communications, if you opt-in. Your postal address is required in order to send you information and pricing, if you request it.</p><p>Please call us at 123 456 7890 if you have any questions or concerns.</p>"
}).page.parts.create(
{
:title => "Side Body",
Expand All @@ -97,11 +110,11 @@
Page.create(:title => "Down for maintenance",
:menu_match => "^/maintenance$",
:show_in_menu => false,
:position => 6).parts.create(
:position => 7).parts.create(
{
:title => "Body",
:body => "<p>Our site is currently down for maintenance. Please try back later.</p>"
})

# Create a default themes directory.
Rails.root.join("themes").mkdir unless Rails.root.join("themes").directory?
Rails.root.join("themes").mkdir unless Rails.root.join("themes").directory?
8 changes: 3 additions & 5 deletions readme.md
Expand Up @@ -65,12 +65,10 @@ After your database exists, you'll need to install the gems that Refinery depend

rake gems:install

As of version 0.9.6.21, the news engine was extracted into a separate gem. This is included by default in config/application.rb
If you don't want this engine on your site, just remove the config.gem line for it in config/application.rb
If you do want it, please run the following commands to get it up and running:
As of version 0.9.6.22, the news engine was extracted into a separate gem.
This is found here:

script/generate news
rake db:migrate
http://github.com/resolve/refinerycms-news

Now, news should be up and running.

Expand Down
@@ -1,7 +1,7 @@
class RefinerySetting < ActiveRecord::Base

validates_presence_of :name
validates_uniqueness_of :name
#validates_uniqueness_of :name

serialize :value # stores into YAML format
after_save do |object|
Expand Down
@@ -1,6 +1,6 @@
class Theme

def self.current_theme(request = nil)
def self.current_theme(env)
RefinerySetting[:theme]
end

Expand Down
6 changes: 2 additions & 4 deletions vendor/plugins/themes/lib/theme_server.rb
Expand Up @@ -9,9 +9,7 @@ def initialize(app)
end

def call(env)
theme = Theme.current_theme(env)

if env["PATH_INFO"] =~ /^\/theme/
if env["PATH_INFO"] =~ /^\/theme/ and (theme = Theme.current_theme(env)).present?
env["PATH_INFO"].gsub!(/^\/theme\//, '')
if (file_path = (dir = Rails.root.join("themes", theme)).join(env["PATH_INFO"])).exist?
etag = Digest::MD5.hexdigest("#{file_path.to_s}#{file_path.mtime}")
Expand All @@ -29,4 +27,4 @@ def call(env)
end
end

end
end
54 changes: 25 additions & 29 deletions vendor/plugins/themes/rails/init.rb
@@ -1,35 +1,31 @@
# Before the application gets setup this will fail badly if there's no database.
if RefinerySetting.table_exists?
# Set up middleware to serve theme files
config.middleware.use "ThemeServer"

::Refinery::ApplicationController.module_eval do

# Add or remove theme paths to/from Refinery application
before_filter do |controller|
# remove any paths relating to any theme.
controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} }

# add back theme paths if there is a theme present.
if (theme = Theme.current_theme(controller.request)).present?
# Set up view path again for the current theme.
controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s

# Ensure that routes within the application are top priority.
# Here we grab all the routes that are under the application's view folder
# and promote them ahead of any other path.
controller.view_paths.select{|p| p.to_s =~ /^app\/views/}.each do |app_path|
controller.view_paths.unshift app_path
end
# Set up middleware to serve theme files
config.middleware.use "ThemeServer"

::Refinery::ApplicationController.module_eval do

# Add or remove theme paths to/from Refinery application
before_filter do |controller|
# remove any paths relating to any theme.
controller.view_paths.reject! { |v| v.to_s =~ %r{^themes/} }

# add back theme paths if there is a theme present.
if (theme = Theme.current_theme(controller.request.env)).present?
# Set up view path again for the current theme.
controller.view_paths.unshift Rails.root.join("themes", theme, "views").to_s

# Ensure that routes within the application are top priority.
# Here we grab all the routes that are under the application's view folder
# and promote them ahead of any other path.
controller.view_paths.select{|p| p.to_s =~ /^app\/views/}.each do |app_path|
controller.view_paths.unshift app_path
end

# Set up menu caching for this theme or lack thereof
RefinerySetting[:refinery_menu_cache_action_suffix] = "#{"#{theme}_" if theme.present?}site_menu"
end

# Set up menu caching for this theme or lack thereof
RefinerySetting[:refinery_menu_cache_action_suffix] = "#{"#{theme}_" if theme.present?}site_menu" if RefinerySetting.table_exists?
end

# Include theme functions into application helper.
Refinery::ApplicationHelper.send :include, ThemesHelper

end

# Include theme functions into application helper.
Refinery::ApplicationHelper.send :include, ThemesHelper

0 comments on commit c4ade23

Please sign in to comment.