A lot of updates so far today...

This commit is contained in:
Godwin
2014-07-06 19:02:23 -06:00
parent 546f1d4cbd
commit 1907122880
36 changed files with 4157 additions and 236 deletions
+2 -1
View File
@@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base
before_filter :capture_page_info
def capture_page_info
init_vars
$page_info = {:path => request.env['PATH_INFO'], :controller => params['controller'], :action => params['action']}
end
@@ -19,6 +20,6 @@ class ApplicationController < ActionController::Base
end
rescue_from ActiveRecord::PremissionDenied do |exception|
render 'permission_denied', status: 404
render 'permission_denied', status: 403
end
end
+5 -1
View File
@@ -6,12 +6,16 @@ class ConferencesController < ApplicationController
# GET /conferences
def index
#Conference.all.each {|m| m.poster.recreate_versions!}
puts " ------------- CONFERENCE INDEX -------------- "
puts params
@conferences = Conference.all
end
# GET /conferences/1
def show
#puts params[:slug]
puts " --------------------------- "
puts params[:slug]
end
# GET /conferences/new
+28 -5
View File
@@ -8,7 +8,30 @@ class OrganizationsController < ApplicationController
# GET /organizations
def index
@organizations = Organization.all
#Organization.all.each {|m| m.avatar.recreate_versions!}
#Conferences.all.each {|m| m.poster.recreate_versions!}
organizations = Organization.all
@organizations = Hash.new
countries = Hash.new
organizations.each { |organization|
location = organization.locations.first
if !countries.has_key?(location.country)
countries[location.country] = Carmen::Country.coded(location.country)
end
country = countries[location.country]
if !@organizations.has_key?(country.name)
@organizations[country.name] = Hash.new
end
territory = country.subregions.coded(location.territory)
territory_name = territory ? territory.name : 0
if !@organizations[country.name].has_key?(territory_name)
@organizations[country.name][territory_name] = Hash.new
end
if !@organizations[country.name][territory_name].has_key?(location.city)
@organizations[country.name][territory_name][location.city] = Array.new
end
@organizations[country.name][territory_name][location.city] << organization
}
end
# GET /organizations/1
@@ -101,7 +124,7 @@ class OrganizationsController < ApplicationController
countries[location.country.downcase][:territories][location.territory.downcase] = country.subregions.coded(location.territory)
end
territory = countries[location.country.downcase][:territories][location.territory.downcase]
city = URI.encode(location.city.downcase.gsub(/\s/, '-'))
city = URI.encode(location.city.downcase.gsub(/\s/, '-'))
if !orgs[location.country.downcase][location.territory.downcase].has_key?(city)
orgs[location.country.downcase][location.territory.downcase][city] = Hash.new
orgs[location.country.downcase][location.territory.downcase][city][:latitude] = location.latitude
@@ -137,9 +160,9 @@ class OrganizationsController < ApplicationController
private
# Use callbacks to share common setup or constraints between actions.
def set_organization
if params[:slug] != 'json'
@organization = Organization.find_by!(slug: params[:slug] || params[:organization_slug])
end
if params[:slug] != 'json'
@organization = Organization.find_by!(slug: params[:slug] || params[:organization_slug])
end
end
# Only allow a trusted parameter "white list" through.