Browse Source

Added different favicons for each environment and cleaned up files

development
Godwin 9 years ago
parent
commit
cb1ec59b8d
  1. 2
      app/assets/stylesheets/bumbleberry-settings.json
  2. 4
      app/controllers/application_controller.rb
  3. 58
      app/controllers/conference_admins_controller.rb
  4. 58
      app/controllers/conference_host_organizations_controller.rb
  5. 58
      app/controllers/conference_registration_responses_controller.rb
  6. 58
      app/controllers/conference_registrations_controller.rb
  7. 58
      app/controllers/conference_registraton_form_fields_controller.rb
  8. 58
      app/controllers/conference_types_controller.rb
  9. 764
      app/controllers/conferences_controller.rb
  10. 58
      app/controllers/event_types_controller.rb
  11. 58
      app/controllers/events_controller.rb
  12. 58
      app/controllers/locations_controller.rb
  13. 58
      app/controllers/organization_statuses_controller.rb
  14. 110
      app/controllers/pages_controller.rb
  15. 67
      app/controllers/registration_form_fields_controller.rb
  16. 58
      app/controllers/user_organization_relationships_controller.rb
  17. 20
      app/controllers/user_sessions_controller.rb
  18. 68
      app/controllers/users_controller.rb
  19. 2
      app/controllers/versions_controller.rb
  20. 58
      app/controllers/workshop_facilitators_controller.rb
  21. 58
      app/controllers/workshop_presentation_styles_controller.rb
  22. 58
      app/controllers/workshop_requested_resources_controller.rb
  23. 58
      app/controllers/workshop_resources_controller.rb
  24. 58
      app/controllers/workshop_streams_controller.rb
  25. 69
      app/controllers/workshops_controller.rb
  26. 34
      app/views/events/_form.html.haml
  27. 22
      app/views/events/edit.html.haml
  28. 33
      app/views/events/index.html.haml
  29. 5
      app/views/events/new.html.haml
  30. 30
      app/views/events/show.html.haml
  31. 8
      app/views/layouts/application.html.haml
  32. 22
      app/views/locations/_form.html.haml
  33. 7
      app/views/locations/edit.html.haml
  34. 25
      app/views/locations/index.html.haml
  35. 5
      app/views/locations/new.html.haml
  36. 18
      app/views/locations/show.html.haml
  37. 20
      app/views/organizations/_form.html.haml
  38. 6
      app/views/organizations/_mini_preview.html.haml
  39. 5
      app/views/organizations/_preview.html.haml
  40. 5
      app/views/organizations/edit.html.haml
  41. 13
      app/views/organizations/identity.html.haml
  42. 21
      app/views/organizations/index.html.haml
  43. 15
      app/views/organizations/members.html.haml
  44. 5
      app/views/organizations/new.html.haml
  45. 25
      app/views/organizations/show.html.haml
  46. 10
      app/views/pages/translations_index.html.haml
  47. 8
      app/views/translations/index.html.haml
  48. 6
      app/views/translations/locale.html.haml
  49. 12
      app/views/users/_form.html.haml
  50. 8
      app/views/users/edit.html.haml
  51. 22
      app/views/users/index.html.haml
  52. 6
      app/views/users/new.html.haml
  53. 14
      app/views/users/show.html.haml
  54. 4434
      config/locales/en.yml

2
app/assets/stylesheets/bumbleberry-settings.json

@ -5,7 +5,7 @@
"chrome": ["51"]
},
"development": {
"and_chr": ["50"],
"and_chr": ["51"],
"chrome": ["51"],
"edge": ["13"],
"firefox": ["44"],

4
app/controllers/application_controller.rb

@ -59,6 +59,10 @@ class ApplicationController < LinguaFrancaApplicationController
@alt_lang_urls[locale] = view_context.url_for_locale(locale) # don't show the current locale
end
# give each environment a different icon and theme colour so that we can easily see where we are. See https://css-tricks.com/give-development-domain-different-favicon-production
@favicon = Rails.env.development? || Rails.env.preview? ? "favicon-#{Rails.env.to_s}.ico" : 'favicon.ico'
@theme_colour = Rails.env.preview? ? '#EF57B4' : (Rails.env.development? ? '#D89E59' : '#00ADEF')
# call the base method to detect the language
super
end

58
app/controllers/conference_admins_controller.rb

@ -1,58 +0,0 @@
class ConferenceAdminsController < ApplicationController
before_action :set_conference_admin, only: [:show, :edit, :update, :destroy]
# GET /conference_admins
def index
@conference_admins = ConferenceAdmin.all
end
# GET /conference_admins/1
def show
end
# GET /conference_admins/new
def new
@conference_admin = ConferenceAdmin.new
end
# GET /conference_admins/1/edit
def edit
end
# POST /conference_admins
def create
@conference_admin = ConferenceAdmin.new(conference_admin_params)
if @conference_admin.save
redirect_to @conference_admin, notice: 'Conference admin was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /conference_admins/1
def update
if @conference_admin.update(conference_admin_params)
redirect_to @conference_admin, notice: 'Conference admin was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /conference_admins/1
def destroy
@conference_admin.destroy
redirect_to conference_admins_url, notice: 'Conference admin was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_conference_admin
@conference_admin = ConferenceAdmin.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def conference_admin_params
params.require(:conference_admin).permit(:conference_id, :user_id)
end
end

58
app/controllers/conference_host_organizations_controller.rb

@ -1,58 +0,0 @@
class ConferenceHostOrganizationsController < ApplicationController
before_action :set_conference_host_organization, only: [:show, :edit, :update, :destroy]
# GET /conference_host_organizations
def index
@conference_host_organizations = ConferenceHostOrganization.all
end
# GET /conference_host_organizations/1
def show
end
# GET /conference_host_organizations/new
def new
@conference_host_organization = ConferenceHostOrganization.new
end
# GET /conference_host_organizations/1/edit
def edit
end
# POST /conference_host_organizations
def create
@conference_host_organization = ConferenceHostOrganization.new(conference_host_organization_params)
if @conference_host_organization.save
redirect_to @conference_host_organization, notice: 'Conference host organization was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /conference_host_organizations/1
def update
if @conference_host_organization.update(conference_host_organization_params)
redirect_to @conference_host_organization, notice: 'Conference host organization was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /conference_host_organizations/1
def destroy
@conference_host_organization.destroy
redirect_to conference_host_organizations_url, notice: 'Conference host organization was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_conference_host_organization
@conference_host_organization = ConferenceHostOrganization.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def conference_host_organization_params
params.require(:conference_host_organization).permit(:conference_id, :organization_id, :order)
end
end

58
app/controllers/conference_registration_responses_controller.rb

@ -1,58 +0,0 @@
class ConferenceRegistrationResponsesController < ApplicationController
before_action :set_conference_registration_response, only: [:show, :edit, :update, :destroy]
# GET /conference_registration_responses
def index
@conference_registration_responses = ConferenceRegistrationResponse.all
end
# GET /conference_registration_responses/1
def show
end
# GET /conference_registration_responses/new
def new
@conference_registration_response = ConferenceRegistrationResponse.new
end
# GET /conference_registration_responses/1/edit
def edit
end
# POST /conference_registration_responses
def create
@conference_registration_response = ConferenceRegistrationResponse.new(conference_registration_response_params)
if @conference_registration_response.save
redirect_to @conference_registration_response, notice: 'Conference registration response was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /conference_registration_responses/1
def update
if @conference_registration_response.update(conference_registration_response_params)
redirect_to @conference_registration_response, notice: 'Conference registration response was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /conference_registration_responses/1
def destroy
@conference_registration_response.destroy
redirect_to conference_registration_responses_url, notice: 'Conference registration response was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_conference_registration_response
@conference_registration_response = ConferenceRegistrationResponse.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def conference_registration_response_params
params.require(:conference_registration_response).permit(:conference_registration_id, :registration_form_field_id, :data)
end
end

58
app/controllers/conference_registrations_controller.rb

@ -1,58 +0,0 @@
class ConferenceRegistrationsController < ApplicationController
before_action :set_conference_registration, only: [:show, :edit, :update, :destroy]
# GET /conference_registrations
def index
@conference_registrations = ConferenceRegistration.all
end
# GET /conference_registrations/1
def show
end
# GET /conference_registrations/new
def new
@conference_registration = ConferenceRegistration.new
end
# GET /conference_registrations/1/edit
def edit
end
# POST /conference_registrations
def create
@conference_registration = ConferenceRegistration.new(conference_registration_params)
if @conference_registration.save
redirect_to @conference_registration, notice: 'Conference registration was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /conference_registrations/1
def update
if @conference_registration.update(conference_registration_params)
redirect_to @conference_registration, notice: 'Conference registration was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /conference_registrations/1
def destroy
@conference_registration.destroy
redirect_to conference_registrations_url, notice: 'Conference registration was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_conference_registration
@conference_registration = ConferenceRegistration.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def conference_registration_params
params.require(:conference_registration).permit(:conference_id, :user_id, :is_attending)
end
end

58
app/controllers/conference_registraton_form_fields_controller.rb

@ -1,58 +0,0 @@
class ConferenceRegistratonFormFieldsController < ApplicationController
before_action :set_conference_registraton_form_field, only: [:show, :edit, :update, :destroy]
# GET /conference_registraton_form_fields
def index
@conference_registraton_form_fields = ConferenceRegistratonFormField.all
end
# GET /conference_registraton_form_fields/1
def show
end
# GET /conference_registraton_form_fields/new
def new
@conference_registraton_form_field = ConferenceRegistratonFormField.new
end
# GET /conference_registraton_form_fields/1/edit
def edit
end
# POST /conference_registraton_form_fields
def create
@conference_registraton_form_field = ConferenceRegistratonFormField.new(conference_registraton_form_field_params)
if @conference_registraton_form_field.save
redirect_to @conference_registraton_form_field, notice: 'Conference registraton form field was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /conference_registraton_form_fields/1
def update
if @conference_registraton_form_field.update(conference_registraton_form_field_params)
redirect_to @conference_registraton_form_field, notice: 'Conference registraton form field was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /conference_registraton_form_fields/1
def destroy
@conference_registraton_form_field.destroy
redirect_to conference_registraton_form_fields_url, notice: 'Conference registraton form field was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_conference_registraton_form_field
@conference_registraton_form_field = ConferenceRegistratonFormField.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def conference_registraton_form_field_params
params.require(:conference_registraton_form_field).permit(:conference_id, :registration_form_field_id, :order)
end
end

58
app/controllers/conference_types_controller.rb

@ -1,58 +0,0 @@
class ConferenceTypesController < ApplicationController
before_action :set_conference_type, only: [:show, :edit, :update, :destroy]
# GET /conference_types
def index
@conference_types = ConferenceType.all
end
# GET /conference_types/1
def show
end
# GET /conference_types/new
def new
@conference_type = ConferenceType.new
end
# GET /conference_types/1/edit
def edit
end
# POST /conference_types
def create
@conference_type = ConferenceType.new(conference_type_params)
if @conference_type.save
redirect_to @conference_type, notice: 'Conference type was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /conference_types/1
def update
if @conference_type.update(conference_type_params)
redirect_to @conference_type, notice: 'Conference type was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /conference_types/1
def destroy
@conference_type.destroy
redirect_to conference_types_url, notice: 'Conference type was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_conference_type
@conference_type = ConferenceType.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def conference_type_params
params.require(:conference_type).permit(:title, :info)
end
end

764
app/controllers/conferences_controller.rb

@ -14,508 +14,7 @@ class ConferencesController < ApplicationController
end
end
# GET /conferences
# def index
# @conference_type = nil
# if params['conference_type']
# @conference_type = ConferenceType.find_by!(:slug => params['conference_type'])
# @conferences = Conference.where(:conference_type_id => @conference_type.id)
# else
# @conferences = Conference.all
# end
# end
# # GET /conferences/1
# def show
# end
# # GET /conferences/new
# def new
# @conference = Conference.new
# @conference.build_conference_type
# end
# # GET /conferences/1/edit
# def edit
# set_conference
# set_conference_registration
# raise ActiveRecord::PremissionDenied unless (current_user && @this_conference.host?(current_user))
# end
# # PATCH/PUT /conferences/1
# def save
# set_conference
# set_conference_registration
# raise ActiveRecord::PremissionDenied unless (current_user && @this_conference.host?(current_user))
# @this_conference.info = params[:info]
# @this_conference.save
# redirect_to edit_conference_path(@this_conference)
# end
# def hosts
# set_conference
# @conference.conference_host_organizations.build
# end
# def nonhosts
# set_conference
# @available_orgs = Organization.where(["id NOT IN (?)", @conference.organizations.map(&:id) + (params[:added] || [])])
# html = '<h2>Select an Organization</h2><div id="select-organization-list">'
# @available_orgs.each do |organization|
# html += '<a href="#" class="organization-preview" data-id="' + organization.id.to_s + '"><img src="' + (organization.avatar.url :thumb) + '" /><div class="username">' + (organization.name) + '</div></a>'
# end
# render :text => (html + '</div>')
# end
# def registration
# set_conference
# @sub_action = 'registration' + (params[:sub_action] ? '_' + params[:sub_action] : '')
# if params[:sub_action] == 'form'
# @registration_form_field = RegistrationFormField.new
# @registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
# end
# end
# def register_submit
# next_step = nil
# if !session[:registration]
# session[:registration] = Hash.new
# session[:registration][:path] = Array.new
# end
# 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]
# 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 = 'questions'
# end
# when 'primary'
# 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][: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] = !error && params[:username].blank? ? (params[:firstname] + ' ' + params[:lastname]) : params[:username]
# end
# if session[:registration][:is_volunteer]
# next_step = 'volunteer_questions'
# elsif session[:registration][:is_participant]
# next_step = 'questions'
# end
# when 'organizations'
# @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
# session[:registration][:new_organization][0] ||= Hash.new
# session[:registration][:new_org_index] = 0
# if !session[:registration][:new_organization][0][:country]
# my_location = lookup_ip_location
# session[:registration][:new_organization][0][:country] = my_location.country_code
# session[:registration][:new_organization][0][:territory] = my_location.province_code
# session[:registration][:new_organization][0][:city] = my_location.city
# end
# next_step = 'new_organization'
# else
# 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
# else
# error = _'registration.register.no_organization_error',"Please select an organization or enter a new one"
# end
# when 'new_organization'
# if params[:organization_name].blank?
# error = _'register.new_organization.no_name_error',"Please tell us your organization's name"
# end
# 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) == 0
# 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[:organization_street].blank?
# error ||= _'register.new_organization.no_street_error','Please enter your organization\'s street address'
# end
# if params[:organization_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]
# session[:registration][:new_organization][i][:territory] = params[:organization_territory]
# session[:registration][:new_organization][i][:city] = params[:organization_city]
# session[:registration][:new_organization][i][:street] = params[:organization_street]
# session[:registration][:new_organization][i][:info] = params[:organization_info]
# session[:registration][:new_organization][i][:email] = params[:organization_email]
# session[:registration][:new_organization][i][:name] = params[:organization_name]
# 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_hash
# dir = File.join(base_dir, hash_dir)
# while File.directory?(dir)
# hash_dir = rand_hash
# dir = File.join(base_dir, hash_dir)
# end
# FileUtils.mkdir_p(dir)
# 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
# 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
# elsif !error
# session[:registration][:new_org_index] = i + 1
# session[:registration][:new_organization][i + 1] ||= Hash.new
# if !session[:registration][:new_organization][i + 1][:country]
# session[:registration][:new_organization][i + 1][:country] = session[:registration][:new_organization][i][:country]
# session[:registration][:new_organization][i + 1][:territory] = session[:registration][:new_organization][i][:territory]
# session[:registration][:new_organization][i + 1][:city] = session[:registration][:new_organization][i][:city]
# end
# end
# else
# if session[:registration][:new_organization][i + 1]
# session[:registration][:new_organization] = session[:registration][:new_organization].first(i + 1)
# end
# 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'
# 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
# session[:registration][:user][:firstname] = params[:firstname]
# session[:registration][:user][:lastname] = params[:lastname]
# session[:registration][:is_volunteer] = false
# session[:registration][:is_participant] = true
# if !session[:registration][:user][:id]
# session[:registration][:user][:username] = !error && params[:username].blank? ? (params[:firstname] + ' ' + params[:lastname]) : params[:username]
# end
# session[:registration][:questions] = params[:questions].deep_symbolize_keys
# session[:registration][:is_workshop_host] = !params[:is_workshop_host].to_i.zero?
# next_step = 'organizations'
# if params[:cancel].blank?#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 = 'questions'
# else
# create_registration
# next_step = 'thanks'
# end
# when 'new_workshop'
# i = params[:workshop_index].to_i
# session[:registration][:workshop][i][:title] = params[:workshop_title]
# 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_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]
# next_step = 'new_workshop'
# if !error
# session[:registration][:workshop] ||= Array.new
# session[:registration][:workshop][i + 1] ||= Hash.new
# session[:registration][:workshop_index] = i + 1
# end
# else
# if session[:registration][:workshop][i + 1]
# session[:registration][:workshop] = session[:registration][:workshop].first(i + 1)
# end
# next_step = 'thanks'
# complete_registration
# end
# when 'thanks'
# @registration = ConferenceRegistration.find(session[:registration][:registration_id])
# if @registration.is_confirmed.blank?
# send_confirmation
# end
# next_step = 'thanks'
# when 'cancel'
# if params[:yes]
# session.delete(:registration)
# next_step = 'cancelled'
# else
# return {error: false, next_step: session[:registration][:path].pop}
# end
# when 'already_registered'
# send_confirmation
# next_step = 'thanks'
# when 'paypal-confirmed'
# @registration = ConferenceRegistration.find(session[:registration][:registration_id])
# next_step = 'confirm_payment'
# when 'confirm_payment'
# @registration = ConferenceRegistration.find(session[:registration][:registration_id])
# if params[:confirm_payment]
# info = YAML.load(@registration.payment_info)
# amount = nil
# status = nil
# if is_test?
# status = info[:status]
# amount = info[:amount]
# else
# paypal = PayPal!.checkout!(info[:token], info[:payer_id], PayPalRequest(info[:amount]))
# status = paypal.payment_info.first.payment_status
# amount = paypal.payment_info.first.amount.total
# end
# if status == 'Completed'
# @registration.registration_fees_paid = amount
# @registration.save!
# end
# end
# next_step = 'thanks'
# when 'pay_now', 'payment-confirmed', 'paypal-cancelled'
# next_step = 'thanks'
# 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 broadcast
# set_conference
# set_conference_registration
# raise ActiveRecord::PremissionDenied unless (current_user && @this_conference.host?(current_user))
# @subject = params[:subject]
# @content = params[:content]
# if request.post?
# if params[:button] == 'edit'
# @email_sent = :edit
# elsif params[:button] == 'test'
# @email_sent = :test
# UserMailer.delay.broadcast(
# "#{request.protocol}#{request.host_with_port}",
# @subject,
# @content,
# current_user,
# @this_conference)
# elsif params[:button] == 'preview'
# @email_sent = :preview
# elsif params[:button] == 'send'
# ConferenceRegistration.where(:conference_id => @this_conference.id).each do |r|
# if r.user_id
# UserMailer.broadcast("#{request.protocol}#{request.host_with_port}",
# @subject,
# @content,
# User.find(r.user_id),
# @this_conference).deliver_later
# end
# end
# @email_sent = :yes
# end
# end
# end
# def stats
# set_conference
# set_conference_registration
# raise ActiveRecord::PremissionDenied unless (current_user && @this_conference.host?(current_user))
# @registrations = ConferenceRegistration.where(:conference_id => @this_conference.id)
# @total_registrations = 0
# @donation_count = 0
# @total_donations = 0
# @housing = {}
# @bikes = {}
# @bike_count = 0
# @languages = {}
# @food = {}
# @allergies = []
# @other = []
# if request.format.xls?
# logger.info "Generating stats.xls"
# @excel_data = {
# :columns => [:name, :email, :city, :date, :languages, :arrival, :departure, :housing, :companion, :bike, :food, :allergies, :other, :fees_paid],
# :key => 'articles.conference_registration.headings',
# :data => []
# }
# end
# @registrations.each do |r|
# if r && r.is_attending
# begin
# @total_registrations += 1
# @donation_count += 1 if r.registration_fees_paid
# @total_donations += r.registration_fees_paid unless r.registration_fees_paid.blank?
# unless r.housing.blank?
# @housing[r.housing.to_sym] ||= 0
# @housing[r.housing.to_sym] += 1
# end
# unless r.bike.blank?
# @bikes[r.bike.to_sym] ||= 0
# @bikes[r.bike.to_sym] += 1
# @bike_count += 1 unless r.bike.to_sym == :none
# end
# unless r.food.blank?
# @food[r.food.to_sym] ||= 0
# @food[r.food.to_sym] += 1
# end
# @allergies << r.allergies unless r.allergies.blank?
# @other << r.other unless r.other.blank?
# JSON.parse(r.languages).each do |l|
# @languages[l.to_sym] ||= 0
# @languages[l.to_sym] += 1
# end unless r.languages.blank?
# if @excel_data
# user = r.user_id ? User.find(r.user_id) : nil
# @excel_data[:data] << {
# :name => (user ? user.firstname : nil) || '',
# :email => (user ? user.email : nil) || '',
# :date => r.created_at ? r.created_at.strftime("%F %T") : '',
# :city => r.city || '',
# :languages => ((JSON.parse(r.languages || '[]').map { |x| I18n.t"languages.#{x}" }).join(', ').to_s),
# :arrival => r.arrival ? r.arrival.strftime("%F %T") : '',
# :departure => r.departure ? r.departure.strftime("%F %T") : '',
# :housing => (I18n.t"articles.conference_registration.questions.housing.#{r.housing || 'none'}"),
# :companion => (r.housing_data[:companions] || []).join(', '),
# :bike => (I18n.t"articles.conference_registration.questions.bike.#{r.bike || 'none'}"),
# :food => (I18n.t"articles.conference_registration.questions.food.#{r.food || 'meat'}"),
# :fees_paid => (r.registration_fees_paid || 0.0),
# :allergies => r.allergies || '',
# :other => r.other || ''
# }
# end
# rescue => error
# logger.info "Error adding row to stats.xls: #{error.message}"
# logger.info error.backtrace.join("\n\t")
# end
# end
# end
# if ENV["RAILS_ENV"] == 'test' && request.format.xls?
# logger.info "Rendering stats.xls as HTML"
# request.format = :html
# respond_to do |format|
# format.html { render :file => 'application/excel.xls.haml', :formats => [:xls] }
# end
# return
# end
# logger.info "Rendering stats.xls" if request.format.xls?
# respond_to do |format|
# format.html
# format.text { render :text => content }
# format.xls { render 'application/excel' }
# end
# end
def register
# is_post = request.post? || session[:registration_step]
set_conference
@register_template = nil
@ -1722,268 +1221,6 @@ class ConferencesController < ApplicationController
return redirect_to view_workshop_url(@this_conference.slug, workshop.id, anchor: "comment-#{new_comment.id}")
end
# def schedule
# set_conference
# return do_404 unless @this_conference.workshop_schedule_published || @this_conference.host?(current_user)
# @events = Event.where(:conference_id => @this_conference.id).order(start_time: :asc)
# @locations = EventLocation.where(:conference_id => @this_conference.id)
# render 'schedule/show'
# end
# def edit_schedule
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# @workshops = Workshop.where(:conference_id => @this_conference.id)
# @events = Event.where(:conference_id => @this_conference.id)
# if session[:workshops]
# (0...@workshops.count).each do |i|
# id = @workshops[i].id
# w = session[:workshops][id.to_s]
# if w
# @workshops[i].start_time = w[:start_time]
# @workshops[i].end_time = w[:end_time]
# @workshops[i].event_location_id = w[:event_location_id]
# end
# end
# end
# if session[:events]
# (0...@events.count).each do |i|
# id = @events[i].id
# w = session[:events][id.to_s]
# if w
# @events[i].start_time = w[:start_time]
# @events[i].end_time = w[:end_time]
# @events[i].event_location_id = w[:event_location_id]
# end
# end
# end
# @locations = EventLocation.where(:conference_id => @this_conference.id)
# @location_hash = Hash.new
# @locations.each do |l|
# @location_hash[l.id.to_s] = l
# end
# @days = Array.new
# start_day = @this_conference.start_date.strftime('%u').to_i
# end_day = start_day + ((@this_conference.end_date - @this_conference.start_date) / 86400)
# (start_day..end_day).each do |i|
# @days << [(@this_conference.start_date + (i - start_day).days).strftime('%a'), ((i + 1) - start_day)]
# end
# @hours = Array.new
# (0..48).each do |i|
# hour = (Date.today + (i / 2.0).hours).strftime('%R')
# @hours << hour
# end
# @event_durations = [['30 mins', 30], ['1 hour', 60], ['1.5 hours', 90], ['2 hours', 120], ['2.5 hours', 150]]
# @workshop_durations = [['1 hour', 60], ['1.5 hours', 90], ['2 hours', 120]]
# schedule_data = get_schedule_data
# @schedule = schedule_data[:schedule]
# @errors = schedule_data[:errors]
# @warnings = schedule_data[:warnings]
# @conflict_score = schedule_data[:conflict_score]
# @error_count = schedule_data[:error_count]
# if session[:day_parts]
# @day_parts = JSON.parse(session[:day_parts])
# elsif @this_conference.day_parts
# @day_parts = JSON.parse(@this_conference.day_parts)
# else
# @day_parts = {:morning => 0, :afternoon => 13, :evening => 18}
# end
# @saved = session[:workshops].nil?
# render 'schedule/edit'
# end
# def save_schedule
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# @days = Array.new
# start_day = @this_conference.start_date.strftime('%u').to_i
# end_day = start_day + ((@this_conference.end_date - @this_conference.start_date) / 86400)
# (start_day..end_day).each do |i|
# @days << [(@this_conference.start_date + (i - start_day).days).strftime('%a'), i]
# end
# @workshops = Workshop.where(:conference_id => @this_conference.id)
# @events = Event.where(:conference_id => @this_conference.id)
# @locations = EventLocation.where(:conference_id => @this_conference.id)
# do_save = (params[:button] == 'save' || params[:button] == 'publish')
# session[:workshops] = do_save ? nil : Hash.new
# session[:events] = do_save ? nil : Hash.new
# session[:day_parts] = do_save ? nil : Hash.new
# (0...@workshops.count).each do |i|
# id = @workshops[i].id.to_s
# if params[:workshop_day][id].present? && params[:workshop_hour][id].present? && params[:workshop_duration][id].present?
# date = @this_conference.start_date + (params[:workshop_day][id].to_i - 1).days
# h = params[:workshop_hour][id].split(':')
# date = date.change({hour: h.first, minute: h.last})
# @workshops[i].start_time = date
# @workshops[i].end_time = date + (params[:workshop_duration][id].to_i).minutes
# else
# @workshops[i].start_time = nil
# @workshops[i].end_time = nil
# end
# @workshops[i].event_location_id = params[:workshop_location][id]
# if do_save
# @workshops[i].save
# else
# session[:workshops][id] = {
# :start_time => @workshops[i].start_time,
# :end_time => @workshops[i].end_time,
# :event_location_id => @workshops[i].event_location_id
# }
# end
# end
# (0...@events.count).each do |i|
# id = @events[i].id.to_s
# if params[:event_day][id].present? && params[:event_hour][id].present? && params[:event_duration][id].present?
# date = @this_conference.start_date + (params[:event_day][id].to_i - 1).days
# h = params[:event_hour][id].split(':')
# date = date.change({hour: h.first, minute: h.last})
# @events[i].start_time = date
# @events[i].end_time = date + (params[:event_duration][id].to_i).minutes
# else
# @events[i].start_time = nil
# @events[i].end_time = nil
# end
# @events[i].event_location_id = params[:event_location][id]
# if do_save
# @events[i].save
# else
# session[:events][id] = {
# :start_time => @events[i].start_time,
# :end_time => @events[i].end_time,
# :event_location_id => @events[i].event_location_id
# }
# end
# end
# if params[:day_parts]
# day_parts = {:morning => 0}
# params[:day_parts].each do |part, h|
# h = h.split(':')
# day_parts[part.to_sym] = h[0].to_f + (h[1].to_i > 0 ? 0.5 : 0)
# end
# if do_save
# @this_conference.day_parts = day_parts.to_json
# else
# session[:day_parts] = day_parts.to_json
# end
# end
# save_conference = do_save
# if params[:button] == 'publish'
# @this_conference.workshop_schedule_published = true
# save_conference = true
# elsif params[:button] == 'unpublish'
# @this_conference.workshop_schedule_published = false
# save_conference = true
# end
# if save_conference
# @this_conference.save
# end
# redirect_to edit_schedule_url(@this_conference.slug)
# end
# def add_event
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# render 'events/edit'
# end
# def edit_event
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# @event = Event.find(params[:id])
# return do_403 unless @event.conference_id == @this_conference.id
# render 'events/edit'
# end
# def save_event
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# if params[:event_id]
# event = Event.find(params[:event_id])
# return do_403 unless event.conference_id == @this_conference.id
# else
# event = Event.new(:conference_id => @this_conference.id)
# end
# event.title = params[:title]
# event.info = params[:info]
# event.event_type = params[:event_type]
# event.save
# return redirect_to schedule_url(@this_conference.slug)
# end
# def add_location
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# render 'event_locations/edit'
# end
# def edit_location
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# @location = EventLocation.find(params[:id])
# return do_403 unless @location.conference_id == @this_conference.id
# @amenities = JSON.parse(@location.amenities || '[]').map &:to_sym
# render 'event_locations/edit'
# end
# def save_location
# set_conference
# return do_404 unless @this_conference.host?(current_user)
# if params[:location_id]
# location = EventLocation.find(params[:location_id])
# return do_403 unless location.conference_id == @this_conference.id
# else
# location = EventLocation.new(:conference_id => @this_conference.id)
# end
# location.title = params[:title]
# location.address = params[:address]
# location.amenities = (params[:needs] || {}).keys.to_json
# location.save
# return redirect_to schedule_url(@this_conference.slug)
# end
# DELETE /conferences/1
#def destroy
# @conference.destroy
# redirect_to conferences_url, notice: 'Conference was successfully destroyed.'
#end
helper_method :registration_steps
helper_method :current_registration_steps
helper_method :registration_complete?
@ -2120,7 +1357,6 @@ class ConferencesController < ApplicationController
end
def update_field_position(field_id, position)
#ConferenceRegistrationFormField.where(:conference_id => @conference.id, :registration_form_field_id => field_id).update_all(:position => position)
data = []
for i in 0..@conference.conference_registration_form_fields.length
f = @conference.conference_registration_form_fields[i]

58
app/controllers/event_types_controller.rb

@ -1,58 +0,0 @@
class EventTypesController < ApplicationController
before_action :set_event_type, only: [:show, :edit, :update, :destroy]
# GET /event_types
def index
@event_types = EventType.all
end
# GET /event_types/1
def show
end
# GET /event_types/new
def new
@event_type = EventType.new
end
# GET /event_types/1/edit
def edit
end
# POST /event_types
def create
@event_type = EventType.new(event_type_params)
if @event_type.save
redirect_to @event_type, notice: 'Event type was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /event_types/1
def update
if @event_type.update(event_type_params)
redirect_to @event_type, notice: 'Event type was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /event_types/1
def destroy
@event_type.destroy
redirect_to event_types_url, notice: 'Event type was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_event_type
@event_type = EventType.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def event_type_params
params.require(:event_type).permit(:slug, :info)
end
end

58
app/controllers/events_controller.rb

@ -1,58 +0,0 @@
class EventsController < ApplicationController
before_action :set_event, only: [:show, :edit, :update, :destroy]
# GET /events
def index
@events = Event.all
end
# GET /events/1
def show
end
# GET /events/new
def new
@event = Event.new
end
# GET /events/1/edit
def edit
end
# POST /events
def create
@event = Event.new(event_params)
if @event.save
redirect_to @event, notice: 'Event was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /events/1
def update
if @event.update(event_params)
redirect_to @event, notice: 'Event was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /events/1
def destroy
@event.destroy
redirect_to events_url, notice: 'Event was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_event
@event = Event.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def event_params
params.require(:event).permit(:title, :slug, :event_type_id, :conference, :info, :location, :start_time, :end_time)
end
end

58
app/controllers/locations_controller.rb

@ -1,58 +0,0 @@
class LocationsController < ApplicationController
before_action :set_location, only: [:show, :edit, :update, :destroy]
# GET /locations
def index
@locations = Location.all
end
# GET /locations/1
def show
end
# GET /locations/new
def new
@location = Location.new
end
# GET /locations/1/edit
def edit
end
# POST /locations
def create
@location = Location.new(location_params)
if @location.save
redirect_to @location, notice: 'Location was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /locations/1
def update
if @location.update(location_params)
redirect_to @location, notice: 'Location was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /locations/1
def destroy
@location.destroy
redirect_to locations_url, notice: 'Location was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_location
@location = Location.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def location_params
params.require(:location).permit(:title, :address, :latitude, :longitude)
end
end

58
app/controllers/organization_statuses_controller.rb

@ -1,58 +0,0 @@
class OrganizationStatusesController < ApplicationController
before_action :set_organization_status, only: [:show, :edit, :update, :destroy]
# GET /organization_statuses
def index
@organization_statuses = OrganizationStatus.all
end
# GET /organization_statuses/1
def show
end
# GET /organization_statuses/new
def new
@organization_status = OrganizationStatus.new
end
# GET /organization_statuses/1/edit
def edit
end
# POST /organization_statuses
def create
@organization_status = OrganizationStatus.new(organization_status_params)
if @organization_status.save
redirect_to @organization_status, notice: 'Organization status was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /organization_statuses/1
def update
if @organization_status.update(organization_status_params)
redirect_to @organization_status, notice: 'Organization status was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /organization_statuses/1
def destroy
@organization_status.destroy
redirect_to organization_statuses_url, notice: 'Organization status was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_organization_status
@organization_status = OrganizationStatus.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def organization_status_params
params.require(:organization_status).permit(:name, :slug, :info)
end
end

110
app/controllers/pages_controller.rb

@ -1,110 +0,0 @@
include ApplicationHelper
class PagesController < ApplicationController
protect_from_forgery :except => :location_territories
#skip_before_filter :verify_authenticity_token, only: [:translate]
def home
#@conferences = Conference.all
#@conference = Conference.order("start_date DESC").first
end
# def resources
# end
# def translate
# key = params[:translationkey]
# value = params[:translationvalue]
# if params[:auto_translate]
# if params[:translationlang] == 'en'
# value = I18n::MissingTranslationExceptionHandler.note(key)
# else
# value = I18n.backend.request_translation(key, {}, {fallback: true, locale: params[:translationlang]})
# end
# elsif params[:translationhascount] == '1'
# ['zero', 'one', 'two', 'few', 'many'].each { |c|
# if params['translationpluralization_' + c]
# if !value.is_a?(Hash)
# value = Hash.new
# end
# value[c] = params['translationvalue_' + c]
# else
# Translation.destroy_all(:locale => params[:translationlang], :key => (key + '.' + c))
# end
# }
# if value.is_a?(Hash)
# value['other'] = params[:translationvalue]
# Translation.destroy_all(:locale => params[:translationlang], :key => key)
# else
# Translation.destroy_all(:locale => params[:translationlang], :key => (key + '.other'))
# end
# end
# store_translations(params[:translationlang], {key => value}, :escape => false)
# begin
# render json: {success: true, key: key, jkey: key.gsub('.', '--'), translation: I18n.translate(key, {:raise => false, :locale => params[:translationlang].to_sym})}
# rescue
# render json: {error: 'Failed to load translation'}
# end
# end
#def location_territories
#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
# render json: territories.to_json
#end
# def translations
# #if !current_user
# # raise ActiveRecord::PremissionDenied
# #end
# @lang = params[:lang]
# @translations = is_test? ? {} : I18n.backend.get_translation_info
# I18n.config.enforce_available_locales = false
# end
# def translation_list
# if !current_user && is_production?
# raise ActiveRecord::PremissionDenied
# end
# total = 0
# complete = 0
# @completeness = Hash.new
# translation_info = I18n.backend.get_translation_info()
# translation_info.each { |k,v|
# #total += 1
# #complete += v['languages'].include?(lang.to_s) ? 1 : 0
# v['languages'].each { |l|
# @completeness[l] ||= 0
# @completeness[l] += 1
# }
# }
# #@test = total ? complete / total : 0
# @total_translations = translation_info.size()
# @language_codes = I18n.backend.get_language_codes().select { |s| s }.sort{ | a1, a2 |
# c2 = @completeness.has_key?(a2.to_s) ? @completeness[a2.to_s] : 0
# c1 = @completeness.has_key?(a1.to_s) ? @completeness[a1.to_s] : 0
# c1 == c2 ? a1 <=> a2 : c2 <=> c1
# }
# end
def robots
robot = is_production? && !is_test_server? ? 'live' : 'dev'
render :text => File.read("config/robots-#{robot}.txt"), :content_type => 'text/plain'
end
# private
# def store_translations(locale, data, options = {})
# escape = options.fetch(:escape, true)
# I18n.backend.flatten_translations(locale, data, escape, false).each do |key, value|
# t = Translation.find_or_create_by!(locale: locale.to_s, key: key.to_s)
# t.value = value
# t.save
# end
# I18n.backend.reload!
# end
end

67
app/controllers/registration_form_fields_controller.rb

@ -1,67 +0,0 @@
class RegistrationFormFieldsController < ApplicationController
before_action :set_registration_form_field, only: [:show, :edit, :update, :destroy]
# GET /registration_form_fields
def index
@registration_form_fields = RegistrationFormField.all
end
# GET /registration_form_fields/1
def show
end
# GET /registration_form_fields/new
def new
@registration_form_field = RegistrationFormField.new
end
# GET /registration_form_fields/1/edit
def edit
end
# POST /registration_form_fields
def create
@registration_form_field = RegistrationFormField.new(registration_form_field_params)
ajax_return(@registration_form_field.save)
end
# PATCH/PUT /registration_form_fields/1
def update
ajax_return(@registration_form_field.update(registration_form_field_params))
end
# DELETE /registration_form_fields/1
def destroy
@registration_form_field.destroy
redirect_to registration_form_fields_url, notice: 'Registration form field was successfully destroyed.'
end
private
def ajax_return(success)
if params[:conference_id]
@conference = Conference.find(params[:conference_id])
@registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
end
if success
@registration_form_field = RegistrationFormField.new
end
form = render_to_string :partial => 'form'
list = render_to_string :partial => 'list'
render json: {form: form, list: list}
end
# Use callbacks to share common setup or constraints between actions.
def set_registration_form_field
@registration_form_field = RegistrationFormField.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def registration_form_field_params
rff_params = params.require(:registration_form_field)
allowed = RegistrationFormField::GetNonOptionKeys(rff_params[:field_type], rff_params)
p = rff_params.send('permit', *allowed)#permit(:title, :help, :required, :field_type, :options, :is_retired)
p[:options] = RegistrationFormField::GetOptions(rff_params[:field_type], rff_params).to_json.to_s
p[:field_type] = rff_params[:field_type]
p
end
end

58
app/controllers/user_organization_relationships_controller.rb

@ -1,58 +0,0 @@
class UserOrganizationRelationshipsController < ApplicationController
before_action :set_user_organization_relationship, only: [:show, :edit, :update, :destroy]
# GET /user_organization_relationships
def index
@user_organization_relationships = UserOrganizationRelationship.all
end
# GET /user_organization_relationships/1
def show
end
# GET /user_organization_relationships/new
def new
@user_organization_relationship = UserOrganizationRelationship.new
end
# GET /user_organization_relationships/1/edit
def edit
end
# POST /user_organization_relationships
def create
@user_organization_relationship = UserOrganizationRelationship.new(user_organization_relationship_params)
if @user_organization_relationship.save
redirect_to @user_organization_relationship, notice: 'User organization relationship was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /user_organization_relationships/1
def update
if @user_organization_relationship.update(user_organization_relationship_params)
redirect_to @user_organization_relationship, notice: 'User organization relationship was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /user_organization_relationships/1
def destroy
@user_organization_relationship.destroy
redirect_to user_organization_relationships_url, notice: 'User organization relationship was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_user_organization_relationship
@user_organization_relationship = UserOrganizationRelationship.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def user_organization_relationship_params
params.require(:user_organization_relationship).permit(:user_id, :organization_id, :relationship)
end
end

20
app/controllers/user_sessions_controller.rb

@ -1,20 +0,0 @@
class UserSessionsController < ApplicationController
def new
session[:return_to] ||= request.referer
@user = User.new
end
def create
if @user = login(params[:email], params[:password])
redirect_to session.delete(:return_to) || 'pages#home'
else
flash.now[:alert] = "Login failed"
render action: "new"
end
end
def destroy
logout
redirect_to(:users, notice: 'Logged out!')
end
end

68
app/controllers/users_controller.rb

@ -1,68 +0,0 @@
include ApplicationHelper
class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]
# GET /users
def index
@users = User.all
end
# GET /users/1
def show
end
# GET /users/new
def new
@user = User.new
end
# GET /users/1/edit
def edit
end
# POST /users
def create
@user = User.new(user_params)
if @user.save
redirect_to @user, notice: 'User was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /users/1
def update
#if !user_params[:password] || user_params[:password].length < 1
# puts "\nNo Password! ( " + @user.to_json.to_s + " \n"
# user_params[:password] = user_params[:password_confirmation] = 'Oha1otbt!@#'
#end
if @user.update(user_params)
redirect_to @user, notice: 'User was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /users/1
def destroy
@user.destroy
redirect_to users_url, notice: 'User was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_user
@user = User.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def session_params
params.require(:user).permit(:username, :email, :password, :avatar, :avatar_cache)
end
def user_params
params.require(:user).permit(:username, :email, :password, :password_confirmation, :avatar, :avatar_cache, :remove_avatar)
end
end

2
app/controllers/versions_controller.rb

@ -1,2 +0,0 @@
class VersionsController < ApplicationController
end

58
app/controllers/workshop_facilitators_controller.rb

@ -1,58 +0,0 @@
class WorkshopFacilitatorsController < ApplicationController
before_action :set_workshop_facilitator, only: [:show, :edit, :update, :destroy]
# GET /workshop_facilitators
def index
@workshop_facilitators = WorkshopFacilitator.all
end
# GET /workshop_facilitators/1
def show
end
# GET /workshop_facilitators/new
def new
@workshop_facilitator = WorkshopFacilitator.new
end
# GET /workshop_facilitators/1/edit
def edit
end
# POST /workshop_facilitators
def create
@workshop_facilitator = WorkshopFacilitator.new(workshop_facilitator_params)
if @workshop_facilitator.save
redirect_to @workshop_facilitator, notice: 'Workshop facilitator was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_facilitators/1
def update
if @workshop_facilitator.update(workshop_facilitator_params)
redirect_to @workshop_facilitator, notice: 'Workshop facilitator was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_facilitators/1
def destroy
@workshop_facilitator.destroy
redirect_to workshop_facilitators_url, notice: 'Workshop facilitator was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_facilitator
@workshop_facilitator = WorkshopFacilitator.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_facilitator_params
params.require(:workshop_facilitator).permit(:user_id, :workshop_id, :role)
end
end

58
app/controllers/workshop_presentation_styles_controller.rb

@ -1,58 +0,0 @@
class WorkshopPresentationStylesController < ApplicationController
before_action :set_workshop_presentation_style, only: [:show, :edit, :update, :destroy]
# GET /workshop_presentation_styles
def index
@workshop_presentation_styles = WorkshopPresentationStyle.all
end
# GET /workshop_presentation_styles/1
def show
end
# GET /workshop_presentation_styles/new
def new
@workshop_presentation_style = WorkshopPresentationStyle.new
end
# GET /workshop_presentation_styles/1/edit
def edit
end
# POST /workshop_presentation_styles
def create
@workshop_presentation_style = WorkshopPresentationStyle.new(workshop_presentation_style_params)
if @workshop_presentation_style.save
redirect_to @workshop_presentation_style, notice: 'Workshop presentation style was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_presentation_styles/1
def update
if @workshop_presentation_style.update(workshop_presentation_style_params)
redirect_to @workshop_presentation_style, notice: 'Workshop presentation style was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_presentation_styles/1
def destroy
@workshop_presentation_style.destroy
redirect_to workshop_presentation_styles_url, notice: 'Workshop presentation style was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_presentation_style
@workshop_presentation_style = WorkshopPresentationStyle.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_presentation_style_params
params.require(:workshop_presentation_style).permit(:name, :slug, :info)
end
end

58
app/controllers/workshop_requested_resources_controller.rb

@ -1,58 +0,0 @@
class WorkshopRequestedResourcesController < ApplicationController
before_action :set_workshop_requested_resource, only: [:show, :edit, :update, :destroy]
# GET /workshop_requested_resources
def index
@workshop_requested_resources = WorkshopRequestedResource.all
end
# GET /workshop_requested_resources/1
def show
end
# GET /workshop_requested_resources/new
def new
@workshop_requested_resource = WorkshopRequestedResource.new
end
# GET /workshop_requested_resources/1/edit
def edit
end
# POST /workshop_requested_resources
def create
@workshop_requested_resource = WorkshopRequestedResource.new(workshop_requested_resource_params)
if @workshop_requested_resource.save
redirect_to @workshop_requested_resource, notice: 'Workshop requested resource was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_requested_resources/1
def update
if @workshop_requested_resource.update(workshop_requested_resource_params)
redirect_to @workshop_requested_resource, notice: 'Workshop requested resource was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_requested_resources/1
def destroy
@workshop_requested_resource.destroy
redirect_to workshop_requested_resources_url, notice: 'Workshop requested resource was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_requested_resource
@workshop_requested_resource = WorkshopRequestedResource.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_requested_resource_params
params.require(:workshop_requested_resource).permit(:workshop_id, :workshop_resource_id, :status)
end
end

58
app/controllers/workshop_resources_controller.rb

@ -1,58 +0,0 @@
class WorkshopResourcesController < ApplicationController
before_action :set_workshop_resource, only: [:show, :edit, :update, :destroy]
# GET /workshop_resources
def index
@workshop_resources = WorkshopResource.all
end
# GET /workshop_resources/1
def show
end
# GET /workshop_resources/new
def new
@workshop_resource = WorkshopResource.new
end
# GET /workshop_resources/1/edit
def edit
end
# POST /workshop_resources
def create
@workshop_resource = WorkshopResource.new(workshop_resource_params)
if @workshop_resource.save
redirect_to @workshop_resource, notice: 'Workshop resource was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_resources/1
def update
if @workshop_resource.update(workshop_resource_params)
redirect_to @workshop_resource, notice: 'Workshop resource was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_resources/1
def destroy
@workshop_resource.destroy
redirect_to workshop_resources_url, notice: 'Workshop resource was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_resource
@workshop_resource = WorkshopResource.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_resource_params
params.require(:workshop_resource).permit(:name, :slug, :info)
end
end

58
app/controllers/workshop_streams_controller.rb

@ -1,58 +0,0 @@
class WorkshopStreamsController < ApplicationController
before_action :set_workshop_stream, only: [:show, :edit, :update, :destroy]
# GET /workshop_streams
def index
@workshop_streams = WorkshopStream.all
end
# GET /workshop_streams/1
def show
end
# GET /workshop_streams/new
def new
@workshop_stream = WorkshopStream.new
end
# GET /workshop_streams/1/edit
def edit
end
# POST /workshop_streams
def create
@workshop_stream = WorkshopStream.new(workshop_stream_params)
if @workshop_stream.save
redirect_to @workshop_stream, notice: 'Workshop stream was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshop_streams/1
def update
if @workshop_stream.update(workshop_stream_params)
redirect_to @workshop_stream, notice: 'Workshop stream was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshop_streams/1
def destroy
@workshop_stream.destroy
redirect_to workshop_streams_url, notice: 'Workshop stream was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop_stream
@workshop_stream = WorkshopStream.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def workshop_stream_params
params.require(:workshop_stream).permit(:name, :slug, :info)
end
end

69
app/controllers/workshops_controller.rb

@ -1,69 +0,0 @@
class WorkshopsController < ApplicationController
before_action :set_workshop, only: [:show, :edit, :update, :destroy]
# GET /workshops
def index
set_conference
@workshops = Workshop.where(['conference_id = ?', @conference.id])
end
# GET /workshops/1
def show
set_workshop
set_conference
end
# GET /workshops/new
def new
set_conference
@workshop = Workshop.new
end
# GET /workshops/1/edit
def edit
set_conference
end
# POST /workshops
def create
set_conference
@workshop = Workshop.new(workshop_params)
if @workshop.save
redirect_to conference_workshop_path(@conference, @workshop), notice: 'Workshop was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /workshops/1
def update
set_conference
if @workshop.update(workshop_params)
redirect_to conference_workshop_path(@conference, @workshop), notice: 'Workshop was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /workshops/1
def destroy
@workshop.destroy
redirect_to workshops_url, notice: 'Workshop was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_workshop
@workshop = Workshop.find_by(slug: params[:workshop_slug] || params[:slug])
end
def set_conference
@conference = Conference.find_by(slug: params[:conference_slug] || params[:slug])
end
# Only allow a trusted parameter "white list" through.
def workshop_params
params.require(:workshop).permit(:title, :slug, :info, :conference_id, :workshop_stream_id, :workshop_presentation_style, :min_facilitators, :location_id, :start_time, :end_time)
end
end

34
app/views/events/_form.html.haml

@ -1,34 +0,0 @@
= form_for @event do |f|
- if @event.errors.any?
#error_explanation
%h2= "#{pluralize(@event.errors.count, "error")} prohibited this event from being saved:"
%ul
- @event.errors.full_messages.each do |msg|
%li= msg
.field
= f.label :title
= f.text_field :title
.field
= f.label :slug
= f.text_field :slug
.field
= f.label :event_type_id
= f.number_field :event_type_id
.field
= f.label :conference
= f.text_field :conference
.field
= f.label :info
= f.text_area :info
.field
= f.label :location
= f.text_field :location
.field
= f.label :start_time
= f.datetime_select :start_time
.field
= f.label :end_time
= f.datetime_select :end_time
.actions
= f.submit 'Save'

22
app/views/events/edit.html.haml

@ -1,22 +0,0 @@
= render 'conferences/page_header', :page_key => (@event ? 'Edit_Event' : 'New_Event')
%article
= form_tag save_event_path(@this_conference.slug), class: 'composition' do
= row do
= columns(medium: 9) do
= (hidden_field_tag :event_id, @event.id) if @event
.text-field.input-field.big
= label_tag :title
= text_field_tag :title, @event ? @event.title : nil, :required => true
= columns(medium: 3) do
.select-field.input-field
= label_tag :event_type do
= select_tag :event_type, options_for_select([:event, :meal], @event ? @event.event_type : nil), :include_blank => true
=_'forms.labels.generic.event_type'
= row do
= columns(medium: 12) do
.text-area-field.input-field
= label_tag :info
= text_area_tag :info, @event ? @event.info : nil, :required => true
= columns(medium: 12) do
.actions.right
= button_tag :save, :value => :save

33
app/views/events/index.html.haml

@ -1,33 +0,0 @@
%h1 Listing events
%table
%tr
%th Title
%th Slug
%th Event type
%th Conference
%th Info
%th Location
%th Start time
%th End time
%th
%th
%th
- @events.each do |event|
%tr
%td= event.title
%td= event.slug
%td= event.event_type_id
%td= event.conference
%td= event.info
%td= event.location
%td= event.start_time
%td= event.end_time
%td= link_to 'Show', event
%td= link_to 'Edit', edit_event_path(event)
%td= link_to 'Destroy', event, :method => :delete, :data => { :confirm => 'Are you sure?' }
%br
= link_to 'New Event', new_event_path

5
app/views/events/new.html.haml

@ -1,5 +0,0 @@
%h1 New event
= render 'form'
= link_to 'Back', events_path

30
app/views/events/show.html.haml

@ -1,30 +0,0 @@
%p#notice= notice
%p
%b Title:
= @event.title
%p
%b Slug:
= @event.slug
%p
%b Event type:
= @event.event_type_id
%p
%b Conference:
= @event.conference
%p
%b Info:
= @event.info
%p
%b Location:
= @event.location
%p
%b Start time:
= @event.start_time
%p
%b End time:
= @event.end_time
= link_to 'Edit', edit_event_path(@event)
\|
= link_to 'Back', events_path

8
app/views/layouts/application.html.haml

@ -8,8 +8,8 @@
%meta{ name: 'description', content: (yield_or_default :description, I18n.t('page_descriptions.home')) }
= csrf_meta_tags
= stylesheets
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' }
%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' }
%link{ href: asset_path(@favicon), rel: 'shortcut icon', type: 'image/x-icon' }
%link{ href: asset_path(@favicon), rel: 'icon', type: 'image/x-icon' }
- @alt_lang_urls.each do |locale, url|
%link{ rel: :alternate, hreflang: locale, href: url }
- if content_for?(:og_image)
@ -18,15 +18,13 @@
%meta{property: 'og:title', content: title}
%meta{property: 'og:type', content: 'website'}
%meta{property: 'og:image', content: og_image}
%meta{name: "theme-color", content: @theme_colour}
= yield :head
%body{ class: page_style }
#primary-content
= render 'shared/navbar'
%main#main
- if content_for?(:side_bar)
%nav#side-bar
= yield :side_bar
%header#banner=yield :banner
- if @submenu
=row do

22
app/views/locations/_form.html.haml

@ -1,22 +0,0 @@
= form_for @location do |f|
- if @location.errors.any?
#error_explanation
%h2= "#{pluralize(@location.errors.count, "error")} prohibited this location from being saved:"
%ul
- @location.errors.full_messages.each do |msg|
%li= msg
.field
= f.label :title
= f.text_field :title
.field
= f.label :address
= f.text_field :address
.field
= f.label :latitude
= f.text_field :latitude
.field
= f.label :longitude
= f.text_field :longitude
.actions
= f.submit 'Save'

7
app/views/locations/edit.html.haml

@ -1,7 +0,0 @@
%h1 Editing location
= render 'form'
= link_to 'Show', @location
\|
= link_to 'Back', locations_path

25
app/views/locations/index.html.haml

@ -1,25 +0,0 @@
%h1 Listing locations
%table
%tr
%th Title
%th Address
%th Latitude
%th Longitude
%th
%th
%th
- @locations.each do |location|
%tr
%td= location.title
%td= location.address
%td= location.latitude
%td= location.longitude
%td= link_to 'Show', location
%td= link_to 'Edit', edit_location_path(location)
%td= link_to 'Destroy', location, :method => :delete, :data => { :confirm => 'Are you sure?' }
%br
= link_to 'New Location', new_location_path

5
app/views/locations/new.html.haml

@ -1,5 +0,0 @@
%h1 New location
= render 'form'
= link_to 'Back', locations_path

18
app/views/locations/show.html.haml

@ -1,18 +0,0 @@
%p#notice= notice
%p
%b Title:
= @location.title
%p
%b Address:
= @location.address
%p
%b Latitude:
= @location.latitude
%p
%b Longitude:
= @location.longitude
= link_to 'Edit', edit_location_path(@location)
\|
= link_to 'Back', locations_path

20
app/views/organizations/_form.html.haml

@ -1,20 +0,0 @@
= form_for @organization do |f|
.columns
= f.text_field :name
= f.text_field :slug
.columns.medium-4.small-text-centered
= f.image_field :avatar, @organization.avatar_url
.columns.medium-8
= f.email_field :email_address
= f.fields_for :locations do |b|
= field_set_tag 'Location' do
= b.country_select :country, {help: 'Select a Country'}
- cc = @organization.locations && @organization.locations[b.index].country ? @organization.locations[b.index].country : 'US'
= b.subregion_select :territory, cc, html: {class: @organization.locations[b.index].country ? 'can' : 'cant', data: {:country => cc}}
= b.text_field :city
= b.text_field :street
= b.text_field :postal_code
.columns
= f.text_area :info
= f.actions :save

6
app/views/organizations/_mini_preview.html.haml

@ -1,6 +0,0 @@
= link_to organization do
%figure.org-mini-preview{:class => (organization.avatar.is_landscape? ? 'landscape' : 'portrait')}
= image_tag organization.avatar.preview.url
%figcaption
%h5= organization.name
%p= location(organization.locations[0])

5
app/views/organizations/_preview.html.haml

@ -1,5 +0,0 @@
= link_to organization do
%h5
= organization.name
%figure.org-preview.preview-tile{:style => (organization.cover? ? ('background-image: url(' + organization.cover.preview.url + ')') : nil)}
= image_tag organization.avatar.preview.url

5
app/views/organizations/edit.html.haml

@ -1,5 +0,0 @@
- page_style :form
= tabs!
.row
= render 'form'

13
app/views/organizations/identity.html.haml

@ -1,13 +0,0 @@
- page_style :form
= tabs!
.row
= form_for @organization do |f|
.columns.medium-4
%h2=_'organization.members.help.title', :t
%p=_'organization.members.help', :p
.columns.medium-8
= f.image_field :cover, @organization.cover_url
= f.number_field :year_founded
= f.actions :save

21
app/views/organizations/index.html.haml

@ -1,21 +0,0 @@
- title _'page.Organizations'
- description 'Bike!Bike! list of DIY bicycle collectives, co-ops, coops, community bike projects, advocacy by country, state, provice, and city'
- banner_image '/assets/orgs.jpg'
- page_style :list
- content_for :banner do
.row
.columns
%h1=_'page.Organizations'
- @organizations.sort_by{|k,v|k}.each do |country,territories|
%h2=country
- territories.sort_by{|k,v|k.to_s}.each do |territory,cities|
- if territory.is_a? String
%h3=territory
- cities.sort_by{|k,v|k}.each do |city,organizations|
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.org-list.preview-list
%li.city
%figure{:style => "background-image: url('" + static_map(CGI::escape(city+' '+country), 4, 600, 300) + "');"}
%h4=city
- organizations.each do |organization|
%li=render 'preview', :organization => organization

15
app/views/organizations/members.html.haml

@ -1,15 +0,0 @@
- page_style :form
= tabs!
.row
= form_for @organization do |f|
.columns.medium-4
%h2=_'organization.members.help.title', :t
%p=_'organization.members.help', :p
.columns.medium-8
.clearfix
= f.fields_for :user_organization_relationships, :include_id => true do |u|
= u.user_select_field :id, @organization.users[u.index], {:relationship => @organization.user_organization_relationships[u.index].relationship || true}
-#attrs: [@organization.user_organization_relationships[u.index]]
= f.actions :save

5
app/views/organizations/new.html.haml

@ -1,5 +0,0 @@
-# banner_title 'Register a New Organization'
- page_style :form
.row
= render 'form'

25
app/views/organizations/show.html.haml

@ -1,25 +0,0 @@
- territory = Carmen::Country.coded(@organization.locations[0].country).subregions.coded(@organization.locations[0].territory)
- location_name = @organization.locations[0].city + (territory ? ' ' + territory.name : '') + ', ' + Carmen::Country.coded(@organization.locations[0].country).name
- title @organization.name + ' (' + location_name + ')'
- description "#{@organization.name} is a bicycle collective, co-op, community bike project, or advocacy group in #{location_name}"
- banner_image @organization.cover_url, id: @organization.cover_attribution_id, name: @organization.cover_attribution_name, user_id: @organization.cover_attribution_user_id, src: @organization.cover_attribution_src
- page_style 'article'
- content_for :banner do
.row{:class => (@organization.avatar.is_landscape? ? 'landscape' : 'portrait')}
.columns{:class => (@organization.avatar.is_landscape? ? nil : ['medium-6', 'medium-push-6'])}
%figure
= image_tag(@organization.avatar.url)
.columns.info{:class => (@organization.avatar.is_landscape? ? nil : ['medium-6', 'medium-pull-6'])}
%h1=@organization.name
- territory = Carmen::Country.coded(@organization.locations[0].country).subregions.coded(@organization.locations[0].territory)
%h2=location_name
%p#notice= notice
= tabs!
%article.row
.columns.large-10
%h2=('About '+@organization.name)
=p @organization, :info

10
app/views/pages/translations_index.html.haml

@ -1,10 +0,0 @@
- content_for :banner do
- image = image_path('grafitti.jpg')
#header-title.short{style: capable_of(:svg) ? nil : "background-image: url(#{image})"}
- if capable_of(:svg)
= render 'application/banner_image.svg', {:image => image}
%h1=_'page_titles.Translations'
%h1=_'translate.Translations'
%article=render 'translations/list'

8
app/views/translations/index.html.haml

@ -1,8 +0,0 @@
- content_for :banner do
- image = image_path('grafitti.jpg')
#header-title.short{style: capable_of(:svg) ? nil : "background-image: url(#{image})"}
- if capable_of(:svg)
= render 'application/banner_image.svg', {:image => image}
%h1=_'page_titles.Translations'
%article=render 'translations/list'

6
app/views/translations/locale.html.haml

@ -1,6 +0,0 @@
- content_for :banner do
#header-title.no-image
%h1=_'translate.translation_pages.Locale_Translations', @locale[:name], :vars => {:language => @locale[:name]}
.lingua-franca-translations
=render 'translations/translation_control'
%article=render 'translations/key_wrapper'

12
app/views/users/_form.html.haml

@ -1,12 +0,0 @@
= form_for @user, :html => (@user && @user.id ? {:multipart => true} : {}) do |f|
%div{:class => (@user.id ? 'columns medium-6' : '')}
= f.text_field :username
= f.email_field :email
- if !@user.id
= f.password_field :password
= f.password_field :password_confirmation
= f.actions :register
- if @user.id
.columns.medium-6
= f.image_field :avatar, @user.avatar_url
= f.actions :save

8
app/views/users/edit.html.haml

@ -1,8 +0,0 @@
- banner_title @user.username
.row
= render 'form'
= link_to 'Show', @user
\|
= link_to 'Back', users_path

22
app/views/users/index.html.haml

@ -1,22 +0,0 @@
- banner_title 'Listing users'
.row
%table
%tr
%th Email
%th Crypted password
%th Salt
%th
%th
%th
- @users.each do |user|
%tr
%td= user.email
%td= user.crypted_password
%td= user.salt
%td= link_to 'Show', user
%td= link_to 'Edit', edit_user_path(user)
%td= link_to 'Destroy', user, :method => :delete, :data => { :confirm => 'Are you sure?' }
= link_to 'New User', new_user_path

6
app/views/users/new.html.haml

@ -1,6 +0,0 @@
- banner_title 'Create an Account'
.row
= render 'form'
= link_to 'Back', users_path

14
app/views/users/show.html.haml

@ -1,14 +0,0 @@
- banner_title @user.username
%p#notice= notice
.row
%p
%b Email:
= @user.email
= image_tag(@user.avatar_url(:thumb)) if @user.avatar?
= link_to 'Edit', edit_user_path(@user)
\|
= link_to 'Back', users_path

4434
config/locales/en.yml

File diff suppressed because it is too large
Loading…
Cancel
Save