New look
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
module ActiveRecord
|
||||
class PremissionDenied < RuntimeError
|
||||
end
|
||||
end
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
@@ -8,4 +13,12 @@ class ApplicationController < ActionController::Base
|
||||
def capture_page_info
|
||||
$page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']}
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||
render 'pages/404', status: 404
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::PremissionDenied do |exception|
|
||||
render 'permission_denied', status: 404
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@ class ConferencesController < ApplicationController
|
||||
|
||||
# GET /conferences/1
|
||||
def show
|
||||
#puts params[:slug]
|
||||
end
|
||||
|
||||
# GET /conferences/new
|
||||
@@ -21,6 +22,9 @@ class ConferencesController < ApplicationController
|
||||
|
||||
# GET /conferences/1/edit
|
||||
def edit
|
||||
if !current_user
|
||||
raise ActiveRecord::PremissionDenied
|
||||
end
|
||||
@host = @conference.organizations[0].locations[0]
|
||||
#points = Geocoder::Calculations.bounding_box([@host.latitude, @host.longitude], 50, { :unit => :km })
|
||||
result = Geocoder.search(@host.city + ', ' + @host.territory + ' ' + @host.country).first
|
||||
@@ -100,6 +104,23 @@ class ConferencesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def register
|
||||
set_conference
|
||||
@user = User.new
|
||||
@sub_action = 'registration_register'
|
||||
render :registration
|
||||
end
|
||||
|
||||
def register_step
|
||||
set_conference
|
||||
data = params
|
||||
if params[:conference][:user][:email]
|
||||
user = User.find_by(:email => params[:conference][:user][:email])
|
||||
data[:conference][:user][:username] = user.username
|
||||
end
|
||||
render json: data
|
||||
end
|
||||
|
||||
def add_field
|
||||
set_conference
|
||||
field = RegistrationFormField.find(params[:field])
|
||||
@@ -151,8 +172,18 @@ class ConferencesController < ApplicationController
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference
|
||||
@conference = Conference.find_by(slug: params[:conference_slug] || params[:slug])
|
||||
set_conference_registration
|
||||
@conference = nil
|
||||
if type = ConferenceType.find_by!(slug: params[:conference_type_slug] || 'bikebike')
|
||||
if @conference = Conference.find_by!(slug: params[:conference_slug] || params[:slug], conference_type_id: type.id)
|
||||
set_conference_registration
|
||||
end
|
||||
end
|
||||
if current_user
|
||||
@host_privledge = :admin
|
||||
end
|
||||
#if !@conference
|
||||
# raise ActionController::RoutingError.new('Not Found')
|
||||
#end
|
||||
end
|
||||
|
||||
def set_conference_registration
|
||||
|
||||
@@ -101,12 +101,12 @@ class OrganizationsController < ApplicationController
|
||||
end
|
||||
territory = countries[location.country.downcase][:territories][location.territory.downcase]
|
||||
if !orgs[location.country.downcase][location.territory.downcase].has_key?(location.territory.downcase)
|
||||
orgs[location.country.downcase][location.territory.downcase][location.territory.downcase] = Hash.new
|
||||
orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:latitude] = location.latitude
|
||||
orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:longitude] = location.longitude
|
||||
orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:count] = 0
|
||||
orgs[location.country.downcase][location.territory.downcase][location.city.downcase] = Hash.new
|
||||
orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:latitude] = location.latitude
|
||||
orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:longitude] = location.longitude
|
||||
orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:count] = 0
|
||||
end
|
||||
orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][orgs[location.country.downcase][location.territory.downcase][location.territory.downcase]['count']] = {
|
||||
orgs[location.country.downcase][location.territory.downcase][location.city.downcase][orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:count]] = {
|
||||
:title => org.name,
|
||||
:id => org.id,
|
||||
:logo => org.avatar.url(:thumb),
|
||||
@@ -126,7 +126,7 @@ class OrganizationsController < ApplicationController
|
||||
:url => url_for(org),
|
||||
:order => order
|
||||
}
|
||||
orgs[location.country.downcase][location.territory.downcase][location.territory.downcase][:count] += 1
|
||||
orgs[location.country.downcase][location.territory.downcase][location.city.downcase][:count] += 1
|
||||
order += 1
|
||||
}
|
||||
render :json => orgs.to_json
|
||||
@@ -135,7 +135,9 @@ class OrganizationsController < ApplicationController
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_organization
|
||||
@organization = Organization.find_by(slug: params[:slug] || params[:organization_slug])
|
||||
if params[:slug] != 'json'
|
||||
@organization = Organization.find_by!(slug: params[:slug] || params[:organization_slug])
|
||||
end
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
|
||||
@@ -3,6 +3,7 @@ include ApplicationHelper
|
||||
class PagesController < ApplicationController
|
||||
|
||||
def home
|
||||
@conference = Conference.find(:first, :order => "start_date DESC")
|
||||
end
|
||||
|
||||
def translate
|
||||
|
||||
Reference in New Issue
Block a user