parent
63d2980fe3
commit
27fc0acbf8
24 changed files with 388 additions and 116 deletions
|
|
@ -121,7 +121,7 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
$("#conference-reg-start-datepicker").datetimepicker({
|
||||
$("#registration-start-datepicker").datetimepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
timeFormat: "HH:mm",
|
||||
showSecond: false,
|
||||
|
|
@ -131,7 +131,7 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
$("#conference-reg-end-datepicker").datetimepicker({
|
||||
$("#registration-end-datepicker").datetimepicker({
|
||||
dateFormat: "yy-mm-dd",
|
||||
timeFormat: "HH:mm",
|
||||
showSecond: false,
|
||||
|
|
|
|||
46
app/controllers/admin/audiences_controller.rb
Normal file
46
app/controllers/admin/audiences_controller.rb
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
module Admin
|
||||
class AudiencesController < ApplicationController
|
||||
before_action :set_conference, only: [:edit, :update]
|
||||
before_action :set_audience, only: [:edit, :update]
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
@audience.assign_attributes(audience_params)
|
||||
|
||||
notify_on_conf_reg_dates_updates = (@audience.registration_start_date_changed? || @audience.registration_end_date_changed?)\
|
||||
&& @conference.email_settings.send_on_updated_conference_registration_dates\
|
||||
&& !@conference.email_settings.updated_conference_registration_dates_subject.blank?\
|
||||
&& @conference.email_settings.updated_conference_registration_dates_template
|
||||
|
||||
if @audience.update(audience_params)
|
||||
Mailbot.delay.conference_registration_date_update_mail(@conference) if notify_on_conf_reg_dates_updates
|
||||
redirect_to edit_admin_conference_audience_path(@conference.short_title),
|
||||
notice: 'Audience was successfully updated.'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_conference
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
end
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_audience
|
||||
@audience = @conference.audience
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def audience_params
|
||||
# params.require(:audience).permit(:conference_id,
|
||||
# :registration_start_date,
|
||||
# :registration_end_date,
|
||||
# :registration_description)
|
||||
params[:audience]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -81,14 +81,8 @@ module Admin
|
|||
&& !@conference.email_settings.updated_conference_dates_subject.blank?\
|
||||
&& @conference.email_settings.updated_conference_dates_template
|
||||
|
||||
notify_on_conf_reg_dates_updates = (@conference.registration_start_date_changed? || @conference.registration_end_date_changed?)\
|
||||
&& @conference.email_settings.send_on_updated_conference_registration_dates\
|
||||
&& !@conference.email_settings.updated_conference_registration_dates_subject.blank?\
|
||||
&& @conference.email_settings.updated_conference_registration_dates_template
|
||||
|
||||
if @conference.update_attributes(params[:conference])
|
||||
Mailbot.delay.conference_date_update_mail(@conference) if notify_on_conf_dates_updates
|
||||
Mailbot.delay.conference_registration_date_update_mail(@conference) if notify_on_conf_reg_dates_updates
|
||||
redirect_to(edit_admin_conference_path(id: @conference.short_title),
|
||||
notice: 'Conference was successfully updated.')
|
||||
else
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ module Admin
|
|||
|
||||
@tickets_time = []
|
||||
|
||||
if @conference.registration_start_date && @conference.end_date && @registered > 0 && @supporter_levels
|
||||
start_date = @conference.registration_start_date
|
||||
if @conference.audience.registration_start_date && @conference.end_date && @registered > 0 && @supporter_levels
|
||||
start_date = @conference.audience.registration_start_date
|
||||
end_date = @conference.end_date
|
||||
levels = []
|
||||
@conference.supporter_levels.each do |level|
|
||||
|
|
@ -154,8 +154,8 @@ module Admin
|
|||
]
|
||||
|
||||
# REGISTRATIONS, registered_time
|
||||
if @conference.registration_start_date && @conference.end_date && @registered > 0
|
||||
start_date = @conference.registration_start_date
|
||||
if @conference.audience.registration_start_date && @conference.end_date && @registered > 0
|
||||
start_date = @conference.audience.registration_start_date
|
||||
end_date = @conference.end_date
|
||||
@registered_time = var_time(start_date, end_date, @registrations, 'created_at')
|
||||
end
|
||||
|
|
|
|||
5
app/models/audience.rb
Normal file
5
app/models/audience.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class Audience < ActiveRecord::Base
|
||||
attr_accessible :registration_description, :registration_start_date, :registration_end_date
|
||||
|
||||
belongs_to :conference
|
||||
end
|
||||
|
|
@ -9,11 +9,11 @@ class Conference < ActiveRecord::Base
|
|||
:start_date, :end_date, :rooms_attributes, :tracks_attributes,
|
||||
:dietary_choices_attributes, :use_dietary_choices, :use_supporter_levels,
|
||||
:supporter_levels_attributes, :social_events_attributes, :event_types_attributes,
|
||||
:registration_start_date, :registration_end_date, :logo, :questions_attributes,
|
||||
:logo, :questions_attributes,
|
||||
:question_ids, :answers_attributes, :answer_ids, :difficulty_levels_attributes,
|
||||
:use_difficulty_levels, :use_vpositions, :use_vdays, :vdays_attributes,
|
||||
:vpositions_attributes, :use_volunteers, :color,
|
||||
:description, :registration_description, :ticket_description,
|
||||
:description, :ticket_description,
|
||||
:sponsorship_levels_attributes, :sponsors_attributes,
|
||||
:sponsor_description, :sponsor_email, :lodging_description,
|
||||
:include_registrations_in_splash, :include_sponsors_in_splash,
|
||||
|
|
@ -28,7 +28,7 @@ class Conference < ActiveRecord::Base
|
|||
has_and_belongs_to_many :questions
|
||||
|
||||
has_one :contact, dependent: :destroy
|
||||
|
||||
has_one :audience, dependent: :destroy
|
||||
has_one :email_settings, dependent: :destroy
|
||||
has_one :call_for_papers, dependent: :destroy
|
||||
has_many :social_events, dependent: :destroy
|
||||
|
|
@ -94,6 +94,7 @@ class Conference < ActiveRecord::Base
|
|||
before_create :create_event_types
|
||||
before_create :create_email_settings
|
||||
before_create :add_color
|
||||
before_create :create_audience
|
||||
|
||||
##
|
||||
# Checks if the user is registered to the conference
|
||||
|
|
@ -124,7 +125,7 @@ class Conference < ActiveRecord::Base
|
|||
def registration_open?
|
||||
today = Date.current
|
||||
if registration_dates_given?
|
||||
(registration_start_date..registration_end_date).cover?(today)
|
||||
(audience.registration_start_date..audience.registration_end_date).cover?(today)
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
@ -137,7 +138,7 @@ class Conference < ActiveRecord::Base
|
|||
# * +false+ -> If the conference registration dates are not set
|
||||
# * +true+ -> If conference registration dates are set
|
||||
def registration_dates_given?
|
||||
if registration_start_date.blank? || registration_end_date.blank?
|
||||
if audience.registration_start_date.blank? || audience.registration_end_date.blank?
|
||||
false
|
||||
else
|
||||
true
|
||||
|
|
@ -213,8 +214,8 @@ class Conference < ActiveRecord::Base
|
|||
result = []
|
||||
|
||||
if registrations &&
|
||||
registration_start_date &&
|
||||
registration_end_date
|
||||
audience.registration_start_date &&
|
||||
audience.registration_end_date
|
||||
|
||||
reg = registrations.group(:week).count
|
||||
start_week = get_registration_start_week
|
||||
|
|
@ -232,8 +233,8 @@ class Conference < ActiveRecord::Base
|
|||
def registration_weeks
|
||||
result = 0
|
||||
weeks = 0
|
||||
if registration_start_date && registration_end_date
|
||||
weeks = Date.new(registration_start_date.year, 12, 31).
|
||||
if audience.registration_start_date && audience.registration_end_date
|
||||
weeks = Date.new(audience.registration_start_date.year, 12, 31).
|
||||
strftime('%W').to_i
|
||||
|
||||
result = get_registration_end_week - get_registration_start_week + 1
|
||||
|
|
@ -260,7 +261,7 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +Integer+ -> start week
|
||||
def get_registration_start_week
|
||||
registration_start_date.strftime('%W').to_i
|
||||
audience.registration_start_date.strftime('%W').to_i
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -269,7 +270,7 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +Integer+ -> start week
|
||||
def get_registration_end_week
|
||||
registration_end_date.strftime('%W').to_i
|
||||
audience.registration_end_date.strftime('%W').to_i
|
||||
end
|
||||
|
||||
##
|
||||
|
|
@ -425,13 +426,11 @@ class Conference < ActiveRecord::Base
|
|||
# * +ActiveRecord+
|
||||
def self.get_active_conferences_for_dashboard
|
||||
result = Conference.where('start_date > ?', Time.now).
|
||||
select('id, short_title, color, start_date,
|
||||
registration_end_date, registration_start_date')
|
||||
select('id, short_title, color, start_date')
|
||||
|
||||
if result.length == 0
|
||||
result = Conference.
|
||||
select('id, short_title, color, start_date, registration_end_date,
|
||||
registration_start_date').limit(2).
|
||||
select('id, short_title, color, start_date').limit(2).
|
||||
order(start_date: :desc)
|
||||
end
|
||||
result
|
||||
|
|
@ -443,8 +442,7 @@ class Conference < ActiveRecord::Base
|
|||
# ====Returns
|
||||
# * +ActiveRecord+
|
||||
def self.get_conferences_without_active_for_dashboard(active_conferences)
|
||||
result = Conference.select('id, short_title, color, start_date,
|
||||
registration_end_date, registration_start_date').order(start_date: :desc)
|
||||
result = Conference.select('id, short_title, color, start_date').order(start_date: :desc)
|
||||
result - active_conferences
|
||||
end
|
||||
|
||||
|
|
@ -706,7 +704,7 @@ class Conference < ActiveRecord::Base
|
|||
# * +True+ -> If conference has a start and a end date.
|
||||
# * +False+ -> If conference has no start or end date.
|
||||
def registration_date_set?
|
||||
!!registration_start_date && !!registration_end_date
|
||||
!!audience.registration_start_date && !!audience.registration_end_date
|
||||
end
|
||||
|
||||
# Calculates the distribution from events.
|
||||
|
|
@ -866,6 +864,13 @@ class Conference < ActiveRecord::Base
|
|||
true
|
||||
end
|
||||
|
||||
##
|
||||
# Creates a Audience association proxy. Used as before_create.
|
||||
#
|
||||
def create_audience
|
||||
build_audience
|
||||
true
|
||||
end
|
||||
##
|
||||
# Creates a UID for the conference. Used as before_create.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class EmailSettings < ActiveRecord::Base
|
|||
'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,
|
||||
'registration_start_date' => conference.audience.registration_start_date,
|
||||
'registration_end_date' => conference.audience.registration_end_date,
|
||||
'venue' => conference.venue.name,
|
||||
'venue_address' => conference.venue.address,
|
||||
'registrationlink' => Rails.application.routes.url_helpers.register_conference_url(
|
||||
|
|
|
|||
4
app/views/admin/audiences/_form.html.haml
Normal file
4
app/views/admin/audiences/_form.html.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
= f.input :registration_start_date, as: :string, input_html: { id: 'registration-start-datepicker', readonly: 'readonly' }
|
||||
= f.input :registration_end_date, as: :string, input_html: { id: 'registration-end-datepicker', readonly: 'readonly' }
|
||||
= f.input :registration_description, hint: markdown_hint('This will appear in the Tickets segment of the splash.'), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.submit 'Save Audience', class: 'btn btn-primary'
|
||||
5
app/views/admin/audiences/edit.html.haml
Normal file
5
app/views/admin/audiences/edit.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
%h1 Audience
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@audience, url: admin_conference_audience_path(@conference.short_title)) do |f|
|
||||
= render 'form', f: f
|
||||
|
|
@ -20,9 +20,6 @@
|
|||
= f.input :end_date, :as => :string, :input_html => { :id => "conference-end-datepicker", :readonly => "readonly" }
|
||||
= f.inputs name: 'Registration' do
|
||||
= f.input :include_registrations_in_splash, hint: 'On setting this true you will enable the registrations to be displayed on the splash page'
|
||||
= f.input :registration_start_date, :as => :string, :input_html => { :id => "conference-reg-start-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_end_date, :as => :string, :input_html => { :id => "conference-reg-end-datepicker", :readonly => "readonly" }
|
||||
= f.input :registration_description, hint: markdown_hint("This description will appear in registration segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :ticket_description, hint: markdown_hint("This will appear in the Tickets segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :sponsor_description, hint: markdown_hint("This will appear in the sponsor segment of the splash."), input_html: { rows: 5, data: { provide: "markdown-editable" } }
|
||||
= f.input :sponsor_email, hint: 'This will appear in the sponsor segment of the splash for the sponsors to contact to the organizers'
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@
|
|||
.tab-pane.active#show
|
||||
= render partial: 'edit_show'
|
||||
.tab-pane#edit
|
||||
= render partial: 'edit_form'
|
||||
= render partial: 'edit_form'
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
%div.container.text-center
|
||||
%div.row
|
||||
%h1 Registration
|
||||
- if !@conference.registration_description.blank?
|
||||
- if !@conference.audience.registration_description.blank?
|
||||
.lead
|
||||
= markdown(@conference.registration_description)
|
||||
= markdown(@conference.audience.registration_description)
|
||||
- if @conference.registration_dates_given?
|
||||
-if @conference.registration_end_date >= Date.today
|
||||
%h4 Registration period #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
|
||||
-if @conference.audience.registration_end_date >= Date.today
|
||||
%h4 Registration period #{ date_string(@conference.audience.registration_start_date, @conference.audience.registration_end_date) }
|
||||
-else
|
||||
%h4 Registration is Closed, it was from #{ date_string(@conference.registration_start_date, @conference.registration_end_date) }
|
||||
%h4 Registration is Closed, it was from #{ date_string(@conference.audience.registration_start_date, @conference.audience.registration_end_date) }
|
||||
- if @conference.registration_open?
|
||||
= link_to "Register for #{@conference.short_title}", register_conference_path(@conference.short_title), :class =>"btn btn-success btn-lg", target: '_blank'
|
||||
- if @conference.use_supporter_levels?
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
%span.glyphicon.glyphicon-plus
|
||||
New Conference
|
||||
%hr
|
||||
%li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"}
|
||||
%li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))}"}
|
||||
= link_to(admin_conference_path(@conference.short_title)) do
|
||||
%span.fa.fa-tachometer
|
||||
Dashboard
|
||||
|
|
@ -41,6 +41,11 @@
|
|||
= link_to(admin_conference_photos_path(@conference.short_title)) do
|
||||
%span.fa.fa-picture-o
|
||||
Photos
|
||||
%li{:class=> active_nav_li(edit_admin_conference_audience_path(@conference.short_title))}
|
||||
= link_to(edit_admin_conference_audience_path(@conference.short_title)) do
|
||||
%span.fa.fa-male
|
||||
Audience
|
||||
%hr
|
||||
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
|
||||
= link_to(admin_conference_events_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-comment
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue