conschedule 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,49 @@
|
|
|
1
|
+
module Conschedule
|
|
2
|
+
class ApplicationController < ActionController::Base
|
|
3
|
+
protect_from_forgery with: :exception
|
|
4
|
+
|
|
5
|
+
def validate_config
|
|
6
|
+
["main_heading", "purpose", "instructions", "location_details", "start_date", "end_date", "available_days", "system_time_zone", "black_out_dates", "sun_timings",
|
|
7
|
+
"mon_timings", "tue_timings", "wed_timings", "thu_timings", "fri_timings", "sat_timings", "duration", "from_address", "send_confirmation_mail", "send_cancel_mail",
|
|
8
|
+
"to_address", "contact_name"].each do |name|
|
|
9
|
+
case name
|
|
10
|
+
when "main_heading", "purpose", "instructions", "location_details"
|
|
11
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a String" if !Conschedule.send(name).blank? && !Conschedule.send(name).is_a?(String)
|
|
12
|
+
when "start_date"
|
|
13
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Date" unless Date.valid_date? *Conschedule.send(name).split('-').map(&:to_i)
|
|
14
|
+
when "end_date"
|
|
15
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Date" unless Date.valid_date? *Conschedule.send(name).split('-').map(&:to_i)
|
|
16
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be greater than start date" if Conschedule.end_date.to_date < Conschedule.start_date.to_date
|
|
17
|
+
when "available_days"
|
|
18
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Array" if !Conschedule.send(name).is_a?(Array)
|
|
19
|
+
valid_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
|
20
|
+
invalid_values = Conschedule.send(name) - valid_days
|
|
21
|
+
fail "Invalid value for #{name.to_s.titleize}, valid values are #{valid_days.join(', ')}" unless invalid_values.empty?
|
|
22
|
+
when "system_time_zone"
|
|
23
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid TimeZone" unless ActiveSupport::TimeZone[Conschedule.send(name)].present?
|
|
24
|
+
when "black_out_dates"
|
|
25
|
+
unless Conschedule.send(name).blank?
|
|
26
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Array" if !Conschedule.send(name).is_a?(Array)
|
|
27
|
+
Conschedule.send(name).each do |date|
|
|
28
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Date" unless Date.valid_date? *date.split('-').map(&:to_i)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
when "sun_timings", "mon_timings", "tue_timings", "wed_timings", "thu_timings", "fri_timings", "sat_timings"
|
|
32
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Array" if !Conschedule.send(name).is_a?(Array)
|
|
33
|
+
start_time, end_time = Conschedule.send(name)
|
|
34
|
+
fail "Invalid value for #{name.to_s.titleize}, value should have a valid start time" if /^(2[0-3]|[01][0-9]):([0-5][0-9])$/.match(start_time).blank?
|
|
35
|
+
fail "Invalid value for #{name.to_s.titleize}, value should have a valid end time" if /^(2[0-3]|[01][0-9]):([0-5][0-9])$/.match(end_time).blank?
|
|
36
|
+
fail "Invalid value for #{name.to_s.titleize}, value should have a valid start time and end time" if end_time.to_time < start_time.to_time
|
|
37
|
+
when "duration"
|
|
38
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Integer" if !Conschedule.send(name).is_a?(Integer)
|
|
39
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a greater than or equal to 5 and less than or equal to 1440" unless Conschedule.send(name) >= 5 && Conschedule.send(name) <= 1440
|
|
40
|
+
when "send_confirmation_mail", "send_cancel_mail"
|
|
41
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a valid Boolean true or false" unless Conschedule.send(name).is_a?(TrueClass) || Conschedule.send(name).is_a?(FalseClass)
|
|
42
|
+
when "contact_name"
|
|
43
|
+
fail "Invalid value for #{name.to_s.titleize}, value should be a string" if !Conschedule.send(name).is_a?(String)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
require_dependency "conschedule/application_controller"
|
|
2
|
+
|
|
3
|
+
module Conschedule
|
|
4
|
+
class SchedulesController < ApplicationController
|
|
5
|
+
|
|
6
|
+
before_action :validate_config
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
config_data
|
|
10
|
+
@filters_applied = params[:status_ids].present? && params[:status_ids].include?("cancelled") ? true : false
|
|
11
|
+
@schedules = schedules_search.page(params[:page])
|
|
12
|
+
@grouped = @schedules.group_by { |s| s.slot_start_time.strftime("%Y-%m-%d") }
|
|
13
|
+
render layout: "conschedule/application"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def new
|
|
17
|
+
config_data
|
|
18
|
+
@schedule = Schedule.new
|
|
19
|
+
render layout: "conschedule/schedules"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create
|
|
23
|
+
config_data
|
|
24
|
+
sst = convert_to_tz(params[:schedule][:slot_start_time],params[:schedule][:user_time_zone])
|
|
25
|
+
set = convert_to_tz(params[:schedule][:slot_end_time],params[:schedule][:user_time_zone])
|
|
26
|
+
schedule_data = {
|
|
27
|
+
app_time_zone: @page_info[:system_time_zone],
|
|
28
|
+
event_name: @page_info[:purpose],
|
|
29
|
+
event_description: @page_info[:instructions],
|
|
30
|
+
location_details: @page_info[:location_details],
|
|
31
|
+
contact_name: Conschedule.contact_name,
|
|
32
|
+
slot_start_time: sst,
|
|
33
|
+
slot_end_time: set
|
|
34
|
+
}
|
|
35
|
+
schedule_data.each do |key,value|
|
|
36
|
+
params[:schedule][key.to_sym] = value
|
|
37
|
+
end
|
|
38
|
+
@schedule = Schedule.create(schedule_params)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def cancel
|
|
42
|
+
@schedule = Schedule.find(params[:id])
|
|
43
|
+
@schedule.update(schedule_params.merge(status: 'cancelled'))
|
|
44
|
+
redirect_to schedules_path
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def config_data
|
|
50
|
+
@page_info = {
|
|
51
|
+
main_heading: Conschedule.main_heading,
|
|
52
|
+
purpose: Conschedule.purpose,
|
|
53
|
+
instructions: Conschedule.instructions,
|
|
54
|
+
location_details: Conschedule.location_details,
|
|
55
|
+
start_date: Conschedule.start_date,
|
|
56
|
+
end_date: Conschedule.end_date,
|
|
57
|
+
original_start_date: Conschedule.start_date,
|
|
58
|
+
original_end_date: Conschedule.end_date,
|
|
59
|
+
available_days: Conschedule.available_days,
|
|
60
|
+
system_time_zone: Conschedule.system_time_zone,
|
|
61
|
+
black_out_dates: Conschedule.black_out_dates,
|
|
62
|
+
sun_timings: Conschedule.sun_timings,
|
|
63
|
+
mon_timings: Conschedule.mon_timings,
|
|
64
|
+
tue_timings: Conschedule.tue_timings,
|
|
65
|
+
wed_timings: Conschedule.wed_timings,
|
|
66
|
+
thu_timings: Conschedule.thu_timings,
|
|
67
|
+
fri_timings: Conschedule.fri_timings,
|
|
68
|
+
sat_timings: Conschedule.sat_timings,
|
|
69
|
+
duration: Conschedule.duration,
|
|
70
|
+
enable_tz: Conschedule.enable_tz
|
|
71
|
+
}
|
|
72
|
+
gon.page_info = @page_info
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def schedule_params
|
|
76
|
+
params.require(:schedule).permit(:app_time_zone, :user_time_zone, :app_tz_offset, :user_tz_offset, :event_name, :event_description, :location_details, :slot_start_time, :slot_end_time, :contact_name, :first_name, :last_name, :phone, :email, :message, :status, :cancel_reason)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def schedules_search
|
|
80
|
+
status = params[:status_ids].blank? ? ["active"] : params[:status_ids]
|
|
81
|
+
current_time = Time.now.in_time_zone(@page_info[:system_time_zone])
|
|
82
|
+
case params[:period]
|
|
83
|
+
when "past"
|
|
84
|
+
schedules = Schedule.past(status,current_time)
|
|
85
|
+
@date_range_label = "All Past"
|
|
86
|
+
@filter_message = "You have no past events"
|
|
87
|
+
@suggestion_message = "past events"
|
|
88
|
+
when "upcoming"
|
|
89
|
+
schedules = Schedule.upcoming(status,current_time)
|
|
90
|
+
@date_range_label = "All Upcoming"
|
|
91
|
+
@filter_message = "You have no upcoming events yet"
|
|
92
|
+
@suggestion_message = "upcoming events"
|
|
93
|
+
when "today"
|
|
94
|
+
schedules = Schedule.range(status,Time.now.beginning_of_day,Time.now.end_of_day)
|
|
95
|
+
@date_range_label = "Today"
|
|
96
|
+
@filter_message = "You have no events for today yet"
|
|
97
|
+
@suggestion_message = "events for today"
|
|
98
|
+
when "this_week", "this_month", "range"
|
|
99
|
+
schedules = Schedule.range(status,params[:start_date],params[:end_date])
|
|
100
|
+
if params[:period] == "range"
|
|
101
|
+
@date_range_label = params[:start_date].to_date.strftime("%b %-d, %Y") + " - " + params[:end_date].to_date.strftime("%b %-d, %Y")
|
|
102
|
+
@filter_message = "You have no events for the date range of #{@date_range_label}"
|
|
103
|
+
@suggestion_message = "events for #{@date_range_label}"
|
|
104
|
+
else
|
|
105
|
+
@date_range_label = params[:period].titleize
|
|
106
|
+
@filter_message = "You have no events for #{params[:period].gsub('_'," ")} yet"
|
|
107
|
+
@suggestion_message = "events for #{params[:period].gsub('_'," ")}"
|
|
108
|
+
end
|
|
109
|
+
else
|
|
110
|
+
schedules = Schedule.upcoming(status,current_time)
|
|
111
|
+
@date_range_label = "All Upcoming"
|
|
112
|
+
@filter_message = "You have no upcoming events yet"
|
|
113
|
+
@suggestion_message = "upcoming events"
|
|
114
|
+
end
|
|
115
|
+
schedules.order("slot_start_time")
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def convert_to_tz(date,tz)
|
|
119
|
+
Time.zone = tz
|
|
120
|
+
ctz = Time.zone.parse(date)
|
|
121
|
+
return ctz
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Conschedule
|
|
2
|
+
module SchedulesHelper
|
|
3
|
+
|
|
4
|
+
def cancel_reason(schedule)
|
|
5
|
+
if schedule.cancel_reason.blank?
|
|
6
|
+
'No reason provided.'
|
|
7
|
+
else
|
|
8
|
+
schedule.cancel_reason
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def slot_start_end_time(schedule,version,start_time=false)
|
|
13
|
+
slot_start_time = schedule.slot_start_time
|
|
14
|
+
slot_end_time = schedule.slot_end_time
|
|
15
|
+
tz = version == "app" ? schedule.app_time_zone : schedule.user_time_zone
|
|
16
|
+
sst = slot_start_time.in_time_zone(tz)
|
|
17
|
+
set = slot_end_time.in_time_zone(tz)
|
|
18
|
+
if start_time
|
|
19
|
+
[fdtime(sst,:time),fdtime(sst,:date)].join(" - ")
|
|
20
|
+
else
|
|
21
|
+
[fdtime(sst,:time),fdtime(set,:time)].join(" - ")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def is_today?(date,tz)
|
|
26
|
+
Time.now.in_time_zone(tz).strftime("%Y-%m-%d") == date.in_time_zone(tz).strftime("%Y-%m-%d")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def page_entries_info(collection, options = {})
|
|
30
|
+
entry_name = options[:entry_name] || collection.entry_name
|
|
31
|
+
entry_name = entry_name.pluralize unless collection.total_count == 1
|
|
32
|
+
|
|
33
|
+
if collection.total_pages < 2
|
|
34
|
+
"Displaying #{collection.total_count} of #{collection.total_count} #{entry_name}"
|
|
35
|
+
else
|
|
36
|
+
first = collection.offset_value + 1
|
|
37
|
+
last = (sum = collection.offset_value + collection.limit_value) > collection.total_count ? collection.total_count : sum
|
|
38
|
+
"Displaying #{first} – #{last} of #{collection.total_count} #{entry_name} "
|
|
39
|
+
end.html_safe
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Conschedule
|
|
2
|
+
class SchedulesMailer < ActionMailer::Base
|
|
3
|
+
default from: Conschedule.from_address
|
|
4
|
+
layout 'conschedule/mailer'
|
|
5
|
+
|
|
6
|
+
def send_cancel_email_user(schedule)
|
|
7
|
+
@schedule = schedule
|
|
8
|
+
@slot_date = schedule.slot_date_time("user","start").strftime("%B %-d, %Y")
|
|
9
|
+
mail(
|
|
10
|
+
to: "#{schedule.full_name} <#{schedule.email}>",
|
|
11
|
+
subject: "Canceled: #{schedule.event_name} with #{Conschedule.contact_name} on #{@slot_date}"
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def send_cancel_email_owner(schedule)
|
|
16
|
+
@schedule = schedule
|
|
17
|
+
@slot_date = schedule.slot_date_time("app","start").strftime("%B %-d, %Y")
|
|
18
|
+
@slot_start_time = schedule.slot_date_time("app","start")
|
|
19
|
+
mail(
|
|
20
|
+
to: Conschedule.to_address,
|
|
21
|
+
subject: "Canceled: #{schedule.event_name} with #{schedule.full_name} on #{@slot_date}"
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def send_confirmation_email_owner(schedule)
|
|
26
|
+
@schedule = schedule
|
|
27
|
+
@slot_date = schedule.slot_date_time("app","start").strftime("%B %-d, %Y")
|
|
28
|
+
@slot_start_time = schedule.slot_date_time("app","start")
|
|
29
|
+
mail(
|
|
30
|
+
to: Conschedule.to_address,
|
|
31
|
+
subject: "New Event: #{schedule.event_name} with #{schedule.full_name} on #{@slot_date}"
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def send_confirmation_email_user(schedule)
|
|
36
|
+
@schedule = schedule
|
|
37
|
+
@slot_date = schedule.slot_date_time("user","start").strftime("%B %-d, %Y")
|
|
38
|
+
mail(
|
|
39
|
+
to: "#{schedule.full_name} <#{schedule.email}>",
|
|
40
|
+
subject: "Confirmed: #{schedule.event_name} with #{Conschedule.contact_name} on #{@slot_date}"
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module Conschedule
|
|
2
|
+
class Schedule < ApplicationRecord
|
|
3
|
+
|
|
4
|
+
validates :app_time_zone, :user_time_zone, :app_tz_offset, :user_tz_offset, :slot_start_time, :slot_end_time, :first_name, :phone, :email, presence: true
|
|
5
|
+
|
|
6
|
+
scope :past, -> (status,time) { where("status IN (?) AND slot_start_time < ?",status,time) }
|
|
7
|
+
scope :upcoming, -> (status,time) { where("status IN (?) AND slot_start_time >= ?",status,time) }
|
|
8
|
+
scope :range, -> (status,start_time,end_time) { where("status IN (?) AND (slot_start_time >= ? AND slot_start_time <= ?)",status,start_time,end_time) }
|
|
9
|
+
|
|
10
|
+
after_create :send_confirmation_email
|
|
11
|
+
after_update :send_cancel_email
|
|
12
|
+
|
|
13
|
+
def full_name
|
|
14
|
+
[first_name,last_name].compact.join(" ")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def send_confirmation_email
|
|
18
|
+
SchedulesMailer.send_confirmation_email_user(self).deliver
|
|
19
|
+
if Conschedule.send_confirmation_mail && validate_to_address
|
|
20
|
+
SchedulesMailer.send_confirmation_email_owner(self).deliver
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def send_cancel_email
|
|
25
|
+
if status_changed?
|
|
26
|
+
SchedulesMailer.send_cancel_email_user(self).deliver
|
|
27
|
+
end
|
|
28
|
+
if Conschedule.send_cancel_mail && validate_to_address
|
|
29
|
+
SchedulesMailer.send_cancel_email_owner(self).deliver
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def status_changed?
|
|
34
|
+
changed_attributes.has_key?("status") && changed_attributes["status"] == "active"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def validate_to_address
|
|
38
|
+
return false if Conschedule.to_address.downcase =~ /please-change-me/
|
|
39
|
+
return true
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def cancelled?
|
|
43
|
+
status == "cancelled"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def display_action?
|
|
47
|
+
if status == "cancelled"
|
|
48
|
+
return false
|
|
49
|
+
else
|
|
50
|
+
slot_start_time = self.slot_date_time("app","start")
|
|
51
|
+
current_time = Time.now.in_time_zone(app_time_zone)
|
|
52
|
+
return current_time > slot_start_time ? false : true
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def slot_date_time(version,period)
|
|
57
|
+
tz = version == "app" ? app_time_zone : user_time_zone
|
|
58
|
+
period == "start" ? slot_start_time.in_time_zone(tz) : slot_end_time.in_time_zone(tz)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div id="main-region">
|
|
2
|
+
<div>
|
|
3
|
+
<div class="header">
|
|
4
|
+
<h2 class="pts">Confirmed</h2>
|
|
5
|
+
<div class="mbs phl">
|
|
6
|
+
You are scheduled with <%= @schedule.contact_name %>.
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="wrapper narrower">
|
|
10
|
+
<hr class="dotted mbm">
|
|
11
|
+
<div class="mbs row">
|
|
12
|
+
<div class="marker" style="background-color: #fff200"></div>
|
|
13
|
+
<div class="last-col">
|
|
14
|
+
<h2><%= @schedule.event_name %></h2>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="iconed-text emphasis">
|
|
18
|
+
<i class="icon-clock"></i> <%= slot_start_end_time(@schedule,"user",true) %>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="iconed-text">
|
|
21
|
+
<i class="icon-globe"></i><%= @schedule.user_time_zone %>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="iconed-text">
|
|
24
|
+
<i class="icon-description"></i>
|
|
25
|
+
<div class="last-col">
|
|
26
|
+
<%= @schedule.event_description %>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="iconed-text">
|
|
30
|
+
<i class="icon-location-target"></i>
|
|
31
|
+
<div class="last-col">
|
|
32
|
+
<%= @schedule.location_details %>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<hr class="dotted mbl">
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<div id="main-region">
|
|
2
|
+
<div class="date-time-step">
|
|
3
|
+
<div class="header">
|
|
4
|
+
<div class="js-profile-region">
|
|
5
|
+
<div class="wrapper">
|
|
6
|
+
<div class="label">
|
|
7
|
+
<%= @page_info[:main_heading] %>
|
|
8
|
+
<div class="js-popover-region"></div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="subheader">
|
|
14
|
+
<div class="wrapper row">
|
|
15
|
+
<div class="col1of2">
|
|
16
|
+
<% unless @page_info[:purpose].blank? %>
|
|
17
|
+
<div class="marker" style="background-color: #fff200"></div>
|
|
18
|
+
<div class="last-col">
|
|
19
|
+
<h3><%= @page_info[:purpose] %></h3>
|
|
20
|
+
</div>
|
|
21
|
+
<% else %>
|
|
22
|
+
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="col1of2">
|
|
26
|
+
<div class="timezone-area">
|
|
27
|
+
<span class="muted">Times are in</span>
|
|
28
|
+
<div class="timezone">
|
|
29
|
+
<%= f.select :user_time_zone, "", {}, {class: "chzn js-timezone-dropdown chzn-done", id: "timezonesdropdown", style: "display: none;"} %>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="wrapper">
|
|
36
|
+
<div class="iconed-text muted">
|
|
37
|
+
<% unless @page_info[:instructions].blank? %>
|
|
38
|
+
<i class="icon-description"></i>
|
|
39
|
+
<div class="last-col">
|
|
40
|
+
<%= @page_info[:instructions] %>
|
|
41
|
+
</div>
|
|
42
|
+
<% end %>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="iconed-text muted">
|
|
45
|
+
<% unless @page_info[:location_details].blank? %>
|
|
46
|
+
<i class="icon-location-target"></i>
|
|
47
|
+
<div class="last-col">
|
|
48
|
+
<%= @page_info[:location_details] %>
|
|
49
|
+
</div>
|
|
50
|
+
<% end %>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="js-days-region mvl">
|
|
53
|
+
<div class="week-view">
|
|
54
|
+
<h2 class="text-center mbl">Select a Day</h2>
|
|
55
|
+
<div class="js-days-region">
|
|
56
|
+
<div class="period row"><span class="icon-angle-left js-navigation-prev"></span>
|
|
57
|
+
<span class="icon-angle-right js-navigation-next"></span>
|
|
58
|
+
<div class="js-days-body">
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="spinner js-spinner hidden">
|
|
63
|
+
<div class="bounce1"></div>
|
|
64
|
+
<div class="bounce2"></div>
|
|
65
|
+
<div class="bounce3"></div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="js-weeks-region">
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div style="display: block;" class="pagination row js-pagination-bar mbl">
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|