under_construction 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +156 -0
- data/Rakefile +35 -0
- data/app/assets/fonts/under_construction/site-under-construction-fa/IranianSans.eot +0 -0
- data/app/assets/fonts/under_construction/site-under-construction-fa/IranianSans.ttf +0 -0
- data/app/assets/fonts/under_construction/site-under-construction-fa/IranianSans.woff +0 -0
- data/app/assets/images/under_construction/site-under-construction/bg.jpg +0 -0
- data/app/assets/images/under_construction/site-under-construction/button.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/counter_bg.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/deviantart.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/facebook.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/flickr.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/google.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/identica.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/linkedin.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/logo.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/mail-bg.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/next.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/page_background.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/prev.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/skype.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/stumbleupon.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/twitter.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/yahoo.png +0 -0
- data/app/assets/images/under_construction/site-under-construction/youtube.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/bg.jpg +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/button.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/counter_bg.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/deviantart.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/facebook.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/flickr.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/google.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/identica.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/linkedin.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/logo.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/mail-bg.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/next.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/page_background.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/prev.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/skype.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/stumbleupon.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/twitter.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/yahoo.png +0 -0
- data/app/assets/images/under_construction/site-under-construction-fa/youtube.png +0 -0
- data/app/assets/javascripts/under_construction/site-under-construction/DD_belatedPNG_0.0.7a-min.js +14 -0
- data/app/assets/javascripts/under_construction/site-under-construction/jcarousellite1.0.1_min.js +1 -0
- data/app/assets/javascripts/under_construction/site-under-construction/jquery.countdown.min.js +6 -0
- data/app/assets/javascripts/under_construction/site-under-construction-fa/DD_belatedPNG_0.0.7a-min.js +14 -0
- data/app/assets/javascripts/under_construction/site-under-construction-fa/jcarousellite1.0.1_min.js +1 -0
- data/app/assets/javascripts/under_construction/site-under-construction-fa/jquery.countdown-fa.js +13 -0
- data/app/assets/javascripts/under_construction/site-under-construction-fa/jquery.countdown.min.js +6 -0
- data/app/assets/stylesheets/under_construction/site-under-construction/style.css +325 -0
- data/app/assets/stylesheets/under_construction/site-under-construction-fa/style.css +326 -0
- data/app/controllers/under_construction_controller.rb +20 -0
- data/app/controllers/under_construction_email_storage_controller.rb +17 -0
- data/app/helpers/email_storage_helper.rb +13 -0
- data/app/mailers/notify_under_construction_submitted_mails.rb +7 -0
- data/app/models/under_construction_email_storage.rb +61 -0
- data/app/views/email_storage/_form.html.erb +6 -0
- data/app/views/notify_under_construction_submitted_mails/under_construction_notify.text.erb +1 -0
- data/lib/generators/under_construction/USAGE +8 -0
- data/lib/generators/under_construction/clear_generator.rb +38 -0
- data/lib/generators/under_construction/config_generator.rb +38 -0
- data/lib/generators/under_construction/constants.rb +37 -0
- data/lib/generators/under_construction/templates/under_construction/site-under-construction/index.html.erb +116 -0
- data/lib/generators/under_construction/templates/under_construction/site-under-construction-fa/index.html.erb +116 -0
- data/lib/generators/under_construction/templates/under_construction.yml +41 -0
- data/lib/generators/under_construction/templates/under_construction_scheduler.rb +6 -0
- data/lib/tasks/under_cunstruction_tasks.rake +12 -0
- data/lib/under_construction/config.rb +46 -0
- data/lib/under_construction/engine.rb +15 -0
- data/lib/under_construction/schedule.rb +39 -0
- data/lib/under_construction/version.rb +3 -0
- data/lib/under_construction.rb +18 -0
- metadata +283 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
class UnderConstructionEmailStorage
|
2
|
+
include ActiveModel::Validations
|
3
|
+
include ActiveModel::Conversion
|
4
|
+
extend ActiveModel::Naming
|
5
|
+
|
6
|
+
attr_accessor :email
|
7
|
+
FILE_PATH = Rails.root + "db/under_construction_mails.txt"
|
8
|
+
|
9
|
+
class UniquenessValidator < ActiveModel::EachValidator
|
10
|
+
def validate_each(record, attribute, value)
|
11
|
+
emails_path = Rails.root + "db/under_construction_mails.txt"
|
12
|
+
if File.exist? emails_path
|
13
|
+
File.open(emails_path, "r") do |f|
|
14
|
+
if f.readlines.include? value + "\n"
|
15
|
+
record.errors[attribute] << I18n.t('activemodel.errors.models.under_construction_email_storage.attributes.email.uniqueness', default: "Already submitted")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
validates :email, presence: true, uniqueness: true,
|
23
|
+
format: { with: /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i,
|
24
|
+
message: I18n.t('activemodel.errors.models.under_construction_email_storage.attributes.email.format', default: "doesn't looks like correct") }
|
25
|
+
|
26
|
+
def initialize(attributes = {})
|
27
|
+
attributes.each do |name, value|
|
28
|
+
send("#{name}=", value)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def persisted?
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
# save submitted mail to a text file
|
37
|
+
def save_to_file
|
38
|
+
File.open(FILE_PATH, "a") do |f|
|
39
|
+
f.puts email
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# return emails in a array
|
44
|
+
def self.emails
|
45
|
+
File.open(FILE_PATH, "r") do |f|
|
46
|
+
f.readlines
|
47
|
+
end
|
48
|
+
rescue Errno::ENOENT
|
49
|
+
[]
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.no_emails?
|
53
|
+
emails.empty?
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.remove_file
|
57
|
+
if File.exist? FILE_PATH
|
58
|
+
FileUtils.rm FILE_PATH
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= form_for @email, url: under_construction_email_storage_index_path, html: { id: 'subscribeform' } do |f| %>
|
2
|
+
<div id='email_input'>
|
3
|
+
<%= f.text_field :email, id: 'email', placeholder: @info['email_field_value'], size: 30 %>
|
4
|
+
<%= f.submit t('.submit', default: "SUBMIT"), id: 'submit' %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= UnderConstruction.config.notify_mail["email_content"] %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'constants'
|
2
|
+
|
3
|
+
module UnderConstruction
|
4
|
+
module Generators
|
5
|
+
class ClearGenerator < ::Rails::Generators::Base
|
6
|
+
desc 'Clears configs application controller'
|
7
|
+
def clear_application_controller
|
8
|
+
if File.exist?('app/controllers/application_controller.rb')
|
9
|
+
# remove the exact block we've inserted. We don't want
|
10
|
+
# to remove the block if user has edited it
|
11
|
+
gsub_file 'app/controllers/application_controller.rb', /#{Regexp.escape(APPLICATION_CONFIG_TXT)}/,
|
12
|
+
''
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def clear_routes_file
|
17
|
+
file_path = 'config/routes.rb'
|
18
|
+
gsub_file file_path, /#{Regexp.escape(ROUTES_CONFIG_TXT)}/, ''
|
19
|
+
gsub_file file_path, /#{Regexp.escape(ROUTES_REDIRECT_TO_TXT)}/, ''
|
20
|
+
insert_into_file file_path, ROUTES_CLEAR_TXT, after: /Application.routes.draw do/
|
21
|
+
end
|
22
|
+
|
23
|
+
# def remove_view_files
|
24
|
+
# file_path = 'app/views/under_construction'
|
25
|
+
# if File.exist? file_path
|
26
|
+
# remove_file file_path
|
27
|
+
# end
|
28
|
+
# end
|
29
|
+
|
30
|
+
def remove_scheduler_file
|
31
|
+
file_path = 'config/initializers/under_construction_scheduler.rb'
|
32
|
+
if File.exist? file_path
|
33
|
+
remove_file file_path
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'constants'
|
2
|
+
|
3
|
+
module UnderConstruction
|
4
|
+
module Generators
|
5
|
+
class ConfigGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
desc 'Configs application controller'
|
9
|
+
def edit_application_Controller
|
10
|
+
if File.exist?(Rails.root + "app/controllers/application_controller.rb")
|
11
|
+
insert_into_file "app/controllers/application_controller.rb", APPLICATION_CONFIG_TXT, :after => "protect_from_forgery"
|
12
|
+
else
|
13
|
+
raise 'Couldn\'t find application_controller file'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def copy_config_file
|
18
|
+
copy_file 'under_construction.yml', 'config/under_construction.yml'
|
19
|
+
end
|
20
|
+
|
21
|
+
def config_route_file
|
22
|
+
file_path = 'config/routes.rb'
|
23
|
+
gsub_file file_path, /match "under_construction", :to => redirect\('\/'\)/, ''
|
24
|
+
insert_into_file file_path, ROUTES_CONFIG_TXT, after: /Application.routes.draw do/
|
25
|
+
gsub_file file_path, /(Application.routes.draw do)(.*)(end)/m, '\1\2'+"#{ROUTES_REDIRECT_TO_TXT}" + '\3'
|
26
|
+
end
|
27
|
+
|
28
|
+
def copy_index_file_to_app
|
29
|
+
directory 'under_construction', 'app/views/under_construction'
|
30
|
+
end
|
31
|
+
|
32
|
+
def copy_scheduler_initializer
|
33
|
+
destination_path = 'config/initializers/under_construction_scheduler.rb'
|
34
|
+
copy_file 'under_construction_scheduler.rb', destination_path
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module UnderConstruction
|
2
|
+
module Generators
|
3
|
+
APPLICATION_CONFIG_TXT = <<-EOM
|
4
|
+
|
5
|
+
# Editing UnderConstruction block causes it's clear generator to not work
|
6
|
+
before_filter :redirect_to_under_construction
|
7
|
+
|
8
|
+
# Will redirect all requests to under construction page
|
9
|
+
def redirect_to_under_construction
|
10
|
+
if request.host_with_port == UnderConstruction.config.host_name && Rails.env.production?
|
11
|
+
unless request.url =~ /(under_construction|email_storage)/
|
12
|
+
redirect_to under_construction_index_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
EOM
|
17
|
+
|
18
|
+
ROUTES_CONFIG_TXT = <<-EOM
|
19
|
+
|
20
|
+
# generated by under_construction gem
|
21
|
+
resources 'under_construction_email_storage', only: :create
|
22
|
+
resources 'under_construction', only: :index
|
23
|
+
EOM
|
24
|
+
|
25
|
+
ROUTES_REDIRECT_TO_TXT = <<-EOM
|
26
|
+
|
27
|
+
# generated by under_construction gem
|
28
|
+
match "/*other" => redirect("/under_construction")
|
29
|
+
EOM
|
30
|
+
|
31
|
+
ROUTES_CLEAR_TXT = <<-EOM
|
32
|
+
|
33
|
+
# generated by under_construction gem
|
34
|
+
match "under_construction", :to => redirect('/')
|
35
|
+
EOM
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
2
|
+
<head>
|
3
|
+
<meta name="generator" content=
|
4
|
+
"HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<meta http-equiv="refresh" content="60">
|
8
|
+
|
9
|
+
<title><%= @info['site_title'] %></title>
|
10
|
+
<%= javascript_include_tag "application" %>
|
11
|
+
<%= stylesheet_link_tag "under_construction/#{@theme}/style.css", :media => "all" %>
|
12
|
+
<%= javascript_include_tag "under_construction/#{@theme}/jquery.countdown.min.js" %>
|
13
|
+
<%= javascript_include_tag "under_construction/#{@theme}/jcarousellite1.0.1_min.js" %>
|
14
|
+
<!-- jquery countdown-->
|
15
|
+
|
16
|
+
<script type="text/javascript">
|
17
|
+
$(function () {
|
18
|
+
var austDay = new Date("<%= Chronic.parse(@launch_time).to_s(:rfc822) %>");
|
19
|
+
$('#defaultCountdown').countdown({until: austDay, layout: '{dn} {dl}, {hn} {hl}, {mn} {ml}, and {sn} {sl}'});
|
20
|
+
$('#year').text(austDay.getFullYear());
|
21
|
+
});
|
22
|
+
</script><!-- jquery slider -->
|
23
|
+
|
24
|
+
<script type="text/javascript">
|
25
|
+
$(function() {
|
26
|
+
$("#slidertext").jCarouselLite({
|
27
|
+
btnNext: ".next",
|
28
|
+
btnPrev: ".prev"
|
29
|
+
});
|
30
|
+
});
|
31
|
+
</script><!--script for IE6-image transparency recover-->
|
32
|
+
<!--[if IE 6]>
|
33
|
+
<script type="text/javascript" src="js/DD_belatedPNG_0.0.7a-min.js"></script>
|
34
|
+
<script>
|
35
|
+
/* EXAMPLE */
|
36
|
+
DD_belatedPNG.fix('#logo img,#main,.counter,.twitter,.flickr,.facebook,.youtube,.skype,.stumbleupon, #submit,.prev img,.next img,#email');
|
37
|
+
</script>
|
38
|
+
<![endif]-->
|
39
|
+
</head>
|
40
|
+
|
41
|
+
<body>
|
42
|
+
<div class="container">
|
43
|
+
<%= view_flash_messages unless view_flash_messages.blank? %>
|
44
|
+
<div id="header">
|
45
|
+
<div id="logo">
|
46
|
+
<a href="/under_construction">
|
47
|
+
<img src="<%= @info['logo_url'] %>"></img>
|
48
|
+
</a>
|
49
|
+
</div><!--end logo-->
|
50
|
+
|
51
|
+
<div id="contact_details">
|
52
|
+
<p><%= link_to @info['email'], "#" %></p>
|
53
|
+
|
54
|
+
<p><%= link_to "#{@info['phone']}", "#" %></p>
|
55
|
+
</div><!--end contact details-->
|
56
|
+
</div><!--end header-->
|
57
|
+
|
58
|
+
<div style="clear:both"></div>
|
59
|
+
|
60
|
+
<div id="main">
|
61
|
+
<div id="content">
|
62
|
+
<div class="text">
|
63
|
+
<h2><%= @info['heading'] %></h2>
|
64
|
+
</div><!--end text-->
|
65
|
+
|
66
|
+
<div class="counter">
|
67
|
+
<h3><%= @info['counter_heading'] %></h3>
|
68
|
+
|
69
|
+
<div id="defaultCountdown"></div>
|
70
|
+
</div><!--end counter-->
|
71
|
+
|
72
|
+
<div class="details">
|
73
|
+
<!--slider prev button-->
|
74
|
+
<a class="prev" href="#">
|
75
|
+
<%= image_tag "under_construction/#{@theme}/prev.png" %></a>
|
76
|
+
|
77
|
+
<div id="sliderwrap">
|
78
|
+
<div id="slidertext">
|
79
|
+
<!-- The slider -->
|
80
|
+
|
81
|
+
<ul>
|
82
|
+
<li>
|
83
|
+
<h3><%= @info['inform_by_email'] %></h3>
|
84
|
+
<%= render partial: 'email_storage/form', object: @email %>
|
85
|
+
</li><!-- Slider item -->
|
86
|
+
|
87
|
+
<li>
|
88
|
+
<h3><%= @socials_title %></h3>
|
89
|
+
|
90
|
+
<div class="social">
|
91
|
+
<% @socials.each do |name, url| %>
|
92
|
+
<%= link_to name, url, class: name %>
|
93
|
+
<% end %>
|
94
|
+
</div>
|
95
|
+
</li><!-- Slider item -->
|
96
|
+
|
97
|
+
<li>
|
98
|
+
<h3><%= @info['about_title'] %></h3>
|
99
|
+
|
100
|
+
<p><%= @info['about_content'] %></p>
|
101
|
+
</li><!-- Slider item -->
|
102
|
+
</ul>
|
103
|
+
</div><!-- End of slidertext -->
|
104
|
+
</div><!-- End of sliderwrap -->
|
105
|
+
<!--slider next button-->
|
106
|
+
<a class="next" href=
|
107
|
+
"#"><%= image_tag "under_construction/#{@theme}/next.png" %></a>
|
108
|
+
</div><!--end details-->
|
109
|
+
</div><!--end content-->
|
110
|
+
|
111
|
+
<p class="copyright">
|
112
|
+
<%= raw @info['copyright'] + " " + @site_developer['name'] %></p>
|
113
|
+
</div><!--end main-->
|
114
|
+
</div><!--end class container-->
|
115
|
+
</body>
|
116
|
+
</html>
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="refresh" content="60">
|
4
|
+
<meta name="generator" content=
|
5
|
+
"HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
|
8
|
+
<title><%= @info['site_title'] %></title>
|
9
|
+
<%= javascript_include_tag "application" %>
|
10
|
+
<%= stylesheet_link_tag "under_construction/#{@theme}/style.css", :media => "all" %>
|
11
|
+
<%= javascript_include_tag "under_construction/#{@theme}/jquery.countdown.min.js" %>
|
12
|
+
<%= javascript_include_tag "under_construction/#{@theme}/jquery.countdown-fa.js" %>
|
13
|
+
<%= javascript_include_tag "under_construction/#{@theme}/jcarousellite1.0.1_min.js" %>
|
14
|
+
<!-- jquery countdown-->
|
15
|
+
|
16
|
+
<script type="text/javascript">
|
17
|
+
$(function () {
|
18
|
+
var austDay = new Date("<%= Chronic.parse(@launch_time).to_s(:rfc822) %>");
|
19
|
+
$('#defaultCountdown').countdown({until: austDay, layout: '{dn} {dl} و {hn} {hl} و {mn} {ml} و {sn} {sl}'});
|
20
|
+
$('#year').text(austDay.getFullYear());
|
21
|
+
});
|
22
|
+
</script><!-- jquery slider -->
|
23
|
+
|
24
|
+
<script type="text/javascript">
|
25
|
+
$(function() {
|
26
|
+
$("#slidertext").jCarouselLite({
|
27
|
+
btnNext: ".next",
|
28
|
+
btnPrev: ".prev"
|
29
|
+
});
|
30
|
+
});
|
31
|
+
</script><!--script for IE6-image transparency recover-->
|
32
|
+
<!--[if IE 6]>
|
33
|
+
<script type="text/javascript" src="js/DD_belatedPNG_0.0.7a-min.js"></script>
|
34
|
+
<script>
|
35
|
+
/* EXAMPLE */
|
36
|
+
DD_belatedPNG.fix('#logo img,#main,.counter,.twitter,.flickr,.facebook,.youtube,.skype,.stumbleupon, #submit,.prev img,.next img,#email');
|
37
|
+
</script>
|
38
|
+
<![endif]-->
|
39
|
+
</head>
|
40
|
+
|
41
|
+
<body dir="rtl">
|
42
|
+
<div class="container">
|
43
|
+
<%= view_flash_messages unless view_flash_messages.blank? %>
|
44
|
+
<div id="header">
|
45
|
+
<div id="logo">
|
46
|
+
<a href="/under_construction">
|
47
|
+
<img src="<%= @info['logo_url'] %>"></img>
|
48
|
+
</a>
|
49
|
+
</div><!--end logo-->
|
50
|
+
|
51
|
+
<div id="contact_details">
|
52
|
+
<p><%= link_to @info['email'], "#" %></p>
|
53
|
+
|
54
|
+
<p><%= link_to "#{@info['phone']}", "#" %></p>
|
55
|
+
</div><!--end contact details-->
|
56
|
+
</div><!--end header-->
|
57
|
+
|
58
|
+
<div style="clear:both"></div>
|
59
|
+
|
60
|
+
<div id="main">
|
61
|
+
<div id="content">
|
62
|
+
<div class="text">
|
63
|
+
<h2><%= @info['heading'] %></h2>
|
64
|
+
</div><!--end text-->
|
65
|
+
|
66
|
+
<div class="counter">
|
67
|
+
<h3><%= @info['counter_heading'] %></h3>
|
68
|
+
|
69
|
+
<div id="defaultCountdown"></div>
|
70
|
+
</div><!--end counter-->
|
71
|
+
|
72
|
+
<div class="details">
|
73
|
+
<!--slider prev button-->
|
74
|
+
<a class="prev" href="#">
|
75
|
+
<%= image_tag "under_construction/#{@theme}/prev.png" %></a>
|
76
|
+
|
77
|
+
<div id="sliderwrap">
|
78
|
+
<div id="slidertext">
|
79
|
+
<!-- The slider -->
|
80
|
+
|
81
|
+
<ul>
|
82
|
+
<li>
|
83
|
+
<h3><%= @info['inform_by_email'] %></h3>
|
84
|
+
<%= render partial: 'email_storage/form', object: @email %>
|
85
|
+
</li><!-- Slider item -->
|
86
|
+
|
87
|
+
<li>
|
88
|
+
<h3><%= @socials_title %></h3>
|
89
|
+
|
90
|
+
<div class="social">
|
91
|
+
<% @socials.each do |name, url| %>
|
92
|
+
<%= link_to name, url, class: name %>
|
93
|
+
<% end %>
|
94
|
+
</div>
|
95
|
+
</li><!-- Slider item -->
|
96
|
+
|
97
|
+
<li>
|
98
|
+
<h3><%= @info['about_title'] %></h3>
|
99
|
+
|
100
|
+
<p><%= @info['about_content'] %></p>
|
101
|
+
</li><!-- Slider item -->
|
102
|
+
</ul>
|
103
|
+
</div><!-- End of slidertext -->
|
104
|
+
</div><!-- End of sliderwrap -->
|
105
|
+
<!--slider next button-->
|
106
|
+
<a class="next" href=
|
107
|
+
"#"><%= image_tag "under_construction/#{@theme}/next.png" %></a>
|
108
|
+
</div><!--end details-->
|
109
|
+
</div><!--end content-->
|
110
|
+
|
111
|
+
<p class="copyright">
|
112
|
+
<%= raw @info['copyright'] + " " + @site_developer['name'] %></p>
|
113
|
+
</div><!--end main-->
|
114
|
+
</div><!--end class container-->
|
115
|
+
</body>
|
116
|
+
</html>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
theme: 'site-under-construction'
|
2
|
+
launch_time: "24 Feb 2050 7:00pm"
|
3
|
+
progress: "60" # Percent
|
4
|
+
progress_label: "Progress"
|
5
|
+
website_address: "http://example.com"
|
6
|
+
host_name: "localhost:3000"
|
7
|
+
info:
|
8
|
+
site_title: "My Website"
|
9
|
+
logo_url: "/assets/under_construction/site-under-construction/logo.png"
|
10
|
+
email: "support@example.com"
|
11
|
+
phone: "phone : 555-123456"
|
12
|
+
heading: "This website is under construction"
|
13
|
+
counter_heading: "Estimated Time Remaining Before Launch:"
|
14
|
+
about_title: "Some words about us"
|
15
|
+
about_content: |
|
16
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
17
|
+
Phasellus hendrerit. Pellentesque aliquet nibh nec urna. I
|
18
|
+
n nisi neque, aliquet vel, dapibus id, mattis vel, nisi.
|
19
|
+
inform_by_email: "Type your email id to get the updates!"
|
20
|
+
email_field_value: "Enter Your E-mail"
|
21
|
+
copyright: "Copyright ©"
|
22
|
+
site_developer:
|
23
|
+
name: "Great Developer"
|
24
|
+
socials_title: "You may find us below:"
|
25
|
+
socials:
|
26
|
+
twitter: "#" #Full URL: http://twitter.com/great_developer
|
27
|
+
facebook: "#"
|
28
|
+
yahoo: "#"
|
29
|
+
# stumbleupon: "#"
|
30
|
+
flickr: "#"
|
31
|
+
#google: "#"
|
32
|
+
youtube: "#"
|
33
|
+
skype: "#"
|
34
|
+
deviantart: "#"
|
35
|
+
identica: "#"
|
36
|
+
notify_mail:
|
37
|
+
sender_email_address: "do_not_reply@example.com"
|
38
|
+
email_subject: "My Website just launched!"
|
39
|
+
email_content: |
|
40
|
+
Hi! Our site, "Example", has just launched!
|
41
|
+
Click the flowing link to view the website: http://example.com
|
@@ -0,0 +1,12 @@
|
|
1
|
+
desc "Send notify emails to users submited their email to underconstruction page"
|
2
|
+
namespace :under_construction do
|
3
|
+
task :send_mails => :environment do
|
4
|
+
if File.exist? Rails.root + "db/under_construction_mails.txt"
|
5
|
+
UnderConstructionEmailStorage.emails.each do |email|
|
6
|
+
NotifyUnderConstructionSubmittedMails.under_construction_notify(email.chomp).deliver
|
7
|
+
end
|
8
|
+
else
|
9
|
+
puts "There's no email submitted"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'active_support/configurable'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module UnderConstruction
|
5
|
+
def self.configure(&block)
|
6
|
+
yield @config ||= UnderConstruction::Configuration.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.config
|
10
|
+
@config
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config_file
|
14
|
+
config_path = File.join(Rails.root, 'config','under_construction.yml')
|
15
|
+
if File.exist? File.join(Rails.root, 'config','under_construction.yml')
|
16
|
+
YAML.load_file(config_path)
|
17
|
+
else
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Configuration
|
23
|
+
include ActiveSupport::Configurable
|
24
|
+
|
25
|
+
config_accessor :theme
|
26
|
+
config_accessor :launch_time
|
27
|
+
config_accessor :host_name
|
28
|
+
config_accessor :progress
|
29
|
+
config_accessor :progress_label
|
30
|
+
config_accessor :info
|
31
|
+
config_accessor :site_developer
|
32
|
+
config_accessor :socials_title
|
33
|
+
config_accessor :socials
|
34
|
+
config_accessor :notify_mail
|
35
|
+
config_accessor :website_address
|
36
|
+
end
|
37
|
+
|
38
|
+
if config_file
|
39
|
+
configure do |configuration|
|
40
|
+
config_file.each_pair do |key, value|
|
41
|
+
configuration.config[key.to_sym] = value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module UnderConstruction
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
config.generators do |g|
|
4
|
+
g.test_framework :rspec,
|
5
|
+
:fixtures => false,
|
6
|
+
:view_specs => false,
|
7
|
+
:helper_specs => false,
|
8
|
+
:routing_specs => false,
|
9
|
+
:controller_specs => true,
|
10
|
+
:request_specs => true
|
11
|
+
g.assets false
|
12
|
+
g.helper false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module UnderConstruction
|
4
|
+
class Schedule
|
5
|
+
def initialize(*args)
|
6
|
+
@scheduler = Rufus::Scheduler.start_new
|
7
|
+
@end_time = args[0]
|
8
|
+
schedule()
|
9
|
+
end
|
10
|
+
|
11
|
+
def schedule
|
12
|
+
@end_time ||= UnderConstruction.config.launch_time
|
13
|
+
@job = @scheduler.at Chronic.parse(@end_time) do
|
14
|
+
invoke_clear_generator()
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Stop the schedule
|
19
|
+
def stop_schedule
|
20
|
+
@job.unschedule
|
21
|
+
end
|
22
|
+
|
23
|
+
# Shows all schaduled jobs. just for testing perposes
|
24
|
+
def jobs
|
25
|
+
@scheduler.jobs
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def invoke_clear_generator
|
30
|
+
Rails::Generators.invoke('under_construction:clear')
|
31
|
+
# If there's a scheduled job, remove it
|
32
|
+
stop_schedule if jobs.size > 0
|
33
|
+
# To make passenger to restart the application
|
34
|
+
FileUtils.touch Rails.root + 'tmp/restart.txt'
|
35
|
+
# After restart server, sends email to subscribers
|
36
|
+
system "bundle exec rake under_construction:send_mails RAILS_ENV=#{Rails.env}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'rufus-scheduler'
|
3
|
+
require 'chronic'
|
4
|
+
|
5
|
+
require "under_construction/engine"
|
6
|
+
|
7
|
+
module UnderConstruction
|
8
|
+
|
9
|
+
class Railtie < ::Rails::Railtie
|
10
|
+
initializer "set_autoload_paths" do |app|
|
11
|
+
if app.config.autoload_paths
|
12
|
+
require "under_construction/config"
|
13
|
+
require "under_construction/schedule"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|