From 7f6e21829963f83fc5a8927c18718823f633e5f6 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Thu, 24 Jul 2014 10:11:38 +0530 Subject: [PATCH] Attributes for email templates rendered conditionally, more added --- app/models/email_settings.rb | 10 ++++- app/views/admin/emails/_help.html.haml | 61 +++++++++++++++++--------- app/views/admin/emails/index.html.haml | 14 +++--- 3 files changed, 55 insertions(+), 30 deletions(-) diff --git a/app/models/email_settings.rb b/app/models/email_settings.rb index c5093e27..00af35b1 100644 --- a/app/models/email_settings.rb +++ b/app/models/email_settings.rb @@ -19,9 +19,15 @@ class EmailSettings < ActiveRecord::Base 'registration_start_date' => conference.registration_start_date, 'registration_end_date' => conference.registration_end_date, 'venue' => conference.venue.name, - 'venue_adress' => conference.venue.address, + 'venue_address' => conference.venue.address, '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']), + 'conference_splash_link' => Rails.application.routes.url_helpers.conference_url( + conference.short_title, host: CONFIG['url_for_emails']), + 'cfp_start_date' => conference.call_for_papers.start_date, + 'cfp_end_date' => conference.call_for_papers.end_date, + 'schedule_link' => Rails.application.routes.url_helpers.conference_schedule_url( + conference.short_title, host: CONFIG['url_for_emails']) } if !event.nil? diff --git a/app/views/admin/emails/_help.html.haml b/app/views/admin/emails/_help.html.haml index c244d444..587056ef 100644 --- a/app/views/admin/emails/_help.html.haml +++ b/app/views/admin/emails/_help.html.haml @@ -10,30 +10,49 @@ %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 + - if show_event_variables + %tr + %td {proposalslink} + %td A link to the user's proposal 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 + - if @conference.registration_dates_given? + %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 {registrationlink} + %td A link to the registration page + - unless @conference.venue.name.blank? + %tr + %td {venue} + %td The name of the venue + - unless @conference.venue.address.blank? + %tr + %td {venue_address} + %td The address of the venue + - unless @conference.call_for_papers.blank? || @conference.call_for_papers.start_date.blank? || @conference.call_for_papers.end_date.blank? + %tr + %td {cfp_start_date} + %td The call for papers start date + %tr + %td {cfp_end_date} + %td The call for papers end date + -if @conference.call_for_papers.schedule_public + %td {schedule_link} + %td The link to complete schedule of the conference + - if @conference.make_conference_public + %tr + %td {conference_splash_link} + %td The link to conference splash page + diff --git a/app/views/admin/emails/index.html.haml b/app/views/admin/emails/index.html.haml index c084fe5c..fa59ce98 100644 --- a/app/views/admin/emails/index.html.haml +++ b/app/views/admin/emails/index.html.haml @@ -9,49 +9,49 @@ %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", "data-name"=>"email_settings_registration_email_template"} Load Template %a.btn.btn-link.control_label.template_help_link{"data-name"=>"registration_help"} Show Help - = render partial: 'help', locals: {id: 'registration_help'} + = render partial: 'help', locals: {id: 'registration_help', show_event_variables: false} = 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 :accepted_subject = f.input :accepted_email_template, :input_html => { :rows => 10, :cols => 20 } %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", "data-name"=>"email_settings_accepted_email_template"} Load Template %a.btn.btn-link.control_label.template_help_link{"data-name"=>"accepted_help"} Show Help - = render partial: 'help', locals: {id: 'accepted_help'} + = render partial: 'help', locals: {id: 'accepted_help', show_event_variables: true} = 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 :rejected_subject = f.input :rejected_email_template, :input_html => { :rows => 10, :cols => 20 } %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", "data-name"=>"email_settings_rejected_email_template"} Load Template %a.btn.btn-link.control_label.template_help_link{"data-name"=>"rejected_help"} Show Help - = render partial: 'help', locals: {id: 'rejected_help'} + = render partial: 'help', locals: {id: 'rejected_help', show_event_variables: true} = 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"} = f.input :confirmed_without_registration_subject = f.input :confirmed_email_template, :input_html => { :rows => 10, :cols => 20 } %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", "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'} + = render partial: 'help', locals: {id: 'confirmed_help', show_event_variables: true} = 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'} + = render partial: 'help', locals: {id: 'updated_dates_help', show_event_variables: false} = 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'} + = render partial: 'help', locals: {id: 'updated_registrations_dates_help', show_event_variables: false} = 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'} + = render partial: 'help', locals: {id: 'updated_venue_help', show_event_variables: false} .row .col-md-12 = f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}