Moved to GMail and fixed administration errors

This commit is contained in:
Godwin
2017-02-19 20:00:04 -08:00
parent 8b9a11575c
commit 888f186a34
18 changed files with 405 additions and 372 deletions
@@ -5,8 +5,8 @@
"chrome": ["51"]
},
"development": {
"and_chr": ["55"],
"chrome": ["55"],
"and_chr": ["56"],
"chrome": ["56"],
"edge": ["13"],
"firefox": ["50"],
"ie": ["11"],
+8 -4
View File
@@ -78,11 +78,15 @@ class ApplicationController < LinguaFrancaApplicationController
end
def home
@workshops = Workshop.where(:conference_id => @conference.id)
@workshops = []
if @conference.workshop_schedule_published
@event_dlg = true
get_scheule_data(false)
if @conference.present?
@workshops = Workshop.where(conference_id: @conference.id)
if @conference.workshop_schedule_published
@event_dlg = true
get_scheule_data(false)
end
end
end
@@ -62,7 +62,10 @@ class ConferenceAdministrationController < ApplicationController
set_flash_messages
# redirect to the step unless the method handled redirection itself
unless self.send(method_name)
case self.send(method_name)
when true
administration_step(@admin_step)
when false
redirect_to administration_step_path(@this_conference.slug, @admin_step)
end
end
@@ -100,6 +103,9 @@ class ConferenceAdministrationController < ApplicationController
end
def administrate_broadcast
if @this_conference.start_date.blank? || @this_conference.end_date.blank?
@warning_message = :no_date_warning
end
end
def administrate_broadcast_sent
@@ -120,6 +126,9 @@ class ConferenceAdministrationController < ApplicationController
end
def administrate_registration_status
if @this_conference.start_date.blank? || @this_conference.end_date.blank?
@warning_message = :no_date_warning
end
end
def administrate_organizations
@@ -165,6 +174,11 @@ class ConferenceAdministrationController < ApplicationController
end
def administrate_registrations
if @this_conference.start_date.blank? || @this_conference.end_date.blank?
@warning_message = :no_date_warning
return
end
get_stats(!request.format.xlsx?)
if request.format.xlsx?
@@ -200,6 +214,11 @@ class ConferenceAdministrationController < ApplicationController
end
def administrate_stats
if @this_conference.start_date.blank? || @this_conference.end_date.blank?
@warning_message = :no_date_warning
return
end
get_stats(!request.format.xlsx?)
if request.format.xlsx?
@@ -736,7 +755,7 @@ class ConferenceAdministrationController < ApplicationController
end
else
do_404
return true
return nil
end
return false
@@ -945,7 +964,7 @@ class ConferenceAdministrationController < ApplicationController
do_404
end
return true
return nil
end
def admin_update_housing
@@ -985,7 +1004,7 @@ class ConferenceAdministrationController < ApplicationController
do_404
end
return true
return nil
end
def admin_update_broadcast
@@ -1007,7 +1026,7 @@ class ConferenceAdministrationController < ApplicationController
end
end
redirect_to administration_step_path(@this_conference.slug, :broadcast_sent)
return true
return nil
elsif params[:button] == 'preview'
@send_to_count = view_context.broadcast_to(@send_to).size
@broadcast_step = :preview
@@ -1024,7 +1043,7 @@ class ConferenceAdministrationController < ApplicationController
end
@send_to_count = view_context.broadcast_to(@send_to).size
end
return false
return true
end
def admin_update_locations
@@ -1087,14 +1106,14 @@ class ConferenceAdministrationController < ApplicationController
end
do_404
return true
return nil
end
def admin_update_events
case params[:button]
when 'edit'
redirect_to edit_event_path(@this_conference.slug, params[:id])
return true
return nil
when 'save'
if params[:id].present?
event = Event.find_by!(conference_id: @this_conference.id, id: params[:id])
@@ -1124,7 +1143,7 @@ class ConferenceAdministrationController < ApplicationController
end
do_404
return true
return nil
end
def admin_update_workshop_times
@@ -1141,7 +1160,7 @@ class ConferenceAdministrationController < ApplicationController
end
do_404
return true
return nil
end
def admin_update_schedule
@@ -1155,7 +1174,6 @@ class ConferenceAdministrationController < ApplicationController
@entire_page = false
get_scheule_data
render partial: 'schedule'
return true
when 'get-workshop-list'
get_scheule_data(true)
@@ -1171,7 +1189,6 @@ class ConferenceAdministrationController < ApplicationController
end
render partial: 'select_workshop_table'
return true
when 'set-workshop'
workshop = Workshop.find_by!(conference_id: @this_conference.id, id: params[:workshop].to_i)
workshop.event_location_id = params[:location]
@@ -1183,11 +1200,11 @@ class ConferenceAdministrationController < ApplicationController
get_scheule_data
render partial: 'schedule'
return true
else
do_404
end
do_404
return true
return nil
end
def admin_update_schedule
+2 -1
View File
@@ -991,7 +991,8 @@ module ApplicationHelper
def administration_sub_steps
{
location_edit: :locations,
event_edit: :events
event_edit: :events,
broadcast_sent: :broadcast
}
end
+13 -14
View File
@@ -4,22 +4,21 @@ require 'geocoder/railtie'
Geocoder::Railtie.insert
class EventLocation < ActiveRecord::Base
belongs_to :conference
geocoded_by :full_address
belongs_to :conference
geocoded_by :full_address
reverse_geocoded_by :latitude, :longitude, :address => :full_address
after_validation :geocode, if: ->(obj){ obj.address_changed? }
reverse_geocoded_by :latitude, :longitude, :address => :full_address
after_validation :geocode, if: ->(obj){ obj.address_changed? }
def full_address
l = conference.location
[address, l.city, l.territory, l.country].join(', ')
end
def full_address
[address, conference.city.city, conference.city.territory, conference.city.country].join(', ')
end
def self.all_spaces
Workshop.all_spaces + [:event_space]
end
def self.all_spaces
Workshop.all_spaces + [:event_space]
end
def self.all_amenities
Workshop.all_needs
end
def self.all_amenities
Workshop.all_needs
end
end
+2 -2
View File
@@ -1,5 +1,5 @@
- content_for :og_image do
= @conference.poster.full.url || image_path('default_poster.jpg')
- if @conferences
= (@conference.present? ? @conference.poster.full.url : nil) || image_path('default_poster.jpg')
- if @conferences.present?
- @conferences.each do | conference |
= render 'conferences/conference', conference: conference, links: [ :read_more, :register ]
@@ -1,23 +1,27 @@
= columns(medium: 12) do
= admin_update_form do
- 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 }
- if @warning_message
= columns(medium: 12) do
.warning-info=_"articles.admin.registrations.#{@warning_message}"
- else
= columns(medium: 12) do
= admin_update_form do
- 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
%h3=@subject
= richtext @body, 4
.actions.right
= button_tag :test, value: :test, class: :secondary if @broadcast_step == :preview
= button_with_confirmation :send, (_'modals.admin.broadcast.confirm', vars: { number: "<strong>#{(@send_to_count || 0)}</strong>".html_safe }), value: :send, class: :delete if @broadcast_step == :test
= button_tag :edit, value: :edit
- 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
%h3=@subject
= richtext @body, 4
.actions.right
= button_tag :test, value: :test, class: :secondary if @broadcast_step == :preview
= button_with_confirmation :send, (_'modals.admin.broadcast.confirm', vars: { number: "<strong>#{(@send_to_count || 0)}</strong>".html_safe }), 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
= 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
@@ -1,5 +1,9 @@
= columns(medium: 12) do
= form_tag administration_update_path(@this_conference.slug, @admin_step) do
= selectfield :registration_status, @this_conference.registration_status || 'closed', registration_status_options_list, inline_label: true
.actions.left
= button_tag :save, value: :save
- if @warning_message
= columns(medium: 12) do
.warning-info=_"articles.admin.registrations.#{@warning_message}"
- else
= columns(medium: 12) do
= form_tag administration_update_path(@this_conference.slug, @admin_step) do
= selectfield :registration_status, @this_conference.registration_status || 'closed', registration_status_options_list, inline_label: true
.actions.left
= button_tag :save, value: :save
@@ -1,17 +1,21 @@
- add_inline_script :registrations
= columns(medium: 12) do
.goes-fullscreen#registrations-table
.flex-column
= searchfield :search, nil, big: true, stretch: true
%a.button{data: { expands: 'registrations-table' }}='expand'
%a.button.delete{data: { contracts: 'registrations-table' }}='close'
%a.button.modify{data: { 'opens-modal': 'new-registration' }}='+'
.table-scroller
= html_table @excel_data, registrations_table_options
= admin_update_form id: 'new-registration', class: 'modal-edit' do
.modal-edit-overlay{data: { 'closes-modal': 'new-registration' }}
.modal-edit-content
= html_edit_table @excel_data, registrations_edit_table_options
.actions.right
%a.button.subdued{data: { 'closes-modal': 'new-registration' }}='Cancel'
= button_tag :save, value: :save, class: :modify
- if @warning_message
= columns(medium: 12) do
.warning-info=_"articles.admin.registrations.#{@warning_message}"
- else
- add_inline_script :registrations
= columns(medium: 12) do
.goes-fullscreen#registrations-table
.flex-column
= searchfield :search, nil, big: true, stretch: true
%a.button{data: { expands: 'registrations-table' }}='expand'
%a.button.delete{data: { contracts: 'registrations-table' }}='close'
%a.button.modify{data: { 'opens-modal': 'new-registration' }}='+'
.table-scroller
= html_table @excel_data, registrations_table_options
= admin_update_form id: 'new-registration', class: 'modal-edit' do
.modal-edit-overlay{data: { 'closes-modal': 'new-registration' }}
.modal-edit-content
= html_edit_table @excel_data, registrations_edit_table_options
.actions.right
%a.button.subdued{data: { 'closes-modal': 'new-registration' }}='Cancel'
= button_tag :save, value: :save, class: :modify
@@ -1,21 +1,25 @@
= columns(medium: 12) do
.details
= data_set(:h3, 'articles.admin.stats.headings.completed_registrations') do
= (@completed_registrations || 0).to_s
= data_set(:h3, 'articles.admin.stats.headings.incomplete_registrations') do
= ((@registration_count - @completed_registrations) || 0).to_s
= data_set(:h3, 'articles.admin.stats.headings.bikes') do
= (@completed_registrations || 0) > 0 ? "#{@bikes} (#{number_to_percentage(@bikes / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.meat') do
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{number_to_percentage(@food[:meat] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.vegetarian') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{number_to_percentage(@food[:vegetarian] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.vegan') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{number_to_percentage(@food[:vegan] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.donation_count') do
= (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{number_to_percentage(@donation_count / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.donation_total') do
= "$#{@donations || 0.00}"
.actions
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :stats, :format => :xlsx), class: [:button, :download]
= link_to (_'links.download.Organizations_Excel'), administration_step_path(@this_conference.slug, :organizations, :format => :xlsx), class: [:button, :download, :subdued]
- if @warning_message
= columns(medium: 12) do
.warning-info=_"articles.admin.registrations.#{@warning_message}"
- else
= columns(medium: 12) do
.details
= data_set(:h3, 'articles.admin.stats.headings.completed_registrations') do
= (@completed_registrations || 0).to_s
= data_set(:h3, 'articles.admin.stats.headings.incomplete_registrations') do
= ((@registration_count - @completed_registrations) || 0).to_s
= data_set(:h3, 'articles.admin.stats.headings.bikes') do
= (@completed_registrations || 0) > 0 ? "#{@bikes} (#{number_to_percentage(@bikes / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.meat') do
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{number_to_percentage(@food[:meat] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.vegetarian') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{number_to_percentage(@food[:vegetarian] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.vegan') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{number_to_percentage(@food[:vegan] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.donation_count') do
= (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{number_to_percentage(@donation_count / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.donation_total') do
= "$#{@donations || 0.00}"
.actions
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :stats, :format => :xlsx), class: [:button, :download]
= link_to (_'links.download.Organizations_Excel'), administration_step_path(@this_conference.slug, :organizations, :format => :xlsx), class: [:button, :download, :subdued]
@@ -35,4 +35,4 @@
= columns(medium: 12) do
%p=((_"articles.admin.#{@admin_group}.descriptions.#{@admin_step}", :s)) unless @hide_description === true
= row do
= render @admin_step
= render @admin_step.to_s
@@ -1,63 +1,63 @@
= render 'page_header', :page_key => 'Registration_Stats'
%article
= row do
= columns(medium: 12) do
%h2=_'articles.conference_registration.headings.Stats'
%p=_'articles.conference_registration.paragraphs.Stats', :p
= link_to (_'links.download.Excel','Download Data in Excel Format'), stats_path(@this_conference.slug, :format => :xls), {:class => :button}
= columns(medium: 6) do
%ul.stats
%li
%h3=_'articles.conference_registration.terms.Total_Registrations'
.stat.important=_!@total_registrations
%li.money
%h3=_'articles.conference_registration.terms.Total_Donations'
.stat=money @total_donations
%li
%h3=_'articles.conference_registration.terms.Donation_Count'
.stat
= _!"#{@donation_count} / #{@total_registrations}"
%li
%h3=_'articles.conference_registration.terms.Housing'
.breakdown
- @housing.each do |h, v|
- unless h == :none
.stat-with-label
.label=_"articles.conference_registration.questions.housing.#{h}"
.stat=_!v
%li
%h3=_'articles.conference_registration.terms.Bikes'
.breakdown
.stat=_!"#{@bike_count} / #{@total_registrations}"
- @bikes.each do |h, v|
- unless h == :none
.stat-with-label
.label=_"articles.conference_registration.questions.bike.#{h}"
.stat.percent=_!percent(v.to_f / @bike_count)
%li
%h3=_'articles.conference_registration.terms.Food'
.breakdown
- @food.each do |h, v|
.stat-with-label
.label=_"articles.conference_registration.questions.food.#{h}"
.stat.percent=_!percent(v.to_f / @total_registrations)
%li
%h3=_'articles.conference_registration.terms.Languages'
.breakdown
- @languages.each do |h, v|
.stat-with-label
.label=_"languages.#{h}"
.stat.percent=_!percent(v.to_f / @total_registrations)
= columns(medium: 6) do
.allergies
%h3=_'articles.conference_registration.headings.Allergies'
%ul
- @allergies.each do |a|
%li
%p=_!a
.other
%h3=_'articles.conference_registration.headings.other'
%ul
- @other.each do |o|
%li
%p=_!o
= render 'page_header', :page_key => 'Registration_Stats'
%article
= row do
= columns(medium: 12) do
%h2=_'articles.conference_registration.headings.Stats'
%p=_'articles.conference_registration.paragraphs.Stats', :p
= link_to (_'links.download.Excel','Download Data in Excel Format'), stats_path(@this_conference.slug, :format => :xls), {:class => :button}
= columns(medium: 6) do
%ul.stats
%li
%h3=_'articles.conference_registration.terms.Total_Registrations'
.stat.important=_!@total_registrations
%li.money
%h3=_'articles.conference_registration.terms.Total_Donations'
.stat=money @total_donations
%li
%h3=_'articles.conference_registration.terms.Donation_Count'
.stat
= _!"#{@donation_count} / #{@total_registrations}"
%li
%h3=_'articles.conference_registration.terms.Housing'
.breakdown
- @housing.each do |h, v|
- unless h == :none
.stat-with-label
.label=_"articles.conference_registration.questions.housing.#{h}"
.stat=_!v
%li
%h3=_'articles.conference_registration.terms.Bikes'
.breakdown
.stat=_!"#{@bike_count} / #{@total_registrations}"
- @bikes.each do |h, v|
- unless h == :none
.stat-with-label
.label=_"articles.conference_registration.questions.bike.#{h}"
.stat.percent=_!percent(v.to_f / @bike_count)
%li
%h3=_'articles.conference_registration.terms.Food'
.breakdown
- @food.each do |h, v|
.stat-with-label
.label=_"articles.conference_registration.questions.food.#{h}"
.stat.percent=_!percent(v.to_f / @total_registrations)
%li
%h3=_'articles.conference_registration.terms.Languages'
.breakdown
- @languages.each do |h, v|
.stat-with-label
.label=_"languages.#{h}"
.stat.percent=_!percent(v.to_f / @total_registrations)
= columns(medium: 6) do
.allergies
%h3=_'articles.conference_registration.headings.Allergies'
%ul
- @allergies.each do |a|
%li
%p=_!a
.other
%h3=_'articles.conference_registration.headings.other'
%ul
- @other.each do |o|
%li
%p=_!o
@@ -1 +1 @@
= excel_table(@excel_data)
= excel_table(@excel_data)