Paypal Registration

This commit is contained in:
Godwin
2014-07-24 00:16:33 -06:00
parent 4cf9277d20
commit 1430e505a0
81 changed files with 3011 additions and 295 deletions
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+81
View File
@@ -1,4 +1,43 @@
table#translations {
table-layout: fixed;
padding: 0;
.key, .pages {
width: 25%;
overflow: hidden;
&:hover {
overflow: visible;
}
}
.pages {
position: relative;
ul {
font-size: 1em;
margin: 0;
list-style: none;
position: absolute;
left: 0;
top: 0;
}
a {
display: block;
}
&:hover {
ul {
z-index: 100;
}
a {
background-color: $white;
}
}
}
td.value {
position: relative;
cursor: text;
@@ -396,6 +435,48 @@ ul.tags,
outline: none !important;
}
#register-dlg {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: transparent;
visibility: hidden;
z-index: 100;
@include text-shadow(none);
@include transition(background-color 250ms ease-in-out 125ms, visibility 0 linear 250ms);
form {
position: fixed;
min-width: 30em;
left: 110%;
right: 0;
max-width: 30em;
bottom: 0;
margin: auto;
top: 0;
background-color: $white;
height: 10em;
padding: 1em;
z-index: 101;
@include transform(skewX(-30deg));
@include transition(all 250ms ease-in-out 0);
}
&.open {
background-color: rgba($primary-color, 0.8);
visibility: visible;
@include transition(background-color 250ms ease-in-out);
form {
left: 0;
@include transform(skewX(0));
@include transition(all 250ms ease-in-out 125ms);
}
}
}
@include breakpoint(medium) {
.organizations-index,
.conferences-index {
+46 -8
View File
@@ -85,7 +85,7 @@ body {
float: left;
.logo {
width: auto;
width: 100%;
height: 90%;//2em;
fill: $primary-color;
position: absolute;
@@ -236,6 +236,11 @@ body {
text-align: center;
}
form {
text-align: center;
padding: 2em 0;
}
@include breakpoint(medium) {
+ #content {
padding-top: 0;
@@ -333,23 +338,33 @@ main {
//}
}
.align-bottom > div {
margin-bottom: 3em;
}
//.align-bottom > div {
//margin-bottom: 3em;
//}
.button {
width: 75%;
color: inherit;
border-color: inherit;
background-color: rgba(darken($article-color, 0), 0.33);
background-color: rgba(darken($primary-color, 0), 0.33);
padding: 0.75em 1em;
white-space: nowrap;
@include text-shadow(none);
&:hover {
background-color: $article-color;
background-color: $primary-color;
color: $white;
border-color: transparent;
}
&#register-now {
background-color: rgba(darken($warning-color, 0), 0.33);
margin-top: 0;
&:hover {
background-color: $warning-color;
}
}
}
.organizations & {
@@ -433,7 +448,8 @@ main {
}
}
.page-style-emphasize-banner & {
.page-style-emphasize-banner &,
.conferences & {
figure img {
box-shadow: 0 0 2em $black;
}
@@ -495,6 +511,10 @@ main {
}
}
.page-style-article.small-banner & {
min-height: 10em;
}
.page-style-list & {
min-height: 10em;
height: 30em;
@@ -505,6 +525,10 @@ main {
font-size: 6vw;
}
}
.row .align-bottom.buttons {
height: 14em;
}
}
@include breakpoint(large) {
@@ -526,6 +550,10 @@ main {
border-bottom-left-radius: inherit;
}
.button {
//margin-top: 20%;
}
.page-style-list & {
height: 15em;
height: 15vw;
@@ -560,6 +588,10 @@ main {
.row .align-bottom {
height: auto;
&.buttons {
height: 10em;
}
}
}
}
@@ -623,13 +655,15 @@ main {
position: absolute;
top: 100%;
right: 0.25em;
margin: 0.25em 0.25em 0 0;
//margin: 0.25em 0.25em 0 0;
margin: -1em 0.25em 0 0;
font-size: 0.8em;
text-align: right;
text-shadow: none;
@include opacity(0.5);
clear: right;
z-index: 2;
mix-blend-mode: luminosity;
> span {
display: none;
@@ -1043,3 +1077,7 @@ table {
.clearfix {
@include clearfix;
}
article.row {
margin-left: 0;
}
+23
View File
@@ -14,9 +14,32 @@ class ApplicationController < ActionController::Base
before_filter :capture_page_info
@@test_host
@@test_location
def capture_page_info
init_vars
$page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']}
ActionMailer::Base.default_url_options = {:host => "#{request.protocol}#{request.host_with_port}"}
lang = I18n.backend.set_locale (is_test? && @@test_host.present? ? @@test_host : request.host)
if lang.blank?
do_404
elsif lang != true
@lang = lang
render 'pages/language_not_enabled', status: 404
end
end
def self.set_host(host)
@@test_host = host
end
def self.set_location(location)
@@test_location = location#.nil? nil : Geocoder.search(location)
end
def self.get_location()
@@test_location
end
def do_404
+398 -88
View File
@@ -6,7 +6,6 @@ class ConferencesController < ApplicationController
# GET /conferences
def index
#puts params
@conference_type = nil
if params['conference_type']
@conference_type = ConferenceType.find_by!(:slug => params['conference_type'])
@@ -111,50 +110,72 @@ class ConferencesController < ApplicationController
end
def register_submit
#set_conference
next_step = nil
if !session[:registration]
session[:registration] = Hash.new
session[:registration][:path] = Array.new
end
case params['step']
case session[:registration_step] || params['step']
when 'confirm'
if session[:registration][:is_participant]
registration = ConferenceRegistration.find(session[:registration][:registration_id])
if registration.completed
complete_registration
next_step = 'thanks'
else
next_step = 'organizations'
end
else
complete_registration
next_step = 'thanks'
end
when 'register'
session[:registration][:email] = params[:email]
user = User.find_by(:email => params[:email])
#registration = ConferenceRegistration.new(:conference_id => @conference.id, :is_attending => 'yes', :is_participant => params[:is_participant], :is_volunteer => params[:is_volunteer])
session[:registration][:user] = Hash.new
session[:registration][:organizations] = Array.new
session[:registration][:user][:id] = user ? user.id : nil
if user
user.organizations.each { |org| session[:registration][:organizations] << org.id }
registration = ConferenceRegistration.find_by(:email => params[:email])
if !registration.nil?
session[:registration] = YAML.load(registration.data)
session[:registration][:registration_id] = registration.id
next_step = (registration.completed.blank? && registration.is_participant.present? ? 'organizations' : 'thanks')
else
if !session[:registration][:user] || !session[:registration][:user][:firstname]
user = User.find_by(:email => params[:email])
session[:registration][:user] = Hash.new
session[:registration][:user][:id] = user ? user.id : nil
session[:registration][:user][:firstname] = user ? (user.firstname || user.username) : nil
session[:registration][:user][:lastname] = user ? user.lastname : nil
session[:registration][:user][:username] = user ? user.username : nil
end
next_step = 'primary'
end
session[:registration][:user][:firstname] = user ? (user.firstname || user.username) : nil
session[:registration][:user][:lastname] = user ? user.lastname : nil
session[:registration][:user][:username] = user ? user.username : nil
next_step = 'primary'
when 'primary'
if !params[:firstname] || !params[:lastname]
error = _'registration.register.no_name_error','Oh, c\'mon, please tell us your name. We promise not to share it with anyone, we just don\'t want to get you mixed up with someone else.'
if params[:firstname].blank? || params[:lastname].blank?
error = _'registration.register.no_name_error',"Oh, c'mon, please tell us your name. We promise not to share it with anyone, we just don't want to get you mixed up with someone else."
end
if (params[:is_volunteer] || 'false').to_sym != :true && (params[:is_participant] || 'false').to_sym != :true
error ||= _'registration.register.no_role_error',"Please let us know if you're attending the conference or volunteering (or both)"
end
session[:registration][:user][:firstname] = params[:firstname]
session[:registration][:user][:firstname] = params[:lastname]
session[:registration][:is_volunteer] = params[:is_volunteer]
session[:registration][:is_participant] = params[:is_participant]
session[:registration][:user][:lastname] = params[:lastname]
session[:registration][:is_volunteer] = (params[:is_volunteer] || 'false').to_sym == :true
session[:registration][:is_participant] = (params[:is_participant] || 'false').to_sym == :true
if !session[:registration][:user][:id]
session[:registration][:user][:username] = params[:username] || (params[:firstname] + ' ' + params[:lastname])
session[:registration][:user][:username] = !error && params[:username].blank? ? (params[:firstname] + ' ' + params[:lastname]) : params[:username]
end
if params[:is_volunteer]
if session[:registration][:is_volunteer]
next_step = 'volunteer_questions'
elsif params[:is_participant]
next_step = 'organizations'
else
error = _'registration.register.no_role_error',"Please let us know if you're attending the conference or volunteering (or both)"
elsif session[:registration][:is_participant]
next_step = 'questions'
end
when 'organizations'
session[:registration][:organizations] = Array.new
if params[:org].length > 0
params[:org].each { |org| session[:registration][:organizations] << org }
@registration = ConferenceRegistration.find(session[:registration][:registration_id])
if (params[:org] && params[:org].length > 0) || params[:add_new_org]
session[:registration][:organizations] = Array.new
if params[:org]
params[:org].each { |org| session[:registration][:organizations] << (org.is_a?(Array) ? org.first : org).to_i }
end
update_registration_data
if params[:add_new_org]
session[:registration][:new_organization] ||= Array.new
@@ -168,28 +189,43 @@ class ConferencesController < ApplicationController
end
next_step = 'new_organization'
else
next_step = 'questions'
if session[:registration][:is_workshop_host]
next_step = 'new_workshop'
session[:registration][:workshop] ||= Array.new
session[:registration][:workshop][0] ||= Hash.new
session[:registration][:workshop_index] = 0
else
complete_registration
next_step = 'thanks'
end
end
elsif params[:no_org]
if !session[:registration][:is_workshop_host]
next_step = 'new_workshop'
session[:registration][:workshop] ||= Array.new
session[:registration][:workshop][0] ||= Hash.new
session[:registration][:workshop_index] = 0
else
complete_registration
next_step = 'thanks'
end
elsif params[:add_new_org]
session[:registration][:questions] ||= Hash.new
next_step = 'questions'
else
error = _'registration.register.no_organization_error',"Please select an organization or enter a new one"
end
when 'new_organization'
if !params[:city]
message = _'register.new_organization.no_city_error','Please enter your organization\'s city'
if params[:name].blank?
error = _'register.new_organization.no_name_error',"Please tell us your organization's name"
end
if !params[:street]
message = _'register.new_organization.no_street_error','Please enter your organization\'s street address'
end
if !params[:organization_email]
message = _'register.new_organization.no_email_error','Please tell us your organization\'s email address. We need it so that we can send out invitaions for upcoming conferences. No spam, we promise, and you\'ll be able to edit your preferences before we start ending out email.'
if params[:organization_email].blank?
error ||= _'register.new_organization.no_email_error',"Please tell us your organization's email address. We need it so that we can send out invitations for upcoming conferences. No spam, we promise, and you'll be able to edit your preferences before we start ending out email."
elsif params[:organization_email].strip.casecmp(session[:registration][:email].strip)
message = _'register.new_organization.same_email_as_attendee_error','This email needs to be different than your own personal email, we need to keep in touch with your organization even if you\'re gone in years to come.'
error ||= _'register.new_organization.same_email_as_attendee_error',"This email needs to be different than your own personal email, we need to keep in touch with your organization even if you're gone in years to come."
end
if !params[:name]
message = _'register.new_organization.no_name_error','Please tell us your organization\'s name'
if params[:street].blank?
error ||= _'register.new_organization.no_street_error','Please enter your organization\'s street address'
end
if params[:city].blank?
error ||= _'register.new_organization.no_city_error','Please enter your organization\'s city'
end
i = params[:new_org_index].to_i
session[:registration][:new_organization][i][:country] = params[:organization_country]
@@ -200,23 +236,26 @@ class ConferencesController < ApplicationController
session[:registration][:new_organization][i][:email] = params[:organization_email]
session[:registration][:new_organization][i][:name] = params[:organization_name]
if params[:organization_logo]
if session[:registration][:new_organization][i][:organization_logo]
FileUtils.rm session[:registration][:new_organization][i][:organization_logo]
end
if params[:logo] && !session[:registration][:new_organization][i][:saved]
begin
if session[:registration][:new_organization][i][:logo]
FileUtils.rm session[:registration][:new_organization][i][:logo]
end
rescue; end
base_dir = File.join("public", "registration_data")
FileUtils.mkdir_p(base_dir) unless File.directory?(base_dir)
hash_dir = rand(36**16).to_s(36)
hash_dir = rand_hash
dir = File.join(base_dir, hash_dir)
while File.directory?(dir)
hash_dir = rand(36**16).to_s(36)
hash_dir = rand_hash
dir = File.join(base_dir, hash_dir)
end
FileUtils.mkdir_p(dir)
session[:registration][:new_organization][i][:organization_logo] = File.join("registration_data", hash_dir, params[:organization_logo].original_filename)
FileUtils.cp params[:organization_logo].tempfile.path, File.join("public", session[:registration][:new_organization][i][:organization_logo])
session[:registration][:new_organization][i][:logo] = File.join("registration_data", hash_dir, params[:logo].original_filename)
FileUtils.cp params[:logo].tempfile.path, File.join("public", session[:registration][:new_organization][i][:logo])
end
if params[:add_another_org] && params[:add_another_org].to_sym == :on
update_registration_data
if params[:add_another_org] && params[:add_another_org].to_sym == :true
next_step = 'new_organization'
if params[:previous]
session[:registration][:new_org_index] = [0, i - 1].max
@@ -233,25 +272,37 @@ class ConferencesController < ApplicationController
if session[:registration][:new_organization][i + 1]
session[:registration][:new_organization] = session[:registration][:new_organization].first(i + 1)
end
next_step = 'questions'
if session[:registration][:is_workshop_host]
next_step = 'new_workshop'
session[:registration][:workshop] ||= Array.new
session[:registration][:workshop][0] ||= Hash.new
session[:registration][:workshop_index] = 0
else
complete_registration
next_step = 'thanks'
end
end
when 'questions'
session[:registration][:questions] = params[:questions].deep_symbolize_keys
session[:registration][:is_workshop_host] = params[:is_workshop_host].to_i
if !params[:is_workshop_host].to_i.zero?
next_step = 'new_workshop'
session[:registration][:workshop] ||= Array.new
session[:registration][:workshop][0] ||= Hash.new
session[:registration][:workshop_index] = 0
else
next_step = 'submit'
session[:registration][:is_workshop_host] = !params[:is_workshop_host].to_i.zero?
next_step = 'organizations'
if params[:submit] || params[:next]
if !session[:registration][:organizations]
user = User.find_by(:email => session[:registration][:email])
session[:registration][:organizations] = Array.new
if user
user.organizations.each { |org| session[:registration][:organizations] << org.id }
end
end
create_registration
end
when 'volunteer_questions'
session[:registration][:volunteer_questions] = params[:volunteer_questions].deep_symbolize_keys
if session[:registration][:is_participant]
next_step = 'organizations'
next_step = 'questions'
else
next_step = 'submit'
create_registration
next_step = 'thanks'
end
when 'new_workshop'
i = params[:workshop_index].to_i
@@ -259,15 +310,18 @@ class ConferencesController < ApplicationController
session[:registration][:workshop][i][:info] = params[:workshop_info]
session[:registration][:workshop][i][:stream] = params[:workshop_stream]
session[:registration][:workshop][i][:presentation_style] = params[:workshop_presentation_style]
session[:registration][:workshop][i][:notes] = params[:workshop_notes]
if !params[:workshop_info]
error = _'registration.register.no_workshop_info_error','Please describe your workshop as best as you can to give other participants an idea of what to expect'
end
if !params[:workshop_title]
if params[:workshop_title].blank?
error = _'registration.register.no_workshop_title_error','Please give your workshop a title'
end
if params[:workshop_info].blank?
error ||= _'registration.register.no_workshop_info_error','Please describe your workshop as best as you can to give other participants an idea of what to expect'
end
update_registration_data
if params[:previous]
session[:registration][:workshop_index] = [0, i - 1].max
elsif params[:add_another_workshop]
@@ -281,11 +335,14 @@ class ConferencesController < ApplicationController
if session[:registration][:workshop][i + 1]
session[:registration][:workshop] = session[:registration][:workshop].first(i + 1)
end
next_step = 'submit'
next_step = 'thanks'
complete_registration
end
when 'thanks'
@registration = ConferenceRegistration.find(session[:registration][:registration_id])
if @registration.is_confirmed.blank?
send_confirmation
end
when 'submit'
UserMailer.conference_registration_email(@conference, session[:registration]).deliver
session.delete(:registration)
next_step = 'thanks'
when 'cancel'
if params[:yes]
@@ -294,45 +351,77 @@ class ConferencesController < ApplicationController
else
return {error: false, next_step: session[:registration][:path].pop}
end
when 'already_registered'
send_confirmation
next_step = 'thanks'
when 'pay_now', 'payment-confirmed', 'payment-cancelled'
next_step = 'thanks'
end
if params[:previous]
next_step = session[:registration][:path].pop
else
if !params[:cancel] && error
return {error: true, message: error, next_step: params['step']}
end
if session[:registration] && params['step']
session[:registration][:path] << params['step']
end
session.delete(:registration_step)
#if params[:previous]
# next_step = session[:registration][:path].pop
#else
if !params[:cancel] && error
return {error: true, message: error, next_step: params['step']}
end
if session[:registration] && session[:registration][:path] && params['step']
session[:registration][:path] << params['step']
end
#end
{error: false, next_step: params[:cancel] ? 'cancel' : next_step}
end
def register
is_post = request.post? || session[:registration_step]
set_conference
if !@conference.registration_open
do_404
return
end
data = register_submit
@register_step = request.post? ? data[:next_step] : 'register'
@register_step = is_post ? data[:next_step] : 'register'
@error_message = data[:error] ? data[:message] : nil
template = (@register_step == 'register' ? '' : 'register_') + @register_step
if !File.exists?(Rails.root.join("app", "views", params[:controller], "_#{template}.html.haml"))
do_404
return
end
if session[:registration]
session[:registration][@register_step.to_sym] ||= Hash.new
end
@actions = nil
@multipart = false
case @register_step
when 'register'
when 'register', 'organizations', 'new_organization', 'new_workshop', 'volunteer_questions'
@actions = :next
when 'primary', 'organizations', 'new_organization', 'new_workshop', 'volunteer_questions'
@actions = [:previous, :cancel, :next]
if @register_step == 'new_organization'
@multipart = true
end
when 'thanks'
@registration = ConferenceRegistration.find(session[:registration][:registration_id])
if @registration.is_confirmed.blank?
@actions = :resend_confirmation_email
end
next_step = 'thanks'
#if @registration.complete && @registration.is_participant && @registration.payment_info.nil?
#` @actions = [:submit_payment]
when 'primary'
@actions = [:cancel, :next]
when 'submit'
@actions = [:previous, :cancel, :submit]
@actions = [:cancel, :submit]
when 'cancel'
@actions = [:no, :yes]
when 'already_registered'
@registration = ConferenceRegistration.find_by(:email => session[:registration][:email])
if !@registration.complete
@actions = :resend_confirmation_email
end
when 'questions'
@actions = [:previous, :cancel, :next]
@actions = [:cancel, :submit]
@housing_options = {
'I will fend for myself thanks' => 'none',
'I will need a real bed' => 'bed',
@@ -342,13 +431,17 @@ class ConferencesController < ApplicationController
session[:registration][:questions][:housing] ||= 'couch'
@loaner_bike_options = {
'No' => 'no',
'Yes' => 'medium',
'Yes, an average size should do' => 'medium',
'Yes but a small one please' => 'small',
'Yes but a large one please' => 'large'
}
session[:registration][:questions][:loaner_bike] ||= 'medium'
session[:registration][:questions][:diet] ||= Hash.new
#session[:registration][:questions][:diet] ||= Hash.new
end
#puts ' ------yyyy----------------- '
#puts @register_step
if request.xhr?
@register_content = render_to_string :partial => template
render :json => {status: 200, html: @register_content}
@@ -358,6 +451,94 @@ class ConferencesController < ApplicationController
end
end
def register_confirm
set_conference
@conference_registration = ConferenceRegistration.find_by(confirmation_token: params[:confirmation_token])
if !@conference_registration.nil? && @conference_registration.conference_id == @conference.id && !@conference_registration.complete
@conference_registration.is_confirmed = true
@conference_registration.save!
session[:registration] = YAML.load(@conference_registration.data)
session[:registration][:path] = Array.new
session[:registration][:registration_id] = @conference_registration.id
session[:registration_step] = 'confirm'
redirect_to action: 'register'
else
do_404
end
end
def register_pay_registration
set_conference
@conference_registration = ConferenceRegistration.find_by(confirmation_token: params[:confirmation_token])
if !@conference_registration.nil? && @conference_registration.conference_id == @conference.id && @conference_registration.complete
if params[:payment_amount].nil?
session[:registration] = YAML.load(@conference_registration.data)
session[:registration][:registration_id] = @conference_registration.id
session[:registration][:path] = Array.new
session[:registration_step] = 'pay_now'
redirect_to action: 'register'
else
host = "#{request.protocol}#{request.host_with_port}"
begin
paypal_info = get_secure_info(:paypal)
request = Paypal::Express::Request.new(
:username => paypal_info[:username].strip!,
:password => paypal_info[:password].strip!,
:signature => paypal_info[:signature].strip!
)
payment_request = Paypal::Payment::Request.new(
:currency_code => 'USD', # if nil, PayPal use USD as default
:description => 'Conference Registration', # item description
:quantity => 1, # item quantity
:amount => params[:payment_amount].to_f, # item value
:custom_fields => {
CARTBORDERCOLOR: "00ADEF",
LOGOIMG: "https://cdn.bikebike.org/assets/bblogo.png"
}
)
response = request.setup(
payment_request,
host + (@conference.url + "/register/confirm-payment/#{@conference_registration.payment_confirmation_token}/").gsub(/\/\/+/, '/'),
host + (@conference.url + "/register/cancel-payment/#{@conference_registration.confirmation_token}/").gsub(/\/\/+/, '/')
)
redirect_to response.redirect_uri
rescue Exception => e
ddd
end
end
else
do_404
end
end
def register_confirm_payment
set_conference
@conference_registration = ConferenceRegistration.find_by(payment_confirmation_token: params[:confirmation_token])
if !@conference_registration.nil? && @conference_registration.conference_id == @conference.id && @conference_registration.complete && @conference_registration.payment_info.nil?
@conference_registration.payment_info = "#{params[:PayerID]}:#{params[:token]}"
@conference_registration.save!
session[:registration] = YAML.load(@conference_registration.data)
session[:registration][:registration_id] = @conference_registration.id
session[:registration][:path] = Array.new
session[:registration_step] = 'payment-confirmed'
redirect_to action: 'register'
else
do_404
end
end
def register_cancel_payment
set_conference
@conference_registration = ConferenceRegistration.find_by(confirmation_token: params[:confirmation_token])
if !@conference_registration.nil? && @conference_registration.conference_id == @conference.id && @conference_registration.complete && @conference_registration.payment_info.nil?
session[:registration] = YAML.load(@conference_registration.data)
session[:registration][:registration_id] = @conference_registration.id
session[:registration][:path] = Array.new
session[:registration_step] = 'payment-cancelled'
redirect_to action: 'register'
end
end
def register_step
set_conference
data = params
@@ -456,4 +637,133 @@ class ConferencesController < ApplicationController
end
end
end
def update_registration_data
if session[:registration][:registration_id]
registration = ConferenceRegistration.find(session[:registration][:registration_id])
registration.data = YAML.load(registration.data).merge(session[:registration]).to_yaml
registration.save!
end
end
def complete_registration
if session[:registration][:registration_id]
registration = ConferenceRegistration.find(session[:registration][:registration_id])
session[:registration] = YAML.load(registration.data)
registration.completed = true
if registration.is_confirmed
registration.complete = true
user = User.find_by(:email => session[:registration][:email])
if !user
user = User.new(:email => session[:registration][:email], :username => session[:registration][:user][:username], :role => 'user')
end
user.firstname = session[:registration][:user][:firstname]
user.lastname = session[:registration][:user][:lastname]
user.save!
if session[:registration][:is_participant]
UserOrganizationRelationship.destroy_all(:user_id => user.id)
session[:registration][:organizations].each { |org_id|
found = false
org = Organization.find(org_id.is_a?(Array) ? org_id.first : org_id)
org.user_organization_relationships.each {|rel| found = found && rel.user_id == user.id}
if !found
org.user_organization_relationships << UserOrganizationRelationship.new(:user_id => user.id, :relationship => UserOrganizationRelationship::Administrator)
end
org.save!
}
if session[:registration][:new_organization]
session[:registration][:new_organization].each { |new_org|
found = false
org = Organization.find_by(:email_address => new_org[:email])
if org.nil?
org = Organization.new(
:name => new_org[:name],
:email_address => new_org[:email],
:info => new_org[:info]
)
org.locations << Location.new(:country => new_org[:country], :territory => new_org[:territory], :city => new_org[:city], :street => new_org[:street])
end
org.user_organization_relationships.each {|rel| found = found && rel.user_id == user.id}
if !found
org.user_organization_relationships << UserOrganizationRelationship.new(:user_id => user.id, :relationship => UserOrganizationRelationship::Administrator)
end
org.save!
org.avatar = "#{request.protocol}#{request.host_with_port}/#{new_org[:logo]}"
cover = get_panoramio_image(org.locations.first)
org.cover = cover[:image]
org.cover_attribution_id = cover[:attribution_id]
org.cover_attribution_user_id = cover[:attribution_user_id]
org.cover_attribution_name = cover[:attribution_user_name]
org.cover_attribution_src = cover[:attribution_src]
org.save!
}
end
if session[:registration][:is_workshop_host] && session[:registration][:workshop]
session[:registration][:workshop].each { |new_workshop|
workshop = Workshop.new(
:conference_id => @conference.id,
:title => new_workshop[:title],
:info => new_workshop[:info],
:workshop_stream_id => WorkshopStream.find_by(:slug => new_workshop[:stream]).id,
:workshop_presentation_style => WorkshopPresentationStyle.find_by(:slug => new_workshop[:presentation_style])
)
workshop.workshop_facilitators << WorkshopFacilitator.new(:user_id => user.id)
workshop.save!
}
end
end
send_confirmation_confirmation(registration, session[:registration])
session.delete(:registration)
session[:registration] = Hash.new
session[:registration][:registration_id] = registration.id
end
registration.save!
end
end
def create_registration
if !session[:registration][:registration_id]
registration = ConferenceRegistration.new(
:conference_id => @conference.id,
:user_id => session[:registration][:user][:id],
:email => session[:registration][:email],
:is_attending => 'yes',
:is_participant => session[:registration][:is_participant],
:is_volunteer => session[:registration][:is_volunteer],
:is_confirmed => false,
:complete => false,
:completed => false,
:confirmation_token => rand_hash(32, :conference_registration, :confirmation_token),
:payment_confirmation_token => rand_hash(32, :conference_registration, :payment_confirmation_token),
:data => session[:registration].to_yaml
)
registration.save!
session[:registration][:registration_id] = registration.id
send_confirmation(registration, session[:registration])
end
end
def send_confirmation(registration = nil, data = nil)
registration ||= ConferenceRegistration.find(session[:registration][:registration_id])
data ||= YAML.load(registration.data)
UserMailer.conference_registration_email(@conference, data, registration).deliver
end
def send_confirmation_confirmation(registration = nil, data = nil)
registration ||= ConferenceRegistration.find(session[:registration][:registration_id])
data ||= YAML.load(registration.data)
UserMailer.conference_registration_confirmed_email(@conference, data, registration).deliver
end
def send_payment_received(registration = nil, data = nil)
registration ||= ConferenceRegistration.find(session[:registration][:registration_id])
data ||= YAML.load(registration.data)
UserMailer.conference_registration_payment_received(@conference, data, registration).deliver
end
end
+2 -2
View File
@@ -22,8 +22,8 @@ class OrganizationsController < ApplicationController
if !@organizations.has_key?(country.name)
@organizations[country.name] = Hash.new
end
territory = country.subregions.coded(location.territory)
territory_name = territory ? territory.name : 0
territory = country.subregions? ? country.subregions.coded(location.territory) : nil
territory_name = territory.nil? ? 0 : territory.name
if !@organizations[country.name].has_key?(territory_name)
@organizations[country.name][territory_name] = Hash.new
end
+11 -11
View File
@@ -1,12 +1,12 @@
include ApplicationHelper
class PagesController < ApplicationController
protect_from_forgery :except => :location_territories
protect_from_forgery :except => :location_territories
#skip_before_filter :verify_authenticity_token, only: [:translate]
def home
@conferences = Conference.all
@conference = Conference.find(:first, :order => "start_date DESC")
#@conferences = Conference.all
@conference = Conference.order("start_date DESC").first
end
def resources
@@ -51,23 +51,23 @@ class PagesController < ApplicationController
#render json: (Carmen:::RegionCollection.new(Carmen::Country.coded(params[:country])) || []).to_json
territories = {}
country = Carmen::Country.coded(params[:country])
if country
country.subregions.each { |t| territories[t.code] = t.name }
end
if country
country.subregions.each { |t| territories[t.code] = t.name }
end
render json: territories.to_json
end
def translations
if !current_user
raise ActiveRecord::PremissionDenied
end
#if !current_user
# raise ActiveRecord::PremissionDenied
#end
@lang = params[:lang]
@translations = I18n.backend.get_translation_info
@translations = is_test? ? {} : I18n.backend.get_translation_info
I18n.config.enforce_available_locales = false
end
def translation_list
if !current_user
if !current_user && is_production?
raise ActiveRecord::PremissionDenied
end
total = 0
+68 -1
View File
@@ -9,6 +9,8 @@ module ApplicationHelper
@@banner_image = nil
@@has_content = true
@@front_page = false
@@body_class = nil
@@test_location = nil
def init_vars
@@keyQueue = nil
@@ -20,6 +22,7 @@ module ApplicationHelper
@@banner_image = nil
@@has_content = true
@@front_page = false
@@body_class = nil
end
def this_is_the_front_page
@@ -100,6 +103,11 @@ module ApplicationHelper
content_for(:dom_ready, &block)
end
def body_class(c)
@@body_class ||= Array.new
@@body_class << (c.is_a?(Array) ? c.join(' ') : c)
end
def page_style(style)
classes = ['page-style-' + style.to_s]
#if @@no_banner
@@ -114,6 +122,9 @@ module ApplicationHelper
if @@banner_image
classes << 'has-banner-image'
end
if @@body_class
classes << @@body_class.join(' ')
end
if params[:controller]
classes << params[:controller]
@@ -440,7 +451,9 @@ module ApplicationHelper
end
def lookup_ip_location
if request.remote_ip == '127.0.0.1'
if is_test? && ApplicationController::get_location.present?
Geocoder.search(ApplicationController::get_location).first
elsif request.remote_ip == '127.0.0.1'
Geocoder.search(session['remote_ip'] || (session['remote_ip'] = open("http://checkip.dyndns.org").first.gsub(/^.*\s([\d\.]+).*$/s, '\1').gsub(/[^\.\d]/, ''))).first
else
request.location
@@ -492,6 +505,10 @@ module ApplicationHelper
Rails.env == 'production'
end
def is_test?
Rails.env == 'test'
end
def subdomain
request.env['SERVER_NAME'].gsub(/^(\w+)\..*$/, '\1')
end
@@ -505,6 +522,56 @@ module ApplicationHelper
location.city + (territory ? ' ' + territory.name : '') + ', ' + Carmen::Country.coded(location.country).name
end
def rand_hash(length = 16, model = nil, field = nil)
if field
hash = rand_hash(length)
while !model.to_s.to_s.singularize.classify.constantize.find_by(field => hash).nil?
hash = rand_hash(length)
end
end
rand(36**length).to_s(36)
end
def get_panoramio_image(location)
if is_test?
params[:image] = 'panoramio.jpg'
params[:attribution_id] = 1234
params[:attribution_user_id] = 5678
params[:attribution_name] = 'Some Guy'
params[:attribution_src] = 'panoramio'
return params
end
location = location.city + ', ' + (location.territory ? location.territory + ' ' : '') + location.country
$panoramios ||= Hash.new
$panoramios[location] ||= 0
$panoramios[location] += 1
result = Geocoder.search(location).first
if result
points = Geocoder::Calculations.bounding_box([result.latitude, result.longitude], 5, { :unit => :km })
options = {:set => :public, :size => :original, :from => 0, :to => 20, :mapfilter => false, :miny => points[0], :minx => points[1], :maxy => points[2], :maxx => points[3]}
url = 'http://www.panoramio.com/map/get_panoramas.php?' + options.to_query
response = JSON.parse(open(url).read)
response['photos'].each { |img|
if img['width'].to_i > 980
if Organization.find_by(:cover_attribution_id => img['photo_id'], :cover_attribution_src => 'panoramio').nil? && Conference.find_by(:cover_attribution_id => img['photo_id'], :cover_attribution_src => 'panoramio').nil?
params[:image] = img['photo_file_url']
params[:attribution_id] = img['photo_id']
params[:attribution_user_id] = img['owner_id']
params[:attribution_name] = img['owner_name']
params[:attribution_src] = 'panoramio'
return params
end
end
}
end
return nil
end
def get_secure_info(name)
YAML.load(File.read(Rails.root.parent.join("secure/#{name.to_s}.yml")))[Rails.env].symbolize_keys
end
private
def _form_field(type, name, value, options)
if type == 'check_box'
+13 -3
View File
@@ -1,5 +1,5 @@
class UserMailer < ActionMailer::Base
default from: "noreply@bikebike.org"
default from: "Bike!Bike! <noreply@bikebike.org>"
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
@@ -23,9 +23,19 @@ class UserMailer < ActionMailer::Base
mail to: "to@example.org"
end
def conference_registration_email(conference, data)
def conference_registration_email(conference, data, conference_registration)
@data = data
@conference = conference
@url = "https://bikebike.org"#UserMailer.default_url_options[:host]
@confirmation_url = UserMailer.default_url_options[:host] + "/#{@conference.url}/register/confirm/#{conference_registration.confirmation_token}/".gsub(/\/\/+/, '/')
mail to: data[:email], subject: (_'register.email.registration.subject',"Please confirm your registration for #{conference.title}", vars: {:conference_title => conference.title})
end
def conference_registration_confirmed_email(conference, data, conference_registration)
@data = data
@conference = conference
mail to: data[:email], subject: 'Please confirm your registration for ' + conference.title
@url = "https://bikebike.org"#UserMailer.default_url_options[:host]
@confirmation_url = UserMailer.default_url_options[:host] + "/#{@conference.url}/register/pay-registration/#{conference_registration.confirmation_token}/".gsub(/\/\/+/, '/')
mail to: data[:email], subject: (_'register.email.registration_confirmed.subject',"Thanks for confirming your registration for #{conference.title}", vars: {:conference_title => conference.title})
end
end
+2 -2
View File
@@ -7,8 +7,8 @@ class Conference < ActiveRecord::Base
has_many :conference_host_organizations, :dependent => :destroy
has_many :organizations, :through => :conference_host_organizations
has_many :conference_registration_form_fields, :order => 'position ASC', :dependent => :destroy#, :class_name => '::ConferenceRegistrationFormField'
has_many :registration_form_fields, :through => :conference_registration_form_fields
#has_many :conference_registration_form_fields, :order => 'position ASC', :dependent => :destroy#, :class_name => '::ConferenceRegistrationFormField'
#has_many :registration_form_fields, :through => :conference_registration_form_fields
has_many :workshops
+3 -2
View File
@@ -1,9 +1,10 @@
class Location < ActiveRecord::Base
#attr_accessible :title, :country, :territory, :city, :street, :postal_code, :latitude, :longitude
has_many :locations_organization
has_many :organizations, :through => :locations_organization
has_many :locations_organization
has_many :organizations, :through => :locations_organization
geocoded_by :full_address
reverse_geocoded_by :latitude, :longitude, :address => :full_address
after_validation :geocode, if: ->(obj){ obj.country_changed? or obj.territory_changed? or obj.city_changed? or obj.street_changed? or obj.postal_code_changed? }
+30
View File
@@ -11,6 +11,7 @@ class Organization < ActiveRecord::Base
accepts_nested_attributes_for :locations, :reject_if => proc {|l| l[id].blank?}
accepts_nested_attributes_for :user_organization_relationships, :reject_if => proc {|u| u[:user_id].blank?}, :allow_destroy => true
before_create :make_slug
def location
locations.first
@@ -28,4 +29,33 @@ class Organization < ActiveRecord::Base
slug
end
def generate_slug(name, location = nil)
s = name.gsub(/[^a-z1-9]+/i, '-').chomp('-').gsub(/\-([A-Z])/, '\1')
if Organization.find_by(:slug => s).present? && !location.nil?
if location.city.present?
s += '-' + location.city
end
if Organization.find_by(:slug => s).present? && location.territory.present?
s += '-' + location.territory
end
if Organization.find_by(:slug => s).present?
s += '-' + location.country
end
end
attempt = 1
ss = s
while Organization.find_by(:slug => s)
attempt += 1
s = ss + '-' + attempt.to_s
end
s
end
private
def make_slug
if !self.slug
self.slug = generate_slug(self.name, self.locations && self.locations[0])
end
end
end
+2 -2
View File
@@ -3,8 +3,8 @@ class User < ActiveRecord::Base
config.authentications_class = Authentication
end
validates :password, presence: true, confirmation: true, length: { minimum: 3 }, unless: ("id?" || "password_confirmation?")
validates :password_confirmation, presence: true, unless: ("id?" || "password?")
#validates :password, presence: true, confirmation: true, length: { minimum: 3 }, unless: ("id?" || "password_confirmation?")
#validates :password_confirmation, presence: true, unless: ("id?" || "password?")
validates :email, uniqueness: true
+30
View File
@@ -1,7 +1,37 @@
class Workshop < ActiveRecord::Base
belongs_to :conference
has_many :workshop_facilitators, :dependent => :destroy
has_many :users, :through => :workshop_facilitators
accepts_nested_attributes_for :workshop_facilitators, :reject_if => proc {|u| u[:user_id].blank?}, :allow_destroy => true
before_create :make_slug
def to_param
slug
end
private
def make_slug
if !self.slug
s = self.title.gsub(/[^a-z1-9]+/i, '-').chomp('-').gsub(/\-([A-Z])/, '\1')
if Organization.find_by(:slug => s) && self.locations && self.locations[0]
s += '-' + self.locations[0].city
if Organization.find_by(:slug => s) && locations[0].territory
s += '-' + self.locations[0].territory
end
if Organization.find_by(:slug => s)
s += '-' + self.locations[0].country
end
end
attempt = 1
ss = s
while Organization.find_by(:slug => s)
attempt += 1
s = ss + '-' + attempt
end
self.slug = s
end
end
end
+32 -8
View File
@@ -1,12 +1,16 @@
- banner_image @conference.cover_url, id: @conference.cover_attribution_id, name: @conference.cover_attribution_name, user_id: @conference.cover_attribution_user_id, src: @conference.cover_attribution_src
- small_banner = (params['controller'] == 'conferences' && params['action'] != 'show')
- if small_banner
- body_class('small-banner')
- page_style (params['controller'] == 'conferences' ? 'article' : 'emphasize-banner')
- content_for :banner do
.row
.columns.small-12.banner
%figure
%img{src: @conference.poster.full.url}
.columns.medium-8.align-bottom
- if !small_banner
.columns.small-12.banner
%figure
%img{src: @conference.poster.full.url}
.columns.medium-7.align-bottom
- title = @conference.conference_type.slug == 'bikebike' ? 'Bike!Bike! '+@conference.start_date.year.to_s : @conference.title
%div
%h1
@@ -33,11 +37,31 @@
= info.html_safe
- else
%p= ActionView::Base.full_sanitizer.sanitize(@conference.info).gsub(/^(.{300,350}\.)(.*)$/m, '\1...')
.columns.medium-4.centered.align-bottom
.columns.medium-5.centered.align-bottom.buttons
%div
- if @conference.registration_open
%a.button.arrow-r{href: @conference.url(:register)}
=_'conference.Register_Now'
- if params['controller'] != 'conferences'
%a.button.more{href: @conference.url}
=_'conference.More_Info'
- if @conference.registration_open && !small_banner
%a.button#register-now{href: @conference.url(:register)}
=_'conference.Register_Now'
#register-dlg
= form_tag (@conference.url + '/register/').gsub(/\/\/+/, '/'), :method => :post do
= hidden_field_tag :step, 'register'
= email_field_tag :email
= form_actions :register
- if !small_banner && @conference.registration_open
- content_for :dom_ready do
:plain
$('#register-now').click(function(e) {
e.preventDefault();
if ($('#register-dlg').hasClass('open')) {
$('#register-dlg form').submit();
}
$('#register-dlg').toggleClass('open');
});
$('#register-dlg').click(function(e) {
if ($(e.target).attr('id') == 'register-dlg') {
$('#register-dlg').toggleClass('open');
}
});
@@ -1 +1,2 @@
= email_field_tag :email, session[:registration][:email]
@@ -0,0 +1,14 @@
- if @registration.complete
%h3=_'registration.already_registered.complete.title','You Have Already Registered'
.columns.medium-10.medium-offset-1.end
%p.help
=_'registration.already_registered.complete.help','There\'s nothing more to do, you have already registered so we\'ll see you in '
= @conference.organizations.first.locations.first.city
- elsif @registration.is_confirmed
%h3=_'registration.already_registered.confirmed.title','You\'re Already Registered but we are missing some Information'
.columns.medium-10.medium-offset-1.end
%p.help=_'registration.already_registered.complete.help','You\'re already set to go but we had a few more questions for you. If you need us to resed your confirmation, just click the button below.'
- else
%h3=_'registration.already_registered.not_confirmed.title','We\'re awaiting your Confirmation'
.columns.medium-10.medium-offset-1.end
%p.help=_'registration.already_registered.not_confirmed.help','You already sent us the information we need but we need you to confirm. If you don\'t have the email anymore, we can resend it to you.'
@@ -2,16 +2,17 @@
= hidden_field_tag :new_org_index, org_index
- if session[:registration][:new_organization].length > 1
%h3=_'registration.new_organization.list.title','Your New Organizations'
%ul.columns.medium-10.medium-offset-1
%ul.columns.medium-11.medium-offset-1.end
- session[:registration][:new_organization].each_with_index do |new_organization, index|
- if new_organization[:title]
- if new_organization[:name]
%li
- if index == org_index && new_organization[:title]
%strong=new_organization[:title]
- if index == org_index && new_organization[:name]
%strong=new_organization[:name]
- else
= new_organization[:title]
= new_organization[:name]
%h3=_'registration.new_organization.title','Your Organization Information'
.columns.medium-12= text_field_tag :organization_name, session[:registration][:new_organization][org_index][:name], :required => true
.columns.medium-12
= text_field_tag :organization_name, session[:registration][:new_organization][org_index][:name], :required => true
.columns.medium-12= text_area_tag :organization_info, session[:registration][:new_organization][org_index][:info], :data => {:editor => ""}
.columns.medium-7
= email_field_tag :organization_email, session[:registration][:new_organization][org_index][:email], :required => true
@@ -20,7 +21,7 @@
= country_select_tag :organization_country, session[:registration][:new_organization][org_index][:country], :required => true
= subregion_select_tag :organization_territory, session[:registration][:new_organization][org_index][:territory], session[:registration][:new_organization][org_index][:country] || 'US', html: {class: session[:registration][:new_organization][org_index][:country] ? 'can' : 'cant', data: {:country => session[:registration][:new_organization][org_index][:country]}}
.columns.medium-5
= image_field_tag :organization_logo
= image_field_tag :logo
.columns
= check_box_tag :add_another_org, (org_index <= session[:registration][:new_organization].length - 1)
@@ -14,11 +14,11 @@
.columns.medium-10.medium-offset-1= text_field_tag :workshop_title, session[:registration][:workshop][workshop_index][:title], :required => true
.columns.medium-10.medium-offset-1= text_area_tag :workshop_info, session[:registration][:workshop][workshop_index][:info], :required => true, :data => {:editor => ""}
.columns.medium-5.medium-offset-1
%h4=_'registration.workshop.streams.title','Stream'
%p.help=_'registration.workshop.streams.help','Select the stream that best categorizes your workshop'
%h4=_'registration.workshop.streams.title','Themes'
%p.help=_'registration.workshop.streams.help','Select the theme that best categorizes your workshop'
- streams = Hash.new
- streams[_'workshop_stream.select_one','Select a stream'] = ''
- WorkshopStream.all.each do |stream|
- streams[_'workshop_stream.select_one','Select a theme'] = ''
- WorkshopStream.order('"order" ASC').each do |stream|
- streams[_'workshop_stream.' + stream.slug] = stream.slug
= select_tag :workshop_stream, options_for_select(streams, session[:registration][:workshop][workshop_index][:stream] || '')
.columns.medium-5.end
@@ -26,12 +26,15 @@
%p.help=_'registration.workshop.styles.help','Select the style that best describes how you will run your workshop'
- styles = Hash.new
- styles[_'workshop_presentation_style.select_one','Select a style'] = ''
- WorkshopPresentationStyle.all.each do |style|
- WorkshopPresentationStyle.order('"order" ASC').each do |style|
- styles[_'workshop_presentation_style.' + style.slug] = style.slug
= select_tag :workshop_presentation_style, options_for_select(styles, session[:registration][:workshop][workshop_index][:presentation_style] || '')
.columns.medium-10.medium-offset-1.end
%h4=_'registration.workshop.notes.title','Additional notes for Organizers'
%p=_'registration.workshop.notes.help','Anything else that the conference organizers should know? Is anyone helping you facilitate?'
= text_area_tag :workshop_notes, session[:registration][:workshop][workshop_index][:notes], :label => false
.columns.medium-10.medium-offset-1
- #xx
= check_box_tag :add_another_workshop, "1", (workshop_index < session[:registration][:workshop].length - 1)
- content_for :footer_scripts do
= javascript_include_tag 'editor'
= javascript_include_tag 'editor'
@@ -1,3 +1,11 @@
- registration = ConferenceRegistration.find(session[:registration][:registration_id])
- if registration && registration.is_confirmed
%h3=_'register.organizations.confirm_thanks.title','Thanks for confirming!'
- if session[:registration][:is_workshop_host]
%p=_'register.organizations.confirm_thanks.is_workshop_host.help','Before you finish, we would just like to find out where you\'re coming from and get some info about your workshop.'
- else
%p=_'register.organizations.confirm_thanks.is_not_workshop_host.help','Before you finish, we would just like to find out where you\'re coming from.'
%p=_'register.organizations.confirm_thanks.payment_notice','After that you will also be able to pay for registration.'
%h3
=_'register.organizations.title','Who do you Represent?'
%p=_'register.organizations.description','Please let us know where you\'re coming from! Find your organizations on the right, they are listed by how close they are to you right now.'
@@ -8,8 +16,6 @@
- my_location = lookup_ip_location
- lids = Location.near(my_location.latitude.to_s+', '+my_location.longitude.to_s, 999999, order: 'distance').map{|l|l.id}
- orgs = Hash.new
-# orgs = Organization.joins(:locations_organization).where('locations_organizations.location_id' => lids)
-# orgs.each do |org|
- lids.each do |lid|
- org = Organization.joins(:locations_organization).where('locations_organizations.location_id' => lid).first
- if org && !orgs.has_key?(org.id)
@@ -6,5 +6,5 @@
.columns
%h3=_'registration.primary.role_title','Attending as:'
.columns.small-offset-1
= check_box_tag :is_participant, session[:registration][:is_participant]
= check_box_tag :is_volunteer, session[:registration][:is_volunteer]
= check_box_tag :is_participant, 'true', session[:registration][:is_participant]
= check_box_tag :is_volunteer, 'true', session[:registration][:is_volunteer]
@@ -13,19 +13,19 @@
.columns.medium-8.medium-offset-2.end
= select_tag '[questions][loaner_bike]', options_for_select(@loaner_bike_options, session[:registration][:questions][:loaner_bike])
-#.columns.medium-offset-1.end
-# %h4=_'registration.questions.diet','We\'ll be serving some food. Do you have any dietary restrictions?'
-#.columns.medium-8.medium-offset-2.end
-# = check_box_tag '[questions][diet][no_meat]', session[:registration][:questions][:diet][:no_meat]
-# = check_box_tag '[questions][diet][no_dairy]', session[:registration][:questions][:diet][:no_dairy]
-# = check_box_tag '[questions][diet][no_animal_products]', session[:registration][:questions][:diet][:no_animal_products]
-# = check_box_tag '[questions][diet][no_gluten]', session[:registration][:questions][:diet][:no_gluten]
-# = check_box_tag '[questions][diet][no_nuts]', session[:registration][:questions][:diet][:no_nuts]
-# %h5=_'registration.questions.diet_extra.title','Anything else?'
-# = text_area_tag '[questions][diet][diet_extra]', session[:registration][:questions][:diet_extra], :label => false
.columns.medium-offset-1.end
%h4=_'registration.questions.diet','We\'ll be serving some food. Do you have any dietary restrictions?'
.columns.medium-8.medium-offset-2.end
= check_box_tag '[questions][diet][no_meat]', session[:registration][:questions][:diet][:no_meat]
= check_box_tag '[questions][diet][no_dairy]', session[:registration][:questions][:diet][:no_dairy]
= check_box_tag '[questions][diet][no_animal_products]', session[:registration][:questions][:diet][:no_animal_products]
= check_box_tag '[questions][diet][no_gluten]', session[:registration][:questions][:diet][:no_gluten]
= check_box_tag '[questions][diet][no_nuts]', session[:registration][:questions][:diet][:no_nuts]
%h5=_'registration.questions.diet_extra.title','Anything else?'
= text_area_tag '[questions][diet][diet_extra]', session[:registration][:questions][:diet_extra], :label => false
.columns.medium-offset-1.end
%h4=_'registration.questions.workshop','Would you ilke to host a workshop?'
%p.help=_'registration.questions.workshop.help','Did you have an idea for a workshop that you\d like to help run? If so, we\'ll ask some follow-up questions on the following page.'
%h4=_'registration.questions.workshop','Would you like to host a workshop?'
%p.help=_'registration.questions.workshop.help','Did you have an idea for a workshop that you\'d like to help run? If so, we\'ll ask some follow-up questions later on.'
.columns.medium-8.medium-offset-2.end
= select_tag :is_workshop_host, options_for_select({(_'Yes') => 1, (_'No') => 0}, session[:registration][:is_workshop_host] || 0)
.columns.medium-offset-1.end
@@ -1,6 +1,25 @@
%h3=_'registration.thanks.title','Thanks for submitting your registration'
.columns.medium-offset-1.end
%h4=_'registration.thanks.remember_to_confirm','Remember to confirm your registration upon receiving the confirmation email'
%p.help
=_'registration.thanks.remember_to_confirm.help','If you experience any technical issues, please contact Godwin directly at'
%a{href: 'mailto:goodgodwin@hotmail.com'}='goodgodwin@hotmail.com'
- if @registration && @registration.complete
- city = @conference.organizations.first.locations.first.city
%h3=_'registration.thanks.complete.title','Thanks for completing your registration'
.columns
- if !@registration.is_participant
%p=_'registration.thanks.all_done.volunteer','Thanks for submitting your volunteer infomation. We\'ll see you at Bike!Bike!'
- elsif @registration.payment_info.nil?
%p=_'registration.thanks.all_done.please_pay',"Thank you for completing your registration. We'll see you at Bike!Bike! If you have not already done so, we ask that you pay the registration donation as soon as you can."
= form_tag ("#{@conference.url}/register/pay-registration/#{@registration.confirmation_token}/").gsub(/\/\/+/, '/'), :method => :post, :class => 'row' do
= hidden_field_tag :confirmation_token, @registration.confirmation_token
.columns.small-4.small-offset-2
= number_field_tag :payment_amount, 25.00, :step => 0.01, :min => 0.01
.columns.small-4.end
= form_actions :submit_payment
- else
%p=_'registration.thanks.all_done.paid',"You're all done and paid up! We'll see you in #{city}.", vars: {:city => city}
%p=_'register.email.registration_confirmed.info',"We'll have housing, loaner bikes, and food arranged for your arrival. If you have any other questions or concerns, please email bikebike2014columbus@gmail.com."
%p=_'register.email.registration_confirmed.contact',"For urgent/emergency matters, you can reach our Outreach Coordinator, Reda, at 503-984-9191 or Jason at 614-364-3636."
- else
%h3=_'registration.thanks.title','Thanks for submitting your registration'
.columns
%h4=_'registration.thanks.remember_to_confirm','Remember to confirm your registration upon receiving the confirmation email. If you need it to be resent, just press the button below.'
%p.help
=_'registration.thanks.remember_to_confirm.help','If you experience any technical issues, please contact Godwin directly at'
%a{href: 'mailto:goodgodwin@hotmail.com'}='goodgodwin@hotmail.com'
@@ -6,25 +6,31 @@
= text_field_tag '[volunteer_questions][address]', session[:registration][:volunteer_questions][:address]
= text_field_tag '[volunteer_questions][phone_number]', session[:registration][:volunteer_questions][:phone_number]
-#.columns.medium-offset-1.end
-# %h4=_'registration.volunteer_questions.has_kitchen','Do have a kitchen / cook space to offer?'
-#.columns.medium-8.medium-offset-2.end
-# = select_tag '[volunteer_questions][has_kitchen]', options_for_select({(_'Yes') => 1, (_'No') => 0}, session[:registration][:volunteer_questions][:has_kitchen] || 0)
.columns.medium-offset-1.end
%h4=_'registration.volunteer_questions.has_kitchen','Do have a kitchen / cook space to offer?'
%h4=_'registration.volunteer_questions.tasks.title','How can you help out?'
.columns.medium-8.medium-offset-2.end
= select_tag '[volunteer_questions][has_kitchen]', options_for_select({(_'Yes') => 1, (_'No') => 0}, session[:registration][:volunteer_questions][:has_kitchen] || 0)
- session[:registration][:volunteer_questions][:tasks] ||= Hash.new
= check_box_tag '[volunteer_questions][tasks][cooking]', session[:registration][:volunteer_questions][:tasks][:cooking]
= check_box_tag '[volunteer_questions][tasks][manual_labour]', session[:registration][:volunteer_questions][:tasks][:manual_labour]
.columns.medium-offset-1.end
%h4=_'registration.volunteer_questions.has_housing','Do you have housing to offer for out of town attendees?'
.columns.medium-offset-2.medium-5
%h5=_'registration.volunteer_questions.beds','Spare Beds:'
.columns.medium-3.end
= number_field_tag '[volunteer_questions][beds]', session[:registration][:volunteer_questions][:beds] || 0, :label => false
= number_field_tag '[volunteer_questions][beds]', session[:registration][:volunteer_questions][:beds] || 0, :label => false, min: 0
.columns.medium-offset-2.medium-5
%h5=_'registration.volunteer_questions.couch_space','Number you can accomodate on couches/floor space:'
.columns.medium-3.end
= number_field_tag '[volunteer_questions][beds]', session[:registration][:volunteer_questions][:couch_space] || 0, :label => false
= number_field_tag '[volunteer_questions][couch_space]', session[:registration][:volunteer_questions][:couch_space] || 0, :label => false, min: 0
.columns.medium-offset-2.medium-5
%h5=_'registration.volunteer_questions.tents','Estimated number of tests you\'d be willing to have in your yard:'
.columns.medium-3.end
= number_field_tag '[volunteer_questions][tents]', session[:registration][:volunteer_questions][:tents] || 0, :label => false
= number_field_tag '[volunteer_questions][tents]', session[:registration][:volunteer_questions][:tents] || 0, :label => false, min: 0
.columns.medium-offset-1.end
%h4=_'registration.volunteer_questions.other','Anything else you\'d like to tell us?'
.columns.medium-8.medium-offset-2.end
+2 -5
View File
@@ -4,15 +4,12 @@
- title @conference.title
- description "#{@conference.title} conference in #{location_name} for DIY bicycle collectives, co-ops, and advocacy groups"
= render 'header'
=# tabs!
%article.row
.columns.large-10
- if @register_step
%h2='Register!'
%h2='Conference Registration'
- if @actions
= form_tag (@conference.url + '/register/').gsub(/\/\/+/, '/'), :method => :post do
= form_tag (@conference.url + '/register/').gsub(/\/\/+/, '/'), :method => :post, :multipart => @multipart do
= hidden_field_tag :step, @register_step
- if @error_message
.columns.medium-8.medium-centered
+9
View File
@@ -36,6 +36,15 @@
- if content_for?(:side_bar)
%aside#side-bar
= yield :side_bar
%form{action: 'https://www.paypal.com/cgi-bin/webscr', method: 'post', target: '_top'}
%input{type: 'hidden', name: 'cmd', value: '_donations'}
%input{type: 'hidden', name: 'business', value: 'info@thirdhand.org'}
%input{type: 'hidden', name: 'lc', value: 'US'}
%input{type: 'hidden', name: 'item_name', value: 'Bike!Bike!'}
%input{type: 'hidden', name: 'no_note', value: '0'}
%input{type: 'hidden', name: 'currency_code', value: 'USD'}
%button{type: 'submit', value: 'PP-DonationsBF:paypal_logo.png:NonHostedGuest'}=_'donate.button_label','Make a Donation!'
- if has_content?
#content=yield
- else
+76
View File
@@ -0,0 +1,76 @@
!!! Strict
%html{xmlns: "http://www.w3.org/1999/xhtml"}
%head
%meta{content: "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
%meta{content: "width=device-width, initial-scale=1.0", name: "viewport"}/
%title Your Message Subject or Title
:css
#outlook a {padding:0;}
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
.ExternalClass {width:100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
a img {border:none;}
.image_fix {display:block;}
p {margin: 1em 0;text-align:left;font-size: 1.25em}
h1, h2, h3, h4, h5, h6 {color: black !important;margin-bottom: 1.5em;line-height:1.5em}
h2 {text-align:left;font-size:1.3em;}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color: white !important;margin-bottom:1em}
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {color: white !important;}
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {color: white !important;}
table td {border-collapse: collapse;}
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
a {color: #00ADEF;}
@media only screen and (max-device-width: 480px) {
a[href^="tel"], a[href^="sms"] {
text-decoration: none;
color: #00ADEF;
pointer-events: none;
cursor: default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration: default;
color: #00ADEF !important;
pointer-events: auto;
cursor: default;
}
}
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
a[href^="tel"], a[href^="sms"] {
text-decoration: none;
color: blue; /* or whatever your want */
pointer-events: none;
cursor: default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration: default;
color: #00ADEF !important;
pointer-events: auto;
cursor: default;
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {}
@media only screen and (-webkit-device-pixel-ratio:.75){}
@media only screen and (-webkit-device-pixel-ratio:1){}
@media only screen and (-webkit-device-pixel-ratio:1.5){}
/[if IEMobile 7]
<style type="text/css">
</style>
/[if gte mso 9]
<style>
\/* Target Outlook 2007 and 2010 */
</style>
%body
%table#backgroundTable{border: "0", cellpadding: "0", cellspacing: "0"}
%tr
%td
%div{style:'width:100%;background-color:#00ADEF;padding: 25px 0 200px;text-align: center;'}
%div{style:'max-width:600px;border:3px solid #00ADEF;margin:25px auto;background-color:#FFF;display:inline-block;width:75%;'}
= yield
%div{style: 'text-align:center;padding-bottom:25px'}
%a{href: "#{@url}"}
2014 Bike!Bike!
+5
View File
@@ -0,0 +1,5 @@
='========== Bike!Bike! =========='
= yield
="===== #{@url} ======"
+9 -1
View File
@@ -1 +1,9 @@
404!d
- page_title = _'error.404.page_title.This_Page_Does_Not_Exist'
- title page_title
- banner_title page_title
.row
%h1
=_'error.404.title','This page does not exist!'
%p
=_'error.404.description', :p
@@ -0,0 +1,9 @@
- page_title = _'error.no_lang.page_title.Language_not_enabled'
- title page_title
- banner_title page_title
.row
%h1
=(_ 'language_not_yet_translated', vars: {:language => (_ ('languages.' + @lang))})
%p
=_'error.no_lang.description', :p
+3 -3
View File
@@ -1,9 +1,9 @@
- page_title = _'error.title.Permission_Denied'
- page_title = _'error.403.page_title.Permission_Denied'
- title page_title
- banner_title page_title
.row
%h1
='This page is inaccessible to you'
=_'error.403.title','This page is inaccessible to you'
%p
=_'error.desc.permission_denied', :p
=_'error.403.description', :p
+3 -3
View File
@@ -12,11 +12,11 @@
- if code && @completeness.has_key?(code.to_s)
%li.text-center
- completeness = @completeness[code.to_s]
- percent = @total_translations ? ((completeness / @total_translations.to_f) * 100).to_i : 0
%a{:href => "/translations/#{code}/", :class => (percent > 99 ? 'complete' : percent > 67 ? 'needs-work' : nil)}
-# percent = @total_translations ? ((completeness / @total_translations.to_f) * 100).to_i : 0
%a{:href => "/translations/#{code}/", :class => (completeness > 99 ? 'complete' : completeness > 67 ? 'needs-work' : nil)}
%h3=_"languages.#{code}"
.completeness
= "#{completeness} / #{@total_translations} (#{percent}%)"
= "#{completeness} / #{@total_translations} (#{completeness}%)"
%h2= _ 'languages.inactive'
%ul.languages.inactive.small-block-grid-1.medium-block-grid-3.large-block-grid-4.grid.links
- @language_codes.each do |code|
+9 -8
View File
@@ -11,10 +11,10 @@
%th.key=_'translations.Pages'
%th.key=_'translations.Value'
- @translations.sort{| a1, a2 | a1[0].downcase <=> a2[0].downcase}.each do |k,translation|
- current_translation = Translation.locale(@lang.to_sym).lookup(k)#[0].value #_ translation[0], :strict, locale: @lang.to_sym
- current_translation = Translation.locale(@lang.to_sym).lookup(k)
- current_translation = current_translation.size() > 0 ? current_translation = current_translation[0].value : nil
- cached = (translation['languages'] && translation['languages'].include?(@lang))
- vars = translation.has_key?('vars') && translation['vars'].size() > 0 ? translation['vars'] : nil
- cached = (translation && translation['languages'] && translation['languages'].include?(@lang))
- vars = translation && translation.has_key?('vars') && translation['vars'].size() > 0 ? translation['vars'] : nil
- (vars && vars.include?(:count) ? I18n.backend.get_pluralization_rules(@lang) : [nil]).each do |pluralization|
- key = k + (pluralization ? ".#{pluralization.to_s}" : '')
%tr{:class => current_translation ? 'exists' : 'not-exists', :data => {:key => key}}
@@ -28,9 +28,10 @@
%li=v
%td.pages
%ul
- translation['pages'].each do |page|
%li
%a{:href => page}=page
- if translation
- translation['pages'].each do |page|
%li
%a{:href => page}=page
%td.value.primary
- if current_translation
= current_translation
@@ -43,5 +44,5 @@
- unless current_translation
%a{:href => '#', :class => 'auto-translate button small'}='Auto'
-# content_for :footer_scripts
= javascript_include_tag 'translations'
- content_for :footer_scripts do
= javascript_include_tag 'translations'
@@ -0,0 +1,10 @@
%img{src: "#{@url}/#{@conference.poster.full.url}", style: "max-width: 100%;"}
%div{style: 'padding: 25px'}
%h1=_'register.email.registration_confirmed.thank_you',"Hi #{@data[:user][:username]}, thank you for completing your registration. We'll see you at Bike!Bike!"
%h2=_'register.email.registration_confirmed.please_pay',"If you have not already done so, we ask that you pay the registration donation as soon as you can. At your convenience please visit the link below."
%div{style: 'text-align:center'}
%h1{style: 'background-color:#F11845;text-align:center;display:inline-block;padding: 5px 20px 10px;'}
%a{href: @confirmation_url, style: 'color:#FFF;text-decoration:none;'}
=_'register.email.registration_confirmed.pay_now',"Pay Registration Fees"
%p=(_'register.email.registration_confirmed.info',"We'll have housing, loaner bikes, and food arranged for your arrival. If you have any other questions or concerns, please email bikebike2014columbus@gmail.com").gsub(/(\w+@\w+\.\w{2,3})/, '<a href="mailto:\1">\1</a>').html_safe
%p=_'register.email.registration_confirmed.contact',"For urgent/emergency matters, you can reach our Outreach Coordinator, Reda, at 503-984-9191 or Jason at 614-364-3636."
@@ -0,0 +1,9 @@
=_'register.email.registration_confirmed.thank_you',"Hi #{@data[:user][:username]}, thank you for completing your registration. We'll see you at Bike!Bike!"
=_'register.email.registration_confirmed.please_pay',"If you have not already done so, we ask that you pay the registration donation as soon as you can. At your convenience please visit the link below."
= @confirmation_url
=_'register.email.registration_confirmed.info',"We'll have housing, loaner bikes, and food arranged for your arrival. If you have any other questions or concerns, please email bikebike2014columbus@gmail.com."
=_'register.email.registration_confirmed.contact',"For urgent/emergency matters, you can reach our Outreach Coordinator, Reda, at 503-984-9191 or Jason at 614-364-3636."
@@ -0,0 +1,7 @@
%img{src: "#{@url}/#{@conference.poster.full.url}", style: "max-width: 100%;"}
%div{style: 'padding: 25px'}
%h1=_'register.email.registration.please_confirm',"Hi #{@data[:user][:username]}, please confirm your registration for #{@conference.title}", vars: {:username => @data[:user][:username]}
%div{style: 'text-align:center'}
%h1{style: 'background-color:#F11845;text-align:center;display:inline-block;padding: 5px 20px 10px;'}
%a{href: @confirmation_url, style: 'color:#FFF;text-decoration:none;'}
=_'register.email.registration.confirm_button',"Yes I'm Really Coming!"
@@ -1 +1 @@
= @data.to_json.to_s
=_('register.email.registration.please_confirm',"Hi #{@data[:user][:username]}, please confirm your registration for #{@conference.title}", vars: {:username => @data[:user][:username]}) + ": #{@confirmation_url}"