Implements "Add template" button for email settings
close #16 Subjects now mandatory if send mail enabled
This commit is contained in:
parent
7192e2fe49
commit
6f3426b6a2
10 changed files with 275 additions and 111 deletions
|
|
@ -1,5 +1,51 @@
|
||||||
$(function() {
|
$(function () {
|
||||||
/**
|
/**
|
||||||
|
* Toggles email template help below email body textarea field.
|
||||||
|
*/
|
||||||
|
$(document).ready( function() {
|
||||||
|
$(".template-help").hide();
|
||||||
|
$(".template_help_link").click(function() {
|
||||||
|
var id = $(this).data('name');
|
||||||
|
$("#" + id).toggle();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the default template as value to the regarding email textarea field.
|
||||||
|
*/
|
||||||
|
$(".load_template").on('click', function () {
|
||||||
|
var template = $(this).data('template');
|
||||||
|
var textarea_name = $(this).data('name');
|
||||||
|
$('#' + textarea_name).val(template);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the required attribute on click on_send_email radio button.
|
||||||
|
*/
|
||||||
|
$('.send_on_radio').click(function () {
|
||||||
|
toggle_required_for_mail_subjects($(this))
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds required attribute to on_send_email radio button if necessary.
|
||||||
|
*/
|
||||||
|
$('.send_on_radio').each(function () {
|
||||||
|
toggle_required_for_mail_subjects($(this))
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Toggle the required attribute helper function.
|
||||||
|
*/
|
||||||
|
function toggle_required_for_mail_subjects($this) {
|
||||||
|
var name = $this.data('name');
|
||||||
|
if ($this.is(':checked')) {
|
||||||
|
$('#' + name).prop('required', true);
|
||||||
|
} else {
|
||||||
|
$('#' + name).removeAttr('required');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
/**
|
||||||
* Opens a prompt with the URL to copy to clipboard.
|
* Opens a prompt with the URL to copy to clipboard.
|
||||||
* Used in the campaign index view.
|
* Used in the campaign index view.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,18 @@ class Admin::ConferenceController < ApplicationController
|
||||||
short_title = @conference.short_title
|
short_title = @conference.short_title
|
||||||
@conference.assign_attributes(params[:conference])
|
@conference.assign_attributes(params[:conference])
|
||||||
if @conference.start_date_changed? || @conference.end_date_changed?
|
if @conference.start_date_changed? || @conference.end_date_changed?
|
||||||
if @conference.email_settings.send_on_updated_conference_dates
|
if @conference.email_settings.send_on_updated_conference_dates &&
|
||||||
Mailbot.conference_date_update_mail(@conference,date_string(@conference.start_date, @conference.end_date)).deliver
|
!@conference.email_settings.updated_conference_dates_subject.blank? &&
|
||||||
|
@conference.email_settings.updated_conference_dates_template
|
||||||
|
Mailbot.conference_date_update_mail(@conference).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @conference.registration_start_date_changed? || @conference.registration_end_date_changed?
|
if @conference.registration_start_date_changed? || @conference.registration_end_date_changed?
|
||||||
if @conference.email_settings.send_on_updated_conference_registration_dates
|
if @conference.email_settings.send_on_updated_conference_registration_dates &&
|
||||||
Mailbot.conference_registration_date_update_mail(@conference,date_string(@conference.registration_start_date, @conference.registration_end_date)).deliver
|
!@conference.email_settings.updated_conference_registration_dates_subject.blank? &&
|
||||||
|
@conference.email_settings.updated_conference_registration_dates_template
|
||||||
|
Mailbot.conference_registration_date_update_mail(@conference).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ module Admin
|
||||||
class EventsController < ApplicationController
|
class EventsController < ApplicationController
|
||||||
before_filter :verify_organizer
|
before_filter :verify_organizer
|
||||||
|
|
||||||
|
before_action :get_event, except: [:index, :create]
|
||||||
|
|
||||||
# FIXME: The timezome should only be applied on output, otherwise
|
# FIXME: The timezome should only be applied on output, otherwise
|
||||||
# you get lost in timezone conversions...
|
# you get lost in timezone conversions...
|
||||||
# around_filter :set_timezone_for_this_request
|
# around_filter :set_timezone_for_this_request
|
||||||
|
|
@ -71,7 +73,6 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@event = @conference.events.find(params[:id])
|
|
||||||
@tracks = @conference.tracks
|
@tracks = @conference.tracks
|
||||||
@event_types = @conference.event_types
|
@event_types = @conference.event_types
|
||||||
@comments = @event.root_comments
|
@comments = @event.root_comments
|
||||||
|
|
@ -81,7 +82,6 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@event = @conference.events.find(params[:id])
|
|
||||||
@event_types = @conference.event_types
|
@event_types = @conference.event_types
|
||||||
@tracks = Track.all
|
@tracks = Track.all
|
||||||
@comments = @event.root_comments
|
@comments = @event.root_comments
|
||||||
|
|
@ -91,8 +91,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def comment
|
def comment
|
||||||
event = @conference.events.find_by_id(params[:id])
|
comment = Comment.build_from(@event, current_user.id, params[:comment])
|
||||||
comment = Comment.build_from(event, current_user.id, params[:comment])
|
|
||||||
comment.save!
|
comment.save!
|
||||||
if !params[:parent].nil?
|
if !params[:parent].nil?
|
||||||
comment.move_to_child_of(params[:parent])
|
comment.move_to_child_of(params[:parent])
|
||||||
|
|
@ -102,7 +101,6 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@event = Event.find(params[:id])
|
|
||||||
if params.has_key? :track_id
|
if params.has_key? :track_id
|
||||||
@event.update_attribute(:track_id, params[:track_id])
|
@event.update_attribute(:track_id, params[:track_id])
|
||||||
end
|
end
|
||||||
|
|
@ -127,27 +125,30 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def accept
|
def accept
|
||||||
update_state(params[:id], :accept, 'Event accepted!', true)
|
send_mail = @event.conference.email_settings.send_on_accepted
|
||||||
|
subject = @event.conference.email_settings.accepted_subject.blank?
|
||||||
|
update_state(:accept, 'Event accepted!', true, subject, send_mail)
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm
|
def confirm
|
||||||
update_state(params[:id], :confirm, 'Event confirmed!')
|
update_state(:confirm, 'Event confirmed!')
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel
|
def cancel
|
||||||
update_state(params[:id], :cancel, 'Event canceled!')
|
update_state(:cancel, 'Event canceled!')
|
||||||
end
|
end
|
||||||
|
|
||||||
def reject
|
def reject
|
||||||
update_state(params[:id], :reject, 'Event rejected!', true)
|
send_mail = @event.conference.email_settings.send_on_rejected
|
||||||
|
subject = @event.conference.email_settings.rejected_subject.blank?
|
||||||
|
update_state(:reject, 'Event rejected!', true, subject, send_mail)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restart
|
def restart
|
||||||
update_state(params[:id], :restart, 'Review started!')
|
update_state(:restart, 'Review started!')
|
||||||
end
|
end
|
||||||
|
|
||||||
def vote
|
def vote
|
||||||
@event = Event.find(params[:id])
|
|
||||||
@ratings = @event.votes.includes(:user)
|
@ratings = @event.votes.includes(:user)
|
||||||
|
|
||||||
if (votes = current_user.votes.find_by_event_id(params[:id]))
|
if (votes = current_user.votes.find_by_event_id(params[:id]))
|
||||||
|
|
@ -167,31 +168,25 @@ module Admin
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def update_state(id, transition, notice, mail = false)
|
def get_event
|
||||||
event = Event.find(id)
|
@event = @conference.events.find_by_id(params[:id])
|
||||||
if mail && params[:send_mail].blank? && event &&
|
if !@event
|
||||||
(event.conference.email_settings.rejected_email_template.nil? ||
|
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
event.conference.email_settings.accepted_email_template.nil?)
|
alert: 'Error! Could not find event!') && return
|
||||||
return redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
|
||||||
notice: 'Update Email Template before Sending Mails') && return
|
|
||||||
end
|
end
|
||||||
if event
|
@event
|
||||||
begin
|
end
|
||||||
if mail
|
|
||||||
event.send(transition,
|
def update_state(transition, notice, mail = false, subject = false, send_mail = false)
|
||||||
send_mail: params[:send_mail])
|
alert = @event.update_state(transition, mail, subject, send_mail, params[:send_mail].blank?)
|
||||||
else
|
|
||||||
event.send(transition)
|
if !alert.blank?
|
||||||
end
|
return redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
event.save
|
alert: alert) && return
|
||||||
rescue Transitions::InvalidTransition => e
|
|
||||||
notice = "Update state failed. #{e.message}"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
notice = 'Error! Could not find event!'
|
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
||||||
|
notice: notice) && return
|
||||||
end
|
end
|
||||||
redirect_to(admin_conference_events_path(conference_id: @conference.short_title),
|
|
||||||
notice: notice) && return
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@ class Admin::VenueController < ApplicationController
|
||||||
@venue = @conference.venue
|
@venue = @conference.venue
|
||||||
@venue.assign_attributes(params[:venue])
|
@venue.assign_attributes(params[:venue])
|
||||||
unless @venue.name.blank? || @venue.address.blank? || @conference.registrations.blank?
|
unless @venue.name.blank? || @venue.address.blank? || @conference.registrations.blank?
|
||||||
if @venue.name_changed? || @venue.address_changed? && @conference.email_settings.send_on_venue_update
|
if (@venue.name_changed? ||
|
||||||
|
@venue.address_changed?) &&
|
||||||
|
(@conference.email_settings.send_on_venue_update &&
|
||||||
|
!@conference.email_settings.venue_update_subject.blank? &&
|
||||||
|
@conference.email_settings.venue_update_template)
|
||||||
venue_notify = Mailbot.send_email_on_venue_update(@conference)
|
venue_notify = Mailbot.send_email_on_venue_update(@conference)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,30 +36,30 @@ class Mailbot < ActionMailer::Base
|
||||||
conference.email_settings.confirmed_but_not_registered_email(event))
|
conference.email_settings.confirmed_but_not_registered_email(event))
|
||||||
end
|
end
|
||||||
|
|
||||||
def conference_date_update_mail(conference,dates)
|
def conference_date_update_mail(conference)
|
||||||
subject = conference.email_settings.updated_conference_dates_subject.blank? ? "#{conference.title} Dates Updated" : conference.email_settings.updated_conference_dates_subject
|
conference.registrations.each do |user|
|
||||||
partial = "#{conference.title}\n New Dates : #{dates}\n For more information visit #{Rails.application.routes.url_helpers.conference_path(conference.short_title, host: CONFIG['url_for_emails'])}"
|
build_email(conference,
|
||||||
body = conference.email_settings.updated_conference_dates_template.blank? ? "#{partial}" : "#{conference.email_settings.updated_conference_dates_template}\n #{partial}"
|
user.user.email,
|
||||||
conference.registrations.each do |u|
|
conference.email_settings.updated_conference_dates_subject,
|
||||||
build_email(conference, u.user.email, subject, body)
|
conference.email_settings.generate_conference_date_update_mail(conference, user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def conference_registration_date_update_mail(conference, dates)
|
def conference_registration_date_update_mail(conference)
|
||||||
subject = conference.email_settings.updated_conference_registration_dates_subject.blank? ? "#{conference.title} Registration Dates Updated" : conference.email_settings.updated_conference_registration_dates_subject
|
conference.registrations.each do |user|
|
||||||
partial = "#{conference.title}\n New Registration Dates : #{dates}\n For more information visit #{Rails.application.routes.url_helpers.conference_path(conference.short_title, host: CONFIG['url_for_emails'])}"
|
build_email(conference,
|
||||||
body = conference.email_settings.updated_conference_registration_dates_template.blank? ? "#{partial}" : "#{conference.email_settings.updated_conference_dates_template}\n #{partial}"
|
user.user.email,
|
||||||
conference.registrations.each do |u|
|
conference.email_settings.updated_conference_registration_dates_subject,
|
||||||
build_email(conference, u.user.email, subject, body)
|
conference.email_settings.generate_conference_registration_date_update_mail(conference, user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_email_on_venue_update(conference)
|
def send_email_on_venue_update(conference)
|
||||||
subject = conference.email_settings.venue_update_subject.blank? ? "#{conference.title} location has been changed" : conference.email_settings.venue_update_subject
|
conference.registrations.each do |user|
|
||||||
partial = "#{conference.title} new location is: #{conference.venue.name}.\n Address: #{conference.venue.address}\n. For more information please visit #{Rails.application.routes.url_helpers.conference_path(conference.short_title, host: CONFIG['url_for_emails'])}"
|
build_email(conference,
|
||||||
body = conference.email_settings.venue_update_template.blank? ? partial : "#{conference.email_settings.venue_update_template}\n #{partial}"
|
user.email,
|
||||||
conference.registrations.each do |u|
|
conference.email_settings.venue_update_subject,
|
||||||
build_email(conference, u.email, subject, body)
|
conference.email_settings.generate_send_email_on_venue_update(conference, user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,12 @@ class EmailSettings < ActiveRecord::Base
|
||||||
'email' => user.email,
|
'email' => user.email,
|
||||||
'name' => user.name,
|
'name' => user.name,
|
||||||
'conference' => conference.title,
|
'conference' => conference.title,
|
||||||
|
'conference_start_date' => conference.start_date,
|
||||||
|
'conference_end_date' => conference.end_date,
|
||||||
|
'registration_start_date' => conference.registration_start_date,
|
||||||
|
'registration_end_date' => conference.registration_end_date,
|
||||||
|
'venue' => conference.venue.name,
|
||||||
|
'venue_adress' => conference.venue.address,
|
||||||
'registrationlink' => Rails.application.routes.url_helpers.register_conference_url(
|
'registrationlink' => Rails.application.routes.url_helpers.register_conference_url(
|
||||||
conference.short_title, host: CONFIG['url_for_emails'])
|
conference.short_title, host: CONFIG['url_for_emails'])
|
||||||
}
|
}
|
||||||
|
|
@ -50,9 +56,31 @@ class EmailSettings < ActiveRecord::Base
|
||||||
parse_template(template, values)
|
parse_template(template, values)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_conference_date_update_mail(conference, user)
|
||||||
|
values = get_values(conference, user)
|
||||||
|
template = updated_conference_dates_template
|
||||||
|
parse_template(template, values)
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_conference_registration_date_update_mail(conference, user)
|
||||||
|
values = get_values(conference, user)
|
||||||
|
template = updated_conference_registration_dates_template
|
||||||
|
parse_template(template, values)
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_send_email_on_venue_update(conference, user)
|
||||||
|
values = get_values(conference, user)
|
||||||
|
template = venue_update_template
|
||||||
|
parse_template(template, values)
|
||||||
|
end
|
||||||
|
|
||||||
def parse_template(text, values)
|
def parse_template(text, values)
|
||||||
values.each do |key, value|
|
values.each do |key, value|
|
||||||
text = text.gsub "{#{key}}", value unless text.blank?
|
if value.kind_of?(Date)
|
||||||
|
text = text.gsub "{#{key}}", value.strftime('%Y-%m-%d') unless text.blank?
|
||||||
|
else
|
||||||
|
text = text.gsub "{#{key}}", value unless text.blank? || value.blank?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
text
|
text
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ class Event < ActiveRecord::Base
|
||||||
if conference.email_settings.send_on_accepted &&
|
if conference.email_settings.send_on_accepted &&
|
||||||
conference.email_settings.accepted_email_template &&
|
conference.email_settings.accepted_email_template &&
|
||||||
conference.email_settings.accepted_subject &&
|
conference.email_settings.accepted_subject &&
|
||||||
options[:send_mail].blank?
|
!options[:send_mail].blank?
|
||||||
Rails.logger.debug 'Sending event acceptance mail'
|
Rails.logger.debug 'Sending event acceptance mail'
|
||||||
Mailbot.acceptance_mail(self).deliver
|
Mailbot.acceptance_mail(self).deliver
|
||||||
end
|
end
|
||||||
|
|
@ -148,7 +148,7 @@ class Event < ActiveRecord::Base
|
||||||
if conference.email_settings.send_on_rejected &&
|
if conference.email_settings.send_on_rejected &&
|
||||||
conference.email_settings.rejected_email_template &&
|
conference.email_settings.rejected_email_template &&
|
||||||
conference.email_settings.rejected_subject &&
|
conference.email_settings.rejected_subject &&
|
||||||
options[:send_mail].blank?
|
!options[:send_mail].blank?
|
||||||
Rails.logger.debug 'Sending rejected mail'
|
Rails.logger.debug 'Sending rejected mail'
|
||||||
Mailbot.rejection_mail(self).deliver
|
Mailbot.rejection_mail(self).deliver
|
||||||
end
|
end
|
||||||
|
|
@ -186,6 +186,25 @@ class Event < ActiveRecord::Base
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_state(transition, mail = false, subject = false, send_mail = false, send_mail_param)
|
||||||
|
alert = ''
|
||||||
|
if mail && send_mail_param && subject && send_mail
|
||||||
|
alert = 'Update Email Subject before Sending Mails'
|
||||||
|
end
|
||||||
|
begin
|
||||||
|
if mail
|
||||||
|
self.send(transition,
|
||||||
|
send_mail: send_mail_param)
|
||||||
|
else
|
||||||
|
self.send(transition)
|
||||||
|
end
|
||||||
|
self.save
|
||||||
|
rescue Transitions::InvalidTransition => e
|
||||||
|
alert = "Update state failed. #{e.message}"
|
||||||
|
end
|
||||||
|
alert
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def abstract_limit
|
def abstract_limit
|
||||||
|
|
|
||||||
39
app/views/admin/emails/_help.html.haml
Normal file
39
app/views/admin/emails/_help.html.haml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
.template-help{:id => id}
|
||||||
|
Valid attributes:
|
||||||
|
%table.table
|
||||||
|
%tr
|
||||||
|
%td {email}
|
||||||
|
%td The user's email address
|
||||||
|
%tr
|
||||||
|
%td {name}
|
||||||
|
%td The user's full name
|
||||||
|
%tr
|
||||||
|
%td {conference}
|
||||||
|
%td The full conference title
|
||||||
|
%tr
|
||||||
|
%td {proposalslink}
|
||||||
|
%td A link to the user's proposal page
|
||||||
|
%tr
|
||||||
|
%td {registrationlink}
|
||||||
|
%td A link to the registration page
|
||||||
|
%tr
|
||||||
|
%td {eventtitle}
|
||||||
|
%td The title of an accepted or rejected proposal
|
||||||
|
%tr
|
||||||
|
%td {conference_start_date}
|
||||||
|
%td The start date of the conference
|
||||||
|
%tr
|
||||||
|
%td {conference_end_date}
|
||||||
|
%td The end date of the conference
|
||||||
|
%tr
|
||||||
|
%td {registration_start_date}
|
||||||
|
%td The start date of the registration period
|
||||||
|
%tr
|
||||||
|
%td {registration_end_date}
|
||||||
|
%td The end date of the registration period
|
||||||
|
%tr
|
||||||
|
%td {venue}
|
||||||
|
%td The name of the venue
|
||||||
|
%tr
|
||||||
|
%td {venue_adress}
|
||||||
|
%td The adress of the venue
|
||||||
|
|
@ -1,55 +1,57 @@
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
= link_to "Template Help", "#", :id => "template-help-link"
|
|
||||||
#template-help
|
|
||||||
Valid attributes:
|
|
||||||
%table.table
|
|
||||||
%tr
|
|
||||||
%td {email}
|
|
||||||
%td The user's email address
|
|
||||||
%tr
|
|
||||||
%td {name}
|
|
||||||
%td The user's full name
|
|
||||||
%tr
|
|
||||||
%td {conference}
|
|
||||||
%td The full conference title
|
|
||||||
%tr
|
|
||||||
%td {proposalslink}
|
|
||||||
%td A link to the user's proposal page
|
|
||||||
%tr
|
|
||||||
%td {registrationlink}
|
|
||||||
%td A link to the registration page
|
|
||||||
%tr
|
|
||||||
%td {eventtitle}
|
|
||||||
%td The title of an accepted or rejected proposal
|
|
||||||
= semantic_form_for(@settings, :url => admin_conference_email_path(@conference.short_title, @conference.email_settings),:html => {:multipart => true}) do |f|
|
= semantic_form_for(@settings, :url => admin_conference_email_path(@conference.short_title, @conference.email_settings),:html => {:multipart => true}) do |f|
|
||||||
= f.input :send_on_registration, :label => false, :hint => "Send an email when the user registers for the conference?"
|
.row
|
||||||
= f.input :registration_subject
|
.col-md-12
|
||||||
= f.input :registration_email_template, :input_html => { :rows => 10, :cols => 20}
|
= f.input :send_on_registration, label: "Send an email when the user registers for the conference?", :input_html => {"data-name"=>"email_settings_registration_subject", "class"=>"send_on_radio"}
|
||||||
= f.input :send_on_accepted, :label => false, :hint => "Send an email when the proposal is accepted?"
|
= f.input :registration_subject
|
||||||
= f.input :accepted_subject
|
= f.input :registration_email_template, :input_html => { :rows => 10, :cols => 20}
|
||||||
= f.input :accepted_email_template, :input_html => { :rows => 10, :cols => 20 }
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThank you for Registering for the conference {conference}.\nPlease complete your registration by filling out your travel information.\n\nIf you are unable to attend please unregister online:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\nWe look forward to see you there.\n\nBest wishes\n\n{conference} Team",
|
||||||
= f.input :send_on_rejected, :label => false, :hint => "Send an email when the proposal is rejected?"
|
"data-name"=>"email_settings_registration_email_template"} Load Template
|
||||||
= f.input :rejected_subject
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"registration_help"} Show Help
|
||||||
= f.input :rejected_email_template, :input_html => { :rows => 10, :cols => 20 }
|
= render partial: 'help', locals: {id: 'registration_help'}
|
||||||
= f.input :send_on_confirmed_without_registration, :label => false, :hint => "Send an email when a user has a confirmed proposal, but isn't yet registered?"
|
= f.input :send_on_accepted, label: "Send an email when the proposal is accepted?", :input_html => {"data-name"=>"email_settings_accepted_subject", "class"=>"send_on_radio"}
|
||||||
= f.input :confirmed_without_registration_subject
|
= f.input :accepted_subject
|
||||||
= f.input :confirmed_email_template, :input_html => { :rows => 10, :cols => 20 }
|
= f.input :accepted_email_template, :input_html => { :rows => 10, :cols => 20 }
|
||||||
= f.input :send_on_updated_conference_dates, hint: "This is to notify all participants that the conference dates has been changed."
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name}\n\nWe are very pleased to inform you that your submission {eventtitle} has been accepted for the conference {conference}.\n\nThe public page of your submission can be found at:\n{proposalslink}\nIf you haven´t already registered for {conference}, please do as soon as possible:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||||
= f.input :updated_conference_dates_subject
|
"data-name"=>"email_settings_accepted_email_template"} Load Template
|
||||||
= f.input :updated_conference_dates_template, :input_html => { :rows => 10, :cols => 20 }
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"accepted_help"} Show Help
|
||||||
= f.input :send_on_updated_conference_registration_dates, hint: "This is to notify all participants that the conference registration dates has been changed."
|
= render partial: 'help', locals: {id: 'accepted_help'}
|
||||||
= f.input :updated_conference_registration_dates_subject
|
= f.input :send_on_rejected, label: "Send an email when the proposal is rejected?", :input_html => {"data-name"=>"email_settings_rejected_subject", "class"=>"send_on_radio"}
|
||||||
= f.input :updated_conference_registration_dates_template, :input_html => { :rows => 10, :cols => 20 }
|
= f.input :rejected_subject
|
||||||
= f.input :send_on_venue_update, hint: 'Send an email on updating the Venue.'
|
= f.input :rejected_email_template, :input_html => { :rows => 10, :cols => 20 }
|
||||||
= f.input :venue_update_subject
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThank you for your submission {eventtitle} for the conference {conference}.\nAfter careful consideration we are sorry to inform you that your submissionhas been rejected.\n\n\nBest wishes\n\n{conference} Team",
|
||||||
= f.input :venue_update_template, :input_html => { :rows => 10, :cols => 20 }
|
"data-name"=>"email_settings_rejected_email_template"} Load Template
|
||||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"rejected_help"} Show Help
|
||||||
|
= render partial: 'help', locals: {id: 'rejected_help'}
|
||||||
:javascript
|
= f.input :send_on_confirmed_without_registration, label: "Send an email when a user has a confirmed proposal, but isn't yet registered?", :input_html => {"data-name"=>"email_settings_confirmed_without_registration_subject", "class"=>"send_on_radio"}
|
||||||
$(document).ready( function() {
|
= f.input :confirmed_without_registration_subject
|
||||||
$("#template-help").hide();
|
= f.input :confirmed_email_template, :input_html => { :rows => 10, :cols => 20 }
|
||||||
$("#template-help-link").click(function() {
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThank you for the confirmation of {eventtitle}. Unfortunately you are not registered for the conference {conference}. Please register as soon as possible:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||||
$("#template-help").toggle();
|
"data-name"=>"email_settings_confirmed_email_template"} Load Template
|
||||||
});
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"confirmed_help"} Show Help
|
||||||
});
|
= render partial: 'help', locals: {id: 'confirmed_help'}
|
||||||
|
= f.input :send_on_updated_conference_dates, label: "This is to notify all participants that the conference dates has been changed.", :input_html => {"data-name"=>"email_settings_updated_conference_dates_subject", "class"=>"send_on_radio"}
|
||||||
|
= f.input :updated_conference_dates_subject
|
||||||
|
= f.input :updated_conference_dates_template, :input_html => { :rows => 10, :cols => 20 }
|
||||||
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe date of {conference} has changed.\n New Dates : {conference_start_date} - {conference_end_date}.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||||
|
"data-name"=>"email_settings_updated_conference_dates_template"} Load Template
|
||||||
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_dates_help"} Show Help
|
||||||
|
= render partial: 'help', locals: {id: 'updated_dates_help'}
|
||||||
|
= f.input :send_on_updated_conference_registration_dates, label: "This is to notify all participants that the conference registration dates has been changed.", :input_html => {"data-name"=>"email_settings_updated_conference_registration_dates_subject", "class"=>"send_on_radio"}
|
||||||
|
= f.input :updated_conference_registration_dates_subject
|
||||||
|
= f.input :updated_conference_registration_dates_template, :input_html => { :rows => 10, :cols => 20 }
|
||||||
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe registration date of {conference} has changed.\n New Dates : {registration_start_date} - {registration_end_date}.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||||
|
"data-name"=>"email_settings_updated_conference_registration_dates_template"} Load Template
|
||||||
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_registrations_dates_help"} Show Help
|
||||||
|
= render partial: 'help', locals: {id: 'updated_registrations_dates_help'}
|
||||||
|
= f.input :send_on_venue_update, label: 'Send an email on updating the Venue.', :input_html => {"data-name"=>"email_settings_venue_update_subject", "class"=>"send_on_radio"}
|
||||||
|
= f.input :venue_update_subject
|
||||||
|
= f.input :venue_update_template, :input_html => { :rows => 10, :cols => 20 }
|
||||||
|
%a.btn.btn-link.control_label.load_template{"data-template"=>"Dear {name},\n\nThe Conference venue of {conference} has changed. New location is: {venue}.\n Address: {venue_address}.\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team",
|
||||||
|
"data-name"=>"email_settings_venue_update_template"} Load Template
|
||||||
|
%a.btn.btn-link.control_label.template_help_link{"data-name"=>"updated_venue_help"} Show Help
|
||||||
|
= render partial: 'help', locals: {id: 'updated_venue_help'}
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,21 @@ feature Event do
|
||||||
fill_in 'email_settings_confirmed_email_template',
|
fill_in 'email_settings_confirmed_email_template',
|
||||||
with: 'Confirmed without registration email body'
|
with: 'Confirmed without registration email body'
|
||||||
|
|
||||||
|
fill_in 'email_settings_updated_conference_dates_subject',
|
||||||
|
with: 'Updated conference dates subject'
|
||||||
|
fill_in 'email_settings_updated_conference_dates_template',
|
||||||
|
with: 'Updated conference dates email template'
|
||||||
|
|
||||||
|
fill_in 'email_settings_updated_conference_registration_dates_subject',
|
||||||
|
with: 'Updated conference registration dates subject'
|
||||||
|
fill_in 'email_settings_updated_conference_registration_dates_template',
|
||||||
|
with: 'Updated conference registration dates template'
|
||||||
|
|
||||||
|
fill_in 'email_settings_venue_update_subject',
|
||||||
|
with: 'Updated conference venue subject'
|
||||||
|
fill_in 'email_settings_venue_update_template',
|
||||||
|
with: 'Updated conference venue template'
|
||||||
|
|
||||||
click_button 'Update Email settings'
|
click_button 'Update Email settings'
|
||||||
|
|
||||||
expect(flash).
|
expect(flash).
|
||||||
|
|
@ -58,6 +73,18 @@ feature Event do
|
||||||
value).to eq('Confirmed without registration subject')
|
value).to eq('Confirmed without registration subject')
|
||||||
expect(find('#email_settings_confirmed_email_template').
|
expect(find('#email_settings_confirmed_email_template').
|
||||||
value).to eq('Confirmed without registration email body')
|
value).to eq('Confirmed without registration email body')
|
||||||
|
expect(find('#email_settings_updated_conference_dates_subject').
|
||||||
|
value).to eq('Updated conference dates subject')
|
||||||
|
expect(find('#email_settings_updated_conference_dates_template').
|
||||||
|
value).to eq('Updated conference dates email template')
|
||||||
|
expect(find('#email_settings_updated_conference_registration_dates_subject').
|
||||||
|
value).to eq('Updated conference registration dates subject')
|
||||||
|
expect(find('#email_settings_updated_conference_registration_dates_template').
|
||||||
|
value).to eq('Updated conference registration dates template')
|
||||||
|
expect(find('#email_settings_venue_update_subject').
|
||||||
|
value).to eq('Updated conference venue subject')
|
||||||
|
expect(find('#email_settings_venue_update_template').
|
||||||
|
value).to eq('Updated conference venue template')
|
||||||
|
|
||||||
expect(EmailSettings.count).to eq(expected_count)
|
expect(EmailSettings.count).to eq(expected_count)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue