Broadcast is up
This commit is contained in:
parent
2c0de5b038
commit
1b95a5eb3d
@ -1054,6 +1054,10 @@ ul.warnings li,
|
||||
@include _(border-radius, 50%);
|
||||
@include default-box-shadow(top, 2);
|
||||
}
|
||||
|
||||
&.make-room {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
}
|
||||
|
||||
.warning-info {
|
||||
@ -2847,6 +2851,16 @@ html[data-lingua-franca-example="html"] {
|
||||
}
|
||||
}
|
||||
|
||||
.major-group {
|
||||
border-bottom: 0.333em solid #EEE;
|
||||
padding-bottom: 2em;
|
||||
margin-bottom: 1em;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#main .workshop-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
@ -1008,19 +1008,36 @@ class ConferencesController < ApplicationController
|
||||
when 'broadcast'
|
||||
@subject = params[:subject]
|
||||
@body = params[:body]
|
||||
@send_to = params[:send_to]
|
||||
@register_template = :administration
|
||||
if params[:button] == 'send'
|
||||
view_context.broadcast_to(@send_to).each do | user |
|
||||
UserMailer.send_mail :broadcast do
|
||||
[
|
||||
"#{request.protocol}#{request.host_with_port}",
|
||||
@subject,
|
||||
@body,
|
||||
user,
|
||||
@this_conference
|
||||
]
|
||||
end
|
||||
end
|
||||
return redirect_to administration_step_path(@this_conference.slug, :broadcast_sent)
|
||||
elsif params[:button] == 'preview'
|
||||
@send_to_count = view_context.broadcast_to(@send_to).size
|
||||
@broadcast_step = :preview
|
||||
elsif params[:button] == 'test'
|
||||
@broadcast_step = :test
|
||||
UserMailer.delay.broadcast(
|
||||
"#{request.protocol}#{request.host_with_port}",
|
||||
@subject,
|
||||
@body,
|
||||
current_user,
|
||||
@this_conference)
|
||||
UserMailer.send_mail :broadcast do
|
||||
[
|
||||
"#{request.protocol}#{request.host_with_port}",
|
||||
@subject,
|
||||
@body,
|
||||
current_user,
|
||||
@this_conference
|
||||
]
|
||||
end
|
||||
@send_to_count = view_context.broadcast_to(@send_to).size
|
||||
end
|
||||
return render 'conferences/register'
|
||||
when 'locations'
|
||||
|
@ -878,15 +878,72 @@ module ApplicationHelper
|
||||
return html.html_safe
|
||||
end
|
||||
|
||||
def broadcast_methods
|
||||
[
|
||||
def broadcast_to(to, conference = nil)
|
||||
conference ||= @this_conference || @conference
|
||||
|
||||
users = []
|
||||
|
||||
case to.to_sym
|
||||
when :registered
|
||||
ConferenceRegistration.where(conference_id: conference.id).each do | r |
|
||||
users << r.user if ((r.steps_completed || []).include? 'questions') && r.user.present?
|
||||
end
|
||||
when :pre_registered
|
||||
ConferenceRegistration.where(conference_id: conference.id).each do | r |
|
||||
users << r.user if ((r.steps_completed || []).include? 'contact_info') && r.user.present?
|
||||
end
|
||||
when :workshop_facilitators
|
||||
user_hash = {}
|
||||
Workshop.where(conference_id: conference.id).each do | w |
|
||||
w.active_facilitators.each do | u |
|
||||
user_hash[u.id] ||= u if u.present?
|
||||
end
|
||||
end
|
||||
users = user_hash.values
|
||||
when :unregistered
|
||||
ConferenceRegistration.where(conference_id: conference.id).each do | r |
|
||||
users << r.user unless ((r.steps_completed || []).include? (conference.registration_status == :open ? 'questions' : 'contact_info')) || r.user.nil?
|
||||
end
|
||||
when :housing_providers
|
||||
ConferenceRegistration.where(conference_id: conference.id, can_provide_housing: true).each do | r |
|
||||
users << r.user if r.user.present?
|
||||
end
|
||||
when :guests
|
||||
ConferenceRegistration.where(conference_id: conference.id, housing: 'house').each do | r |
|
||||
users << r.user if r.user.present?
|
||||
end
|
||||
when :all
|
||||
User.all.each do | u |
|
||||
users << u if u.present? && (u.is_subscribed.nil? || u.is_subscribed)
|
||||
end
|
||||
end
|
||||
|
||||
puts "Users:"
|
||||
users.each do | u |
|
||||
puts "\t#{u.id}\t#{u.email}"
|
||||
end
|
||||
return users
|
||||
end
|
||||
|
||||
def broadcast_options(conference = nil)
|
||||
conference ||= @this_conference || @conference
|
||||
|
||||
options = [
|
||||
:registered,
|
||||
:confirmed_registrations,
|
||||
:unconfirmed_registrations,
|
||||
:unconfirmed_registrations,
|
||||
:pre_registered,
|
||||
:workshop_facilitators,
|
||||
:everyone,
|
||||
:unregistered,
|
||||
:housing_providers,
|
||||
:guests,
|
||||
:all
|
||||
]
|
||||
|
||||
if conference.registration_status != :open
|
||||
options -= [:registered, :guests]
|
||||
options -= [:pre_registered] unless conference.registration_status != :pre
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
def admin_steps
|
||||
@ -982,8 +1039,8 @@ module ApplicationHelper
|
||||
@confirmation_dlg ||= true
|
||||
args[:data] ||= {}
|
||||
args[:data][:confirmation] = true
|
||||
button_tag args do
|
||||
(button_name.to_s + content_tag(:template, confirmation_text, class: 'message')).html_safe
|
||||
button_tag button_name, args do
|
||||
((_"forms.actions.generic.#{button_name.to_s}") + content_tag(:template, confirmation_text, class: 'message')).html_safe
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -36,8 +36,8 @@ class UserMailer < ActionMailer::Base
|
||||
@content = content
|
||||
@banner = nil
|
||||
@conference = Conference.find(conference) if conference.present?
|
||||
@user = Conference.find(user) if user.present?
|
||||
@subject = "[#{conference ? conference.title : 'Bike!Bike!'}] #{subject}"
|
||||
@user = User.find(user) if user.present?
|
||||
@subject = "[#{@conference ? @conference.title : 'Bike!Bike!'}] #{subject}"
|
||||
if @user && @user.named_email
|
||||
mail to: @user.named_email, subject: @subject
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
= columns(medium: 12) do
|
||||
%h2=_@page_title
|
||||
= columns(medium: 12) do
|
||||
= columns(medium: 12, class: 'major-group') do
|
||||
- if @my_workshops.present?
|
||||
%h3=_'articles.conference_registration.headings.Your_Workshops'
|
||||
%p=_'articles.conference_registration.paragraphs.Your_Workshops', :p
|
||||
@ -9,17 +9,16 @@
|
||||
%p=_'articles.conference_registration.paragraphs.Create_Workshop', :p
|
||||
= link_to (_'articles.conference_registration.headings.Add_Workshop'), create_workshop_path(@this_conference.slug), class: :button
|
||||
- if @requested_workshops.present?
|
||||
= columns(medium: 12) do
|
||||
= columns(medium: 12, class: 'major-group') do
|
||||
%h3=_'articles.conference_registration.headings.Workshops_You_Have_Requested'
|
||||
%p=_'articles.conference_registration.paragraphs.Workshops_You_Have_Requested', :p
|
||||
= render 'workshops/workshop_previews', :workshops => @requested_workshops
|
||||
- if @workshops_in_need.present?
|
||||
= columns(medium: 12) do
|
||||
= columns(medium: 12, class: 'major-group') do
|
||||
%h3=_'articles.conference_registration.headings.Workshops_Looking_For_Facilitators'
|
||||
%p=_'articles.conference_registration.paragraphs.Workshops_Looking_For_Facilitators', :p
|
||||
= render 'workshops/workshop_previews', :workshops => @workshops_in_need
|
||||
- if @workshops.present?
|
||||
= columns(medium: 12) do
|
||||
= columns(medium: 12, class: 'major-group') do
|
||||
%h3=_'articles.conference_registration.headings.All_Workshops'
|
||||
-#%p=_'articles.conference_registration.paragraphs.All_Workshops', :p
|
||||
= render 'workshops/workshop_previews', :workshops => @workshops
|
||||
|
@ -2,6 +2,11 @@
|
||||
- if @broadcast_step == :preview || @broadcast_step == :test
|
||||
= hidden_field_tag :subject, @subject
|
||||
= hidden_field_tag :body, @body
|
||||
= hidden_field_tag :send_to, @send_to
|
||||
- if @broadcast_step == :preview
|
||||
%p= _'articles.conference_registration.paragraphs.admin.broadcast.test', vars: { send_to_count: "<strong>#{(@send_to_count || 0)}</strong>".html_safe }
|
||||
- else
|
||||
.warning-info.make-room= _'articles.conference_registration.paragraphs.admin.broadcast.preview', vars: { send_to_count: "<strong>#{(@send_to_count || 0)}</strong>".html_safe }
|
||||
.test-preview
|
||||
%h4=@subject
|
||||
= richtext @body, 4
|
||||
@ -10,10 +15,8 @@
|
||||
= button_with_confirmation :send, (_'modals.admin.broadcast.confirm', vars: { number: @subscriber_count || 0 }), value: :send, class: :delete if @broadcast_step == :test
|
||||
= button_tag :edit, value: :edit
|
||||
- else
|
||||
= selectfield :send_to, nil, broadcast_options, full: true
|
||||
= textfield :subject, @subject, required: true, big: true
|
||||
= textarea :body, @body, lang: @this_conference.locale, edit_on: :focus
|
||||
.actions.right
|
||||
= button_tag :preview, value: :preview
|
||||
-# I18n.backend.enabled_locales.each do | locale |
|
||||
-# if locale.to_s != @this_conference.locale.to_s
|
||||
-#= textarea "info_translations[#{locale.to_s}]", (richtext @this_conference._info(locale)), label: 'translate.pages.Locale_Translation', vars: { language: _("languages.#{locale}") }, lang: locale
|
||||
|
@ -5485,6 +5485,9 @@ en:
|
||||
schedule:
|
||||
published: Your scheulde is currently published and viewable on the front-page. Un-publishing the schedule will remove it from the front-page and show a list of proposed workshops instead.
|
||||
un_published: Your schedule is not yet published. Publishing the schedule will replace the list of proposed workshops on the front-page with the schedule as it is shown below.
|
||||
broadcast:
|
||||
test: Please take a look at this preview to ensure that you want to send this email. Clicking ‘Test’ will send the email only to you. Only after that then the email will be set to %{send_to_count} people.
|
||||
preview: Clicking ‘Send’ will send this message to %{send_to_count} people. Please confirm that you have verified that the test email sent to you is what you want to be sent.
|
||||
companion: Is there someone who you would like us to ensure that you are housed with?
|
||||
arrival_and_departure: If you don't need housing, just tell us how long you plan to hang out with Bike!Bike!
|
||||
host:
|
||||
@ -5698,6 +5701,7 @@ en:
|
||||
days: Days
|
||||
length: Length
|
||||
workshop_block: Block
|
||||
send_to: Send To
|
||||
actions:
|
||||
generic:
|
||||
login: Sign In
|
||||
@ -5741,6 +5745,15 @@ en:
|
||||
remove_interest: Click if you are no longer interested in this workshop
|
||||
show_interest: Click if you are interested in this workshop
|
||||
add: Add new
|
||||
options:
|
||||
send_to:
|
||||
registered: Everyone who has registered
|
||||
pre_registered: Everyone who has pre-registered or registered
|
||||
unregistered: Everyone who has not completed their registration
|
||||
workshop_facilitators: All workshop facilitators
|
||||
housing_providers: Housing providers
|
||||
guests: Everyone who has requested housing
|
||||
all: Everyone
|
||||
page_titles:
|
||||
'403':
|
||||
Access_Denied: Access Denied
|
||||
|
Loading…
x
Reference in New Issue
Block a user