This GEM is not under active development. It's best to not use it at all.
under_construction
This GEM provides some generators to simplify managing and creating Under Construction or coming soon page.
features:
- Automatically edits files to redirect all requests to under construction page
- Ability to schedule for removing redirects in a specific launch time
- Save emails in a text file to send newsletters
- Generator for stopping redirects(manual option)
- Including (currently) one free UnderConstruction template
Install
In Rails 3, simply add the GEM to your gemfile:
gem 'under_construction'
Then run the config
generator. This will edit your application_controller
to
redirect all the URLs to under construction page (make a config file before, see config
section)
rails g under_construction:config
For removing configs you have to use clear
generator (After launch time automatically will be run):
rails g under_construction:clear
Note: the clear generator won't work if you edit the codes generated by config
,
you need to manually remove them later.
Note: After launch time clear generator will be run.
Config
Put your configs in config/under_construction.yml file and edit it as you wish. Depending on the theme using, not all options may be used:
theme: 'site-under-construction'
launch_time: "24 Feb 2050 7:00pm"
time_zone: "UTC" # Used in scheduler. For opetions, see http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
progress: "60" # Percent
progress_label: "Progress"
website_address: "http://example.com"
host_name: "localhost:3000"
info:
site_title: "My Website"
logo_url: "/assets/under_construction/site-under-construction/logo.png"
email: "support@example.com"
phone: "phone : 555-123456"
heading: "This website is under construction"
counter_heading: "Estimated Time Remaining Before Launch:"
about_title: "Some words about us"
about_content: |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Phasellus hendrerit. Pellentesque aliquet nibh nec urna. I
n nisi neque, aliquet vel, dapibus id, mattis vel, nisi.
inform_by_email: "Type your email id to get the updates!"
email_field_value: "Enter Your E-mail"
copyright: "Copyright ©"
site_developer:
name: "Great Developer"
socials_title: "You may find us below:"
socials:
twitter: "#" #Full URL: http://twitter.com/great_developer
facebook: "#"
yahoo: "#"
# stumbleupon: "#"
flickr: "#"
#google: "#"
youtube: "#"
skype: "#"
deviantart: "#"
identica: "#"
notify_mail:
sender_email_address: "do_not_reply@example.com"
email_subject: "My Website just launched!"
email_content: |
Hi! Our site, "Example", has just launched!
Click the flowing link to view the website: http://example.com
Note: you need to restart the rails server for scheduler to be able to initialize after configuration.
Themes
There are two themes for under construction but you can design another one and send it for us or you can modify theme in your views/under_construction/theme.
Currently two themes are:
- site-under-construction
- site-under-construction-fa
Assets
Every theme has its own asset. First make two directive files in your assets app:
/assets/javascripts/under_construction.js
/assets/stylesheets/under_construction.css
In stylesheet, you have to include under_construction/theme like below:
/*
*= require under_construction/site-under-construction
*/
In javascript, you have to include under_construction/theme like below:
//= require under_construction/site-under-construction
//= require jquery_ujs
Make a file in config/initializers
named assets.rb
and put following code inside it or Rails 4 may:
Rails.application.config.assets.precompile += %w( under_construction.js under_construction.css )
Rails 3 Note: If you want your under construction works on production mode you must adds under_construction.js and under_construction.css in your production env in config.assets.precompile like below:
config.assets.precompile += %w( under_construction.js under_construction.css )
Rails 4
- Don't forget to add
config/initializers/assets.rb
file or Rails will throw an error - The scheduler will run
clear
task instantly if the date provided is past. Because of Rails 4spring
feature that keeps Rails loaded, when testing, theclear
task may run repeatedly. So please make sure you stopspring
everytime you change the time inunder_construction.yml
.
I18n
This gem is using standard Rails I18n translation for the error message generated and name of models.
en:
email_storage:
form:
submit: "SUBMIT"
controllers:
under_construction_email_storage:
create:
flash:
success: "Your email added successfully."
activemodel:
errors:
models:
under_construction_email_storage:
attributes:
email:
format: "format is invalid"
uniqueness: "is registered before"
models:
under_construction_email_storage: "Under Construction Email Storage"
attributes:
under_construction_email_storage:
email: "Email"
Send notifications
Email of those who have submited their email in the under construction page will be saved in a simple text file under db/under_construction_mails.txt
. There's a rake task that automatically reads the file and sends notification mails:
rake under_construction:send_mails
Note: After launch time, it will be run by scheduler.
Contribute
- Fork
- Change
- Test
- Pull request
LICENSE
This project is a gem for under construction page in rails. Copyright (C) 2012 Naqsh Jahan Toos Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.