From 4e4e96464e70fafed68d00845e5af1ae3a099fea Mon Sep 17 00:00:00 2001 From: Duncan Stuart Date: Wed, 25 Aug 2010 00:08:44 +0100 Subject: [PATCH] Bringing Repository up to date with Live root --- app/controllers/application_controller.rb | 2 + app/controllers/events_controller.rb | 6 +- app/controllers/organisers_controller.rb | 6 +- app/controllers/venues_controller.rb | 6 +- app/helpers/events_helper.rb | 15 +- app/models/event.rb | 13 +- app/views/layouts/main.html.erb | 20 +- app/views/organisers/index.html.erb | 2 + app/views/venues/index.html.erb | 2 +- app/views/website/about.html.erb | 16 +- config/database.yml | 2 +- config/initializers/constants.rb | 9 +- log/.gitignore | 0 log/development.log | 8788 +++++++++++++++++++++ log/production.log | 228 + public/favicon.ico | Bin 4286 -> 1406 bytes public/stylesheets/http_errors.css | 3 +- public/stylesheets/ie.css | 2 + public/stylesheets/playbill.css | 272 +- tmp/.gitignore | 0 20 files changed, 9229 insertions(+), 163 deletions(-) delete mode 100644 log/.gitignore create mode 100644 public/stylesheets/ie.css delete mode 100644 tmp/.gitignore diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5c367665..795b5e60 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,6 +7,8 @@ class ApplicationController < ActionController::Base layout "main" + require 'digest/md5' + # Scrub sensitive parameters from your log # filter_parameter_logging :password end diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 7b5689ec..e0bb970d 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -92,10 +92,8 @@ def destroy def authenticate @cms_page=true - authenticate_or_request_with_http_basic do |username, password| - if username == USERNAME && password == PASSWORD - @authenticated=true - end + @authenticated = authenticate_or_request_with_http_basic do |username, password| + LOGINS[username] == Digest::MD5.hexdigest(password) end end diff --git a/app/controllers/organisers_controller.rb b/app/controllers/organisers_controller.rb index e56e7f48..14ac34c9 100644 --- a/app/controllers/organisers_controller.rb +++ b/app/controllers/organisers_controller.rb @@ -92,10 +92,8 @@ def destroy def authenticate @cms_page=true - authenticate_or_request_with_http_basic do |username, password| - if username == USERNAME && password == PASSWORD - @authenticated=true - end + @authenticated = authenticate_or_request_with_http_basic do |username, password| + LOGINS[username] == Digest::MD5.hexdigest(password) end end end diff --git a/app/controllers/venues_controller.rb b/app/controllers/venues_controller.rb index 2435ab4c..ce54929a 100644 --- a/app/controllers/venues_controller.rb +++ b/app/controllers/venues_controller.rb @@ -92,10 +92,8 @@ def destroy def authenticate @cms_page=true - authenticate_or_request_with_http_basic do |username, password| - if username == USERNAME && password == PASSWORD - @authenticated=true - end + @authenticated = authenticate_or_request_with_http_basic do |username, password| + LOGINS[username] == Digest::MD5.hexdigest(password) end end end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 99b3a76d..c2c93841 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -6,7 +6,7 @@ module EventsHelper #move somewhere general? def row_tag(myclass, day=nil) - tag :li, {:class => add_todayclass(myclass, day)}, false + tag :li, {:class => add_todayclass(myclass, day)}, true end # add an extra event if today is the target day or date @@ -28,13 +28,13 @@ def is_tomorrow(d) def today_label(d) if is_today(d) - content_tag :span, "Today", :id => "today_label" + content_tag :span, "Today", :class => "today_label" end end def tomorrow_label(d) if is_tomorrow(d) - content_tag :span, "Tomorrow", :id => "tomorrow_label" + content_tag :span, "Tomorrow", :class => "tomorrow_label" end end @@ -58,6 +58,9 @@ def social_link(event) event_title_class = "social_title" event_details_class = "social_details" + #Highlight socials which are monthly or more infrequent: + event_title_class += " social_highlight" if event.frequency == 0 || event.frequency >= 4 + event_title = event.title #If this is empty, something has gone wrong, and we shouldn't be displaying anything. Catch this earlier. @@ -130,11 +133,7 @@ def compass_point(event) title = event.venue.compass_text compass = event.venue.compass end - - #TEMPORARY - compass = link_to compass, event - #END OF TEMPORARY - + content_tag :abbr, :title => title, :class => "compass" do compass end diff --git a/app/models/event.rb b/app/models/event.rb index 9c90042c..11a05f57 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -62,11 +62,11 @@ def frequency_text # ---------- # CLASS_TYPES = ['class', 'class with social'] - SOCIAL_TYPES = ['social', 'social with class'] + SOCIAL_TYPES = ['social', 'social with class', 'class with social', 'vintage club'] HAS_CLASS_TYPES = ['class', 'class with social', 'social with class'] def self.event_types - CLASS_TYPES + SOCIAL_TYPES + (CLASS_TYPES + SOCIAL_TYPES).uniq end def is_class? @@ -116,6 +116,7 @@ def dates end def dates_rows + puts "ID=#{id}, #{title}" date_array(",\n") end @@ -164,6 +165,9 @@ def uk_date_from_string(date_string) private + # NOTE: this is a HORRIBLY inefficient way to build up the array, involving multiple passes and sorts. There must be a better way... + + # Get a hash of all dates in the selected range, and the list of all weekly socials occuring on that date def self.weekly_socials_dates #get an array of all the dates under consideration: @@ -206,7 +210,10 @@ def self.other_socials_dates # merge two hashes of dates and socials, concatenating the lists of dates def self.merge_dates_hashes(hash1,hash2) - hash1.merge(hash2) {|key, val1, val2| val1 + val2} + hash1.merge(hash2) do |key, val1, val2| + #have two sorted segments, but need to sort the result... + (val1 + val2).sort{|a,b| a.title <=> b.title} + end end def self.date_array diff --git a/app/views/layouts/main.html.erb b/app/views/layouts/main.html.erb index dce9a6ad..dd32c80a 100644 --- a/app/views/layouts/main.html.erb +++ b/app/views/layouts/main.html.erb @@ -8,12 +8,15 @@ Swing Out London - listings of Lindy Hop classes and socials - <%= stylesheet_link_tag 'reset' %> + <%= stylesheet_link_tag 'reset' %> + <%= stylesheet_link_tag 'playbill' %> <%= stylesheet_link_tag 'cms' if @cms_page==true%> <%= stylesheet_link_tag 'rails_errors' if @cms_page==true%> - + @@ -35,9 +38,18 @@ <%= yield %> <% end %> -