conschedule 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +154 -0
- data/Rakefile +37 -0
- data/app/assets/config/conschedule_manifest.js +2 -0
- data/app/assets/fonts/icomoon.eot +0 -0
- data/app/assets/fonts/proxima_nova_100.eot +0 -0
- data/app/assets/fonts/proxima_nova_400.eot +0 -0
- data/app/assets/fonts/proxima_nova_700.eot +0 -0
- data/app/assets/images/conschedule/chosen-sprite-small.png +0 -0
- data/app/assets/images/conschedule/chosen-sprite.png +0 -0
- data/app/assets/images/conschedule/close.png +0 -0
- data/app/assets/images/conschedule/spinner-small.gif +0 -0
- data/app/assets/images/conschedule/spinner.gif +0 -0
- data/app/assets/javascripts/conschedule/application.js +22 -0
- data/app/assets/javascripts/conschedule/calendar.js +467 -0
- data/app/assets/javascripts/conschedule/date.js +104 -0
- data/app/assets/javascripts/conschedule/form.js +53 -0
- data/app/assets/javascripts/conschedule/home.js +149 -0
- data/app/assets/javascripts/conschedule/jquery-ui-datepicker.min.js +1674 -0
- data/app/assets/javascripts/conschedule/jquery.easing.min.js +44 -0
- data/app/assets/javascripts/conschedule/jquery.validate.js +1532 -0
- data/app/assets/javascripts/conschedule/js_time_zone.js +1433 -0
- data/app/assets/javascripts/conschedule/moment-timezone.js +1209 -0
- data/app/assets/javascripts/conschedule/moment.js +4195 -0
- data/app/assets/javascripts/conschedule/schedules.js +22 -0
- data/app/assets/javascripts/conschedule/time_zones_drop_down.js +609 -0
- data/app/assets/stylesheets/conschedule/application.css +4 -0
- data/app/assets/stylesheets/conschedule/common.css +816 -0
- data/app/assets/stylesheets/conschedule/home.css +2441 -0
- data/app/assets/stylesheets/conschedule/main.css +884 -0
- data/app/assets/stylesheets/conschedule/schedules.css +4 -0
- data/app/controllers/conschedule/application_controller.rb +49 -0
- data/app/controllers/conschedule/schedules_controller.rb +125 -0
- data/app/helpers/conschedule/application_helper.rb +15 -0
- data/app/helpers/conschedule/schedules_helper.rb +43 -0
- data/app/jobs/conschedule/application_job.rb +4 -0
- data/app/mailers/conschedule/schedules_mailer.rb +46 -0
- data/app/models/conschedule/application_record.rb +5 -0
- data/app/models/conschedule/schedule.rb +63 -0
- data/app/views/conschedule/schedules/_confirmation.html.erb +38 -0
- data/app/views/conschedule/schedules/_page_one.html.erb +75 -0
- data/app/views/conschedule/schedules/_page_three.html.erb +94 -0
- data/app/views/conschedule/schedules/_page_two.html.erb +22 -0
- data/app/views/conschedule/schedules/_schedules.html.erb +122 -0
- data/app/views/conschedule/schedules/create.js.erb +11 -0
- data/app/views/conschedule/schedules/index.html.erb +123 -0
- data/app/views/conschedule/schedules/index.js.erb +3 -0
- data/app/views/conschedule/schedules/new.html.erb +11 -0
- data/app/views/conschedule/schedules_mailer/send_cancel_email_owner.html.erb +61 -0
- data/app/views/conschedule/schedules_mailer/send_cancel_email_user.html.erb +29 -0
- data/app/views/conschedule/schedules_mailer/send_confirmation_email_owner.html.erb +77 -0
- data/app/views/conschedule/schedules_mailer/send_confirmation_email_user.html.erb +30 -0
- data/app/views/kaminari/custom_theme/_first_page.html.erb +3 -0
- data/app/views/kaminari/custom_theme/_gap.html.erb +1 -0
- data/app/views/kaminari/custom_theme/_last_page.html.erb +3 -0
- data/app/views/kaminari/custom_theme/_next_page.html.erb +1 -0
- data/app/views/kaminari/custom_theme/_page.html.erb +5 -0
- data/app/views/kaminari/custom_theme/_paginator.html.erb +23 -0
- data/app/views/kaminari/custom_theme/_prev_page.html.erb +1 -0
- data/app/views/layouts/conschedule/application.html.erb +14 -0
- data/app/views/layouts/conschedule/mailer.html.erb +11 -0
- data/app/views/layouts/conschedule/schedules.html.erb +14 -0
- data/config/initializers/assets.rb +11 -0
- data/config/routes.rb +11 -0
- data/db/migrate/20160812085505_create_conschedule_schedules.rb +27 -0
- data/lib/conschedule.rb +34 -0
- data/lib/conschedule/configuration.rb +25 -0
- data/lib/conschedule/engine.rb +5 -0
- data/lib/conschedule/gem_dependencies.rb +2 -0
- data/lib/conschedule/version.rb +3 -0
- data/lib/generators/conschedule/install_generator.rb +23 -0
- data/lib/generators/conschedule/views_generator.rb +45 -0
- data/lib/generators/templates/README +40 -0
- data/lib/generators/templates/initializer.rb +25 -0
- data/lib/tasks/conschedule_tasks.rake +4 -0
- metadata +182 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
<div bgcolor="#ffffff" style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;min-height:100%;width:100%!important;background-color:#ffffff">
|
2
|
+
<div style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;padding:20px 0;margin:0 auto;max-width:600px">
|
3
|
+
<table style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;width:80%;margin:20px auto 0;width:80%;margin:30px auto 0;font-size:16px">
|
4
|
+
<tbody>
|
5
|
+
<tr style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif">
|
6
|
+
<td style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;color:#666a7a;line-height:22px">
|
7
|
+
<div style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif">
|
8
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px">Hi <%= @schedule.full_name %>,</p>
|
9
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px">
|
10
|
+
Your <%= @schedule.event_name %> with <%= Conschedule.contact_name %> at
|
11
|
+
<span tabindex="0">
|
12
|
+
<span><%= @schedule.slot_start_time.strftime("%-l:%M%P") %></span>
|
13
|
+
</span>
|
14
|
+
(<%= @schedule.user_tz_offset %>) on <%= @slot_date %> has been canceled.
|
15
|
+
</p>
|
16
|
+
</div>
|
17
|
+
<% unless @schedule.cancel_reason.blank? %>
|
18
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;margin-top:30px;color:#e41600">
|
19
|
+
<strong style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:14px">Cancellation Reason:</strong>
|
20
|
+
<br style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif">
|
21
|
+
<span style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px"><%= @schedule.cancel_reason %></span>
|
22
|
+
</p>
|
23
|
+
<% end %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<div bgcolor="#ffffff" style="background-color:#ffffff">
|
2
|
+
<div style="padding:20px 0;margin:0 auto;max-width:600px">
|
3
|
+
<table style="width:80%;margin:0 auto;padding-bottom:20px;border-bottom:1px dashed #dadada">
|
4
|
+
<tbody>
|
5
|
+
<tr>
|
6
|
+
<td style="text-align:center">
|
7
|
+
<p>
|
8
|
+
</p>
|
9
|
+
</td>
|
10
|
+
</tr>
|
11
|
+
</tbody>
|
12
|
+
</table>
|
13
|
+
<table style="width:80%;margin:30px auto 0;font-size:16px">
|
14
|
+
<tbody>
|
15
|
+
<tr>
|
16
|
+
<td style="color:#666a7a;line-height:22px">
|
17
|
+
<p style="margin-bottom:12px">
|
18
|
+
Hi <%= Conschedule.contact_name %>,
|
19
|
+
</p>
|
20
|
+
<p style="margin-bottom:12px">
|
21
|
+
A new event has been scheduled.
|
22
|
+
</p>
|
23
|
+
<p style="margin-bottom:12px">
|
24
|
+
<strong style="font-size:14px">
|
25
|
+
Event Type:
|
26
|
+
</strong>
|
27
|
+
<br> <%= @schedule.event_name %>
|
28
|
+
</p>
|
29
|
+
<p style="margin-bottom:12px">
|
30
|
+
<strong style="font-size:14px">
|
31
|
+
Invitee:
|
32
|
+
</strong>
|
33
|
+
<br> <%= @schedule.full_name %>
|
34
|
+
</p>
|
35
|
+
<p style="margin-bottom:12px">
|
36
|
+
<strong style="font-size:14px">
|
37
|
+
Invitee Email:
|
38
|
+
</strong>
|
39
|
+
<br>
|
40
|
+
<a href="mailto:<%= @schedule.email %>" target="_blank"><%= @schedule.email %></a>
|
41
|
+
</p>
|
42
|
+
<p style="margin-bottom:12px">
|
43
|
+
<strong style="font-size:14px">
|
44
|
+
Event Date/Time:
|
45
|
+
</strong>
|
46
|
+
<br>
|
47
|
+
<span tabindex="0">
|
48
|
+
<span><%= @slot_start_time.strftime("%-l:%M%P") %></span>
|
49
|
+
</span>
|
50
|
+
- <%= @schedule.slot_start_time.strftime("%A, %B %-d, %Y") %> (<%= @schedule.app_tz_offset %>)
|
51
|
+
</p>
|
52
|
+
<p style="margin-bottom:12px">
|
53
|
+
<strong style="font-size:14px">
|
54
|
+
Description:
|
55
|
+
</strong>
|
56
|
+
<br> <%= @schedule.event_description %>
|
57
|
+
</p>
|
58
|
+
<p style="margin-bottom:12px">
|
59
|
+
<strong style="font-size:14px">
|
60
|
+
Location:
|
61
|
+
</strong>
|
62
|
+
<br><%= @schedule.location_details %>
|
63
|
+
</p>
|
64
|
+
</td>
|
65
|
+
</tr>
|
66
|
+
</tbody>
|
67
|
+
</table>
|
68
|
+
<table style="width:80%;margin:30px auto;border-top:1px dashed #dadada">
|
69
|
+
<tbody>
|
70
|
+
<tr>
|
71
|
+
<td style="color:#a8a8a8;padding-top:15px">
|
72
|
+
</td>
|
73
|
+
</tr>
|
74
|
+
</tbody>
|
75
|
+
</table>
|
76
|
+
</div>
|
77
|
+
</div>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<div bgcolor="#ffffff" style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;min-height:100%;width:100%!important;background-color:#ffffff">
|
2
|
+
<div style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;padding:20px 0;margin:0 auto;max-width:600px">
|
3
|
+
<table style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;width:80%;margin:20px auto 0;width:80%;margin:30px auto 0;font-size:16px">
|
4
|
+
<tbody>
|
5
|
+
<tr style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif">
|
6
|
+
<td style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;color:#666a7a;line-height:22px">
|
7
|
+
<div style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif">
|
8
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px">Hi <%= @schedule.full_name %>,</p>
|
9
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px">
|
10
|
+
Your <%= @schedule.event_name %> with <%= Conschedule.contact_name %> at
|
11
|
+
<span tabindex="0">
|
12
|
+
<span><%= @schedule.slot_start_time.strftime("%-l:%M%P") %></span>
|
13
|
+
</span>
|
14
|
+
(<%= @schedule.user_tz_offset %>) on <%= @slot_date %> is scheduled.
|
15
|
+
</p>
|
16
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px">
|
17
|
+
<%= @schedule.event_description %>
|
18
|
+
</p>
|
19
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px">
|
20
|
+
<strong style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif">Location:</strong>
|
21
|
+
<%= @schedule.location_details %>
|
22
|
+
</p>
|
23
|
+
<p style="margin:0;padding:0;font-family:Proxima Nova,proxima-nova,Helvetica,Arial sans-serif;font-size:16px;margin-top:12px"></p>
|
24
|
+
</div>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
</div>
|
30
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<span class="page gap"><%= t('views.pagination.truncate').html_safe %></span>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= link_to_unless current_page.last?, ">", url, rel: 'next', remote: remote, class: "page-link next" %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= paginator.render do -%>
|
2
|
+
<div class="js-pagination-region row">
|
3
|
+
<div class="pagination right light-theme simple-pagination">
|
4
|
+
<ul>
|
5
|
+
<%= prev_page_tag unless current_page.first? %>
|
6
|
+
<% each_page do |page| -%>
|
7
|
+
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
8
|
+
<li class="<%= 'active' if page.current? %>">
|
9
|
+
<%= page_tag page %>
|
10
|
+
</li>
|
11
|
+
<% elsif !page.was_truncated? -%>
|
12
|
+
<li>
|
13
|
+
<%= gap_tag %>
|
14
|
+
</li>
|
15
|
+
<% end -%>
|
16
|
+
<% end -%>
|
17
|
+
<li>
|
18
|
+
<%= next_page_tag unless current_page.last? %>
|
19
|
+
</li>
|
20
|
+
</ul>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<% end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= link_to_unless current_page.first?, "<", url, rel: 'prev', remote: remote, class: "page-link prev" %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<%= Gon::Base.render_data %>
|
5
|
+
<%= stylesheet_link_tag "conschedule/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "conschedule/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
<meta content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" name="viewport">
|
9
|
+
<meta content="yes" name="apple-mobile-web-app-capable">
|
10
|
+
</head>
|
11
|
+
<body class='dashboard publishers page-loaded'>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<%= Gon::Base.render_data %>
|
5
|
+
<%= stylesheet_link_tag "conschedule/schedules", media: "all" %>
|
6
|
+
<%= javascript_include_tag "conschedule/schedules" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
<meta content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" name="viewport">
|
9
|
+
<meta content="yes" name="apple-mobile-web-app-capable">
|
10
|
+
</head>
|
11
|
+
<body class='page-loaded'>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
+
Rails.application.config.assets.precompile += %w( conschedule/schedules.css conschedule/schedules.js )
|
data/config/routes.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
class CreateConscheduleSchedules < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :conschedule_schedules do |t|
|
4
|
+
t.string :app_time_zone
|
5
|
+
t.string :user_time_zone
|
6
|
+
t.string :app_tz_offset
|
7
|
+
t.string :user_tz_offset
|
8
|
+
t.string :event_name
|
9
|
+
t.string :event_description
|
10
|
+
t.string :location_details
|
11
|
+
t.datetime :slot_start_time
|
12
|
+
t.datetime :slot_end_time
|
13
|
+
t.string :contact_name
|
14
|
+
t.string :first_name
|
15
|
+
t.string :last_name
|
16
|
+
t.string :phone
|
17
|
+
t.string :email
|
18
|
+
t.text :message
|
19
|
+
t.string :status, default: :active
|
20
|
+
t.string :cancel_reason
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index :conschedule_schedules, :slot_start_time
|
25
|
+
add_index :conschedule_schedules, :status
|
26
|
+
end
|
27
|
+
end
|
data/lib/conschedule.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "conschedule/engine"
|
2
|
+
require "conschedule/configuration"
|
3
|
+
require "conschedule/gem_dependencies"
|
4
|
+
|
5
|
+
module Conschedule
|
6
|
+
|
7
|
+
extend Configuration
|
8
|
+
|
9
|
+
# default configuration
|
10
|
+
define_setting :main_heading, "Contact"
|
11
|
+
define_setting :purpose, 'An introduction to our product'
|
12
|
+
define_setting :instructions, 'Learn about our product'
|
13
|
+
define_setting :location_details, 'Details will be provided on confirmation'
|
14
|
+
define_setting :system_time_zone, "Asia/Kolkata"
|
15
|
+
define_setting :start_date, Time.now.in_time_zone(Conschedule.system_time_zone).beginning_of_year.strftime("%Y-%m-%d")
|
16
|
+
define_setting :end_date, Time.now.in_time_zone(Conschedule.system_time_zone).end_of_year.strftime("%Y-%m-%d")
|
17
|
+
define_setting :available_days, ["Mon", "Tue", "Wed", "Thu", "Fri"]
|
18
|
+
define_setting :black_out_dates
|
19
|
+
define_setting :sun_timings, ["09:00", "22:00"]
|
20
|
+
define_setting :mon_timings, ["09:00", "22:00"]
|
21
|
+
define_setting :tue_timings, ["09:00", "22:00"]
|
22
|
+
define_setting :wed_timings, ["09:00", "22:00"]
|
23
|
+
define_setting :thu_timings, ["09:00", "22:00"]
|
24
|
+
define_setting :fri_timings, ["09:00", "22:00"]
|
25
|
+
define_setting :sat_timings, ["09:00", "22:00"]
|
26
|
+
define_setting :duration, 30
|
27
|
+
define_setting :from_address, "PLEASE-CHANGE-ME@example.com"
|
28
|
+
define_setting :send_confirmation_mail, false
|
29
|
+
define_setting :send_cancel_mail, false
|
30
|
+
define_setting :to_address, "PLEASE-CHANGE-ME@example.com"
|
31
|
+
define_setting :contact_name, "PLEASE-CHANGE-ME"
|
32
|
+
define_setting :enable_tz, true
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Configuration
|
2
|
+
|
3
|
+
def configuration
|
4
|
+
yield self
|
5
|
+
end
|
6
|
+
|
7
|
+
def define_setting(name, default = nil)
|
8
|
+
class_variable_set("@@#{name}", default)
|
9
|
+
define_class_method "#{name}=" do |value|
|
10
|
+
class_variable_set("@@#{name}", value)
|
11
|
+
end
|
12
|
+
define_class_method name do
|
13
|
+
class_variable_get("@@#{name}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def define_class_method(name, &block)
|
20
|
+
(class << self; self; end).instance_eval do
|
21
|
+
define_method name, &block
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Conschedule
|
2
|
+
module Generators
|
3
|
+
|
4
|
+
class InstallGenerator < Rails::Generators::Base #:nodoc:
|
5
|
+
source_root File.expand_path("../../templates", __FILE__)
|
6
|
+
|
7
|
+
desc "Creates a Conschedule initializer and copy migration file to your application."
|
8
|
+
|
9
|
+
def copy_initializer
|
10
|
+
copy_file "initializer.rb", "config/initializers/conschedule.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
def copy_migration
|
14
|
+
run('rails conschedule:install:migrations')
|
15
|
+
end
|
16
|
+
|
17
|
+
def show_readme
|
18
|
+
readme "README"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Conschedule
|
2
|
+
module Generators
|
3
|
+
|
4
|
+
module ViewPathTemplates #:nodoc:
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
class_option :views, aliases: "-v", type: :array, desc: "Select specific views to generate (form, listing page, mailer)"
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
def view_directory(name)
|
13
|
+
if name.to_s == "form"
|
14
|
+
directory "conschedule/schedules", "app/views/conschedule/schedules", exclude_pattern: /index|_schedules/
|
15
|
+
elsif name.to_s == "listing"
|
16
|
+
["index.html.erb","index.js.erb","_schedules.html.erb"].each do |file|
|
17
|
+
copy_file "conschedule/schedules/#{file}", "app/views/conschedule/schedules/#{file}"
|
18
|
+
end
|
19
|
+
directory "kaminari", "app/views/kaminari"
|
20
|
+
elsif name.to_s == "mailer"
|
21
|
+
directory "conschedule/schedules_mailer", "app/views/conschedule/schedules_mailer"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class ViewsGenerator < Rails::Generators::Base #:nodoc:
|
27
|
+
include ViewPathTemplates
|
28
|
+
|
29
|
+
source_root File.expand_path("../../../../app/views", __FILE__)
|
30
|
+
|
31
|
+
desc "Copies Conschedule views to your application."
|
32
|
+
def copy_views
|
33
|
+
if options[:views]
|
34
|
+
options[:views].each do |directory|
|
35
|
+
view_directory directory.to_sym
|
36
|
+
end
|
37
|
+
else
|
38
|
+
view_directory :form
|
39
|
+
view_directory :listing
|
40
|
+
view_directory :mailer
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Some setup you must do manually if you haven't yet:
|
4
|
+
|
5
|
+
1. Ensure you have no pending migrations, run:
|
6
|
+
|
7
|
+
rails db:migrate RAILS_ENV=development
|
8
|
+
|
9
|
+
2. Add the following to your routes.rb file:
|
10
|
+
|
11
|
+
mount Conschedule::Engine, at: "/"
|
12
|
+
|
13
|
+
(NOTE: You may mount it at any path, not just "/")
|
14
|
+
|
15
|
+
3. If you wish to authenticate listing page with Devise, it would look something like:
|
16
|
+
|
17
|
+
authenticate :admin do
|
18
|
+
get "/admin/schedules" => "conschedule/schedules#index"
|
19
|
+
end
|
20
|
+
|
21
|
+
4. Ensure you have set 'from_address' and 'contact_name' in config/initializers/conschedule.rb
|
22
|
+
|
23
|
+
config.from_address = "foo@example.com"
|
24
|
+
config.contact_name = "foo"
|
25
|
+
|
26
|
+
5. If you wish to receive confirmation and cancel mails, ensure you have set following config variables in config/initializers/conschedule.rb:
|
27
|
+
|
28
|
+
config.send_confirmation_mail = true
|
29
|
+
config.send_cancel_mail = true
|
30
|
+
config.to_address = "foo@example.com"
|
31
|
+
|
32
|
+
6. You can copy Conschedule views (for customization) to your app by running:
|
33
|
+
|
34
|
+
rails g conschedule:views
|
35
|
+
|
36
|
+
OR
|
37
|
+
|
38
|
+
rails g conschedule:views -v form listing mailer
|
39
|
+
|
40
|
+
===============================================================================
|