diff --git a/Gemfile b/Gemfile index df0c8566..3d0bbe60 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem 'activerecord-session_store' gem 'authlogic' gem 'd3js-rails', '~> 3.1.6' gem 'exception_notification', '~> 4' +gem 'flickraw' gem 'haml-rails' gem 'jquery-rails', '~> 2.1.4' gem 'mechanize' @@ -25,6 +26,7 @@ gem 'will_paginate', '~> 3.0' gem 'yaml_db' gem 'rubycas-client', :git => 'git://github.com/rubycas/rubycas-client.git' + group :development, :test do gem 'autotest-standalone' gem 'rspec-rails' diff --git a/Gemfile.lock b/Gemfile.lock index f157bc97..f3992767 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,6 +67,7 @@ GEM ffi-compiler (0.1.3) ffi (>= 1.0.0) rake + flickraw (0.9.8) haml (4.0.5) tilt haml-rails (0.5.3) @@ -204,6 +205,7 @@ DEPENDENCIES autotest-standalone d3js-rails (~> 3.1.6) exception_notification (~> 4) + flickraw haml-rails jquery-rails (~> 2.1.4) mechanize diff --git a/app/assets/stylesheets/home.css.erb b/app/assets/stylesheets/home.css.erb index c6d43746..ebc49de3 100644 --- a/app/assets/stylesheets/home.css.erb +++ b/app/assets/stylesheets/home.css.erb @@ -78,22 +78,6 @@ background: #f7e26b; } -#main #what_sec{ - background: url(<%= asset_path 'site/hkn_members.png' %>); -} - -#main #student-services_sec{ - background: url(<%= asset_path 'site/hkn_tutoring.png' %>); -} - -#main #ind_rel_sec{ - background: url(<%= asset_path 'site/hkn_faculty.png' %>); -} - -#main #membership_sec{ - background: url(<%= asset_path 'site/hkn_banquet.png' %>); -} - /*Tutoring Calendar*/ #daily_tutoring_schedule th{ border: none; diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index cf160b6e..782de261 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,6 @@ class HomeController < ApplicationController helper EventsHelper - + require 'flickraw' def index @events = Event.upcoming_events(0, @current_user) @show_searcharea = true @@ -18,6 +18,28 @@ def index else @tutoring_message = prop.tutoring_message end + + FlickRaw.api_key="bb6eccbf731a58f02b4acacfcb36e85d" + FlickRaw.shared_secret="aa8d976469254029" + default_photos = [ActionController::Base.helpers.asset_path('site/hkn_members.png'), ActionController::Base.helpers.asset_path('site/hkn_tutoring.png'), ActionController::Base.helpers.asset_path('site/hkn_faculty.png'), ActionController::Base.helpers.asset_path('site/hkn_banquet.png')] + @photo_links = [] + photo_indices = [] + for i in 0..3 + photo_index = rand(1000) + while photo_indices.include? photo_index + photo_index = rand(1000) + end + photo = flickr.people.getPublicPhotos(:user_id => '121225723@N05', :per_page => '1', :page => photo_index.to_s) + break if photo.nil? + photo_id = photo[0].id + sizes = flickr.photos.getSizes(:photo_id => photo_id) + link = sizes[5].source + photo_indices << photo_index + @photo_links << link + end + if @photo_links.length < 4 + @photo_links = default_photos + end end def factorial diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 4b4de31f..d6b24276 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -41,7 +41,7 @@
Membership in Eta Kappa Nu is extended to undergraduates in the top fourth of the junior class and the top third of the senior class in EECS, and all continuing EE graduate students. Interested students should watch for the list of eligible names, which is posted around Cory Hall and Soda Hall about a month after the beginning of each semester.