Skip to content

Commit

Permalink
Give some love to seeds and the process around creating the first use…
Browse files Browse the repository at this point in the history
…r. Now the first user gets inquiries sent to their email address rather than this being a blank field by default. New version.
  • Loading branch information
parndt committed Apr 14, 2010
1 parent c443fdd commit 91805f1
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 44 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.6.28
0.9.6.29
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
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.28' unless defined? REFINERY_GEM_VERSION
REFINERY_GEM_VERSION = '0.9.6.29' unless defined? REFINERY_GEM_VERSION

# Boot Rails
require File.join(File.dirname(__FILE__), 'boot')
Expand Down
95 changes: 54 additions & 41 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,87 +19,100 @@
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)
InquirySetting.create(:name => "Notification Recipients", :value => "", :destroyable => false)

Page.create(:title => "Home",
page_position = -1

home_page = Page.create(:title => "Home",
:deletable => false,
:link_url => "/",
:menu_match => "^/$",
:position => 0).parts.create(
{
:position => (page_position += 1))
home_page.parts.create({
:title => "Body",
:body => "<p>Welcome to our site. This is just a place holder page while we gather our content.</p>"
}).page.parts.create(
{
:body => "<p>Welcome to our site. This is just a place holder page while we gather our content.</p>",
:position => 0
})
home_page.parts.create({
:title => "Side Body",
:body => "<p>This is another block of content over here.</p>"
:body => "<p>This is another block of content over here.</p>",
:position => 1
})

Page.create(:title => "About Us",
about_us_page = Page.create(:title => "About Us",
:deletable => true,
:position => 1).parts.create(
{
:position => (page_position += 1))
about_us_page.parts.create({
:title => "Body",
:body => "<p>This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.</p>"
}).page.parts.create(
{
:body => "<p>This is just a standard text page example. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet, aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis placerat. Duis metus tellus, pellentesque ut, luctus id, egestas a, lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo suscipit viverra. Proin at leo ut lacus consequat rhoncus. In hac habitasse platea dictumst. Nunc quis tortor sed libero hendrerit dapibus.\n\nInteger interdum purus id erat. Duis nec velit vitae dolor mattis euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at lectus. Sed egestas tortor nec mi.</p>",
:position => 0
})
about_us_page.parts.create({
:title => "Side Body",
: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>"
: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>",
:position => 1
})

Page.create(:title => "Contact Us",
contact_us_page = Page.create(:title => "Contact Us",
:link_url => "/inquiries/new",
:menu_match => "^/inquiries.*$",
:deletable => false,
:position => 2).parts.create(
{
:position => (page_position += 1))
contact_us_page.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>"
}).page.parts.create(
{
: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>",
:position => 0
})
contact_us_page.parts.create({
:title => "Side Body",
:body => "<p>163 Evergreen Terrace<br/>Happyville<br/>USA.<br/>Phone: 1-800 CALLUSNOW</p>"
:body => "<p>163 Evergreen Terrace<br/>Happyville<br/>USA.<br/>Phone: 1-800 CALLUSNOW</p>",
:position => 1
})

Page.create(:title => "Thank You",
thank_you_page = Page.create(:title => "Thank You",
:menu_match => "^/inquiries/thank_you$",
:show_in_menu => false,
:deletable => false,
:position => 3,
:parent_id => 4).parts.create(
{
:position => 0,
:parent_id => contact_us_page.id)
thank_you_page.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>"
: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>",
:position => 0
})

Page.create(:title => "Page not found",
page_not_found_page = Page.create(:title => "Page not found",
:menu_match => "^/404$",
:show_in_menu => false,
:deletable => false,
:position => 4).parts.create(
{
:position => (page_position += 1))
page_not_found_page.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>"
: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>",
:position => 0
})

Page.create(:title => "Privacy Policy",
privacy_policy_page = Page.create(:title => "Privacy Policy",
:deletable => true,
:show_in_menu => false,
:position => 5).parts.create(
{
:position => (page_position += 1))
privacy_policy_page.parts.create({
:title => "Body",
: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(
{
: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>",
:position => 0
})
privacy_policy_page.parts.create({
:title => "Side Body",
:body => ""
:body => "",
:position => 1
})

Page.create(:title => "Down for maintenance",
down_for_maintenance_page = Page.create(:title => "Down for maintenance",
:menu_match => "^/maintenance$",
:show_in_menu => false,
:position => 6).parts.create(
{
:position => (page_position += 1))
down_for_maintenance_page.parts.create({
:title => "Body",
:body => "<p>Our site is currently down for maintenance. Please try back later.</p>"
:body => "<p>Our site is currently down for maintenance. Please try back later.</p>",
:position => 0
})

# Create a default themes directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ def create
@user.plugins = @selected_plugin_titles
@user.save
UserSession.create!(@user)
current_user.update_attribute(:superuser, true) if User.count == 1 # this is the superuser if this user is the only user.
if User.count == 1
# this is the superuser if this user is the only user.
current_user.update_attribute(:superuser, true)

# set this user as the recipient of inquiry notifications
if (notification_recipients = InquirySetting.find_or_create_by_name("Notification Recipients")).present?
notification_recipients.update_attributes({
:value => current_user.email,
:destroyable => false
})
end
end

redirect_back_or_default(admin_root_url)
flash[:notice] = "Welcome to Refinery, #{current_user.login}."

Expand Down

0 comments on commit 91805f1

Please sign in to comment.