diff --git a/app/controllers/flickr_controller.rb b/app/controllers/flickr_controller.rb index eb5c278..45721f7 100644 --- a/app/controllers/flickr_controller.rb +++ b/app/controllers/flickr_controller.rb @@ -13,7 +13,7 @@ class FlickrController < ApplicationController @pinfo = flickr.photos.getInfo :photo_id => @pid rescue => e flash[:error] = "Photo " + params[:id].to_s + " could not be found. Random photo displayed." - @pid = flickr.photos.search(:user_id => get_user_id).rand.id + @pid = flickr.photosets.getPhotos(:photoset_id => "72157623178098920").photo.rand.id @pinfo = flickr.photos.getInfo :photo_id => @pid end @psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"} @@ -25,7 +25,17 @@ class FlickrController < ApplicationController end def home - @pid = flickr.photos.search(:user_id => get_user_id).rand.id + @pid = flickr.photosets.getPhotos(:photoset_id => "72157623178098920").photo[0].id + @pinfo = flickr.photos.getInfo(:photo_id => @pid) + @psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"} + + respond_to do |format| + format.html + end + end + + def random + @pid = flickr.photosets.getPhotos(:photoset_id => "72157623178098920").photo.rand.id @pinfo = flickr.photos.getInfo(:photo_id => @pid) @psize = flickr.photos.getSizes(:photo_id => @pid).find{|m| m.label == "Medium"} @@ -37,7 +47,7 @@ class FlickrController < ApplicationController def interesting @parray = Array.new - result = flickr.photos.search(:user_id => get_user_id, :per_page => 20, :sort => "interestingness-desc") + result = flickr.photosets.getPhotos(:photoset_id => "72157623178098920", :per_page => 20, :sort => "interestingness-desc").photo for r in result do @parray += [:id => r.id, :source => flickr.photos.getSizes(:photo_id => r.id).find{|m| m.label == "Thumbnail"}.source] end @@ -50,7 +60,7 @@ class FlickrController < ApplicationController def recent @parray = Array.new - result = flickr.photos.search(:user_id => get_user_id, :per_page => 20) + result = flickr.photosets.getPhotos(:photoset_id => "72157623178098920", :per_page => 20).photo for r in result do @parray += [:id => r.id, :source => flickr.photos.getSizes(:photo_id => r.id).find{|m| m.label == "Thumbnail"}.source] end diff --git a/app/views/flickr/_grid.html.erb b/app/views/flickr/_grid.html.erb index 3488111..a50356a 100644 --- a/app/views/flickr/_grid.html.erb +++ b/app/views/flickr/_grid.html.erb @@ -1,3 +1,8 @@ -<% for p in @parray do %> -
<%= @pinfo.title %>
+<%= @pinfo.description %>
<% end %> diff --git a/app/views/flickr/interesting.html.erb b/app/views/flickr/interesting.html.erb index a3f947c..037015e 100644 --- a/app/views/flickr/interesting.html.erb +++ b/app/views/flickr/interesting.html.erb @@ -1,6 +1 @@ -this is just a simple site I use to showcase flickr photos and uploaded screenshots - from little snapper.
-i may consider open sourcing it later, but it's not anything that someone of average - rails ability couldn't do in a couple of hours.
+welcome to another little home of mine on the web.
+i've wanted a photoblog for some time now, so this is what i've coded up to fill that void.
+also take a look at my blog and my lifestream.
<%= link_to "about", {:controller => "info", :action => "about"}, :alt => "about" %> | - <%= link_to "random", {:controller => "flickr", :action => "home"}, :alt => "reload" %> | + <%= link_to "current", {:controller => "flickr", :action => "home"}, :alt => "current" %> | + <%= link_to "random", {:controller => "flickr", :action => "random"}, :alt => "random" %> | <%= link_to "recent", {:controller => "flickr", :action => "recent"}, :alt=> "recent" %> | <%= link_to "interesting", {:controller => "flickr", :action => "interesting"}, :alt => "interesting"%>
diff --git a/config/routes.rb b/config/routes.rb index d4659a7..6574559 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -44,13 +44,15 @@ ActionController::Routing::Routes.draw do |map| map.connect 'u/:user_id/p/:id', :controller => "flickr", :action => "photo", :requirements => { :user_id => /.*/ } map.connect 'u/:user_id', :controller => "flickr", :action => "home", :requirements => {:user_id => /.*/} - map.connect 'r', :controller => "flickr", :action => "recent" - map.connect 'i', :controller => "flickr", :action => "interesting" + map.connect 'recent', :controller => "flickr", :action => "recent" + map.connect 'random', :controller => "flickr", :action => "random" + map.connect 'interesting', :controller => "flickr", :action => "interesting" map.connect 'p/:id', :controller => "flickr", :action => "photo" map.connect 's/i', :controller => "screenshot", :action => "index" map.connect 's/:filename', :controller => "screenshot", :action => "single", :requirements => { :filename => /.*/ } + map.connect 'about', :controller => "info", :action => "about" map.connect 'o/:action', :controller => "info" map.root :controller => "flickr", :action => "home"