flickr stuff basically operational, no error handling.
This commit is contained in:
parent
884e70deb1
commit
5f30a45819
14 changed files with 128 additions and 1 deletions
|
@ -1,2 +1,39 @@
|
||||||
class FlickrController < ApplicationController
|
class FlickrController < ApplicationController
|
||||||
|
require 'flickraw'
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xml
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def photo
|
||||||
|
@pid = params[:id]
|
||||||
|
@pinfo = flickr.photos.getInfo :photo_id => @pid
|
||||||
|
getSizes = flickr.photos.getSizes :photo_id => @pid
|
||||||
|
@psizes = getSizes.find{|m| m.label == "Medium"}
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xml
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def home
|
||||||
|
photos = flickr.photos.search(:user_id => "13827925@N00")
|
||||||
|
random = photos[rand(photos.size)]
|
||||||
|
@pid = random.id
|
||||||
|
@pinfo = flickr.photos.getInfo :secret => random.secret, :photo_id => @pid
|
||||||
|
getSizes = flickr.photos.getSizes :photo_id => @pid
|
||||||
|
@psizes = getSizes.find{|m| m.label == "Medium"}
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xml
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,22 @@
|
||||||
class ScreenshotController < ApplicationController
|
class ScreenshotController < ApplicationController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@screenshots = "x"
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xml
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def single
|
||||||
|
@screenshot = "x"
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xml
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
6
app/views/flickr/_single.html.erb
Normal file
6
app/views/flickr/_single.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="flickr">
|
||||||
|
<div class="border" style="width:<%= @psizes.width %>;">
|
||||||
|
<%= link_to image_tag(@psizes.source, :alt => @pinfo.title), :controller => "flickr", :action => "photo", :id => @pid %>
|
||||||
|
<p><%= @pinfo.title %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
3
app/views/flickr/home.html.erb
Normal file
3
app/views/flickr/home.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<%= render :partial => 'single' %>
|
||||||
|
<div id="header">photogriffy.net</div>
|
||||||
|
<div id="footer">copyright 2009 andrew davidson, all rights reserved</div>
|
0
app/views/flickr/index.html.erb
Normal file
0
app/views/flickr/index.html.erb
Normal file
1
app/views/flickr/photo.html.erb
Normal file
1
app/views/flickr/photo.html.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= render :partial => 'single' %>
|
11
app/views/layouts/application.html.erb
Normal file
11
app/views/layouts/application.html.erb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Photogriffy.net</title>
|
||||||
|
<%= stylesheet_link_tag 'global' %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
0
app/views/screenshot/index.html.erb
Normal file
0
app/views/screenshot/index.html.erb
Normal file
0
app/views/screenshot/single.html.erb
Normal file
0
app/views/screenshot/single.html.erb
Normal file
|
@ -19,7 +19,9 @@ Rails::Initializer.run do |config|
|
||||||
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
||||||
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
||||||
# config.gem "aws-s3", :lib => "aws/s3"
|
# config.gem "aws-s3", :lib => "aws/s3"
|
||||||
|
config.gem "flickraw"
|
||||||
|
|
||||||
|
|
||||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||||
# :all can be used as a placeholder for all plugins not explicitly named
|
# :all can be used as a placeholder for all plugins not explicitly named
|
||||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||||
|
|
|
@ -38,6 +38,15 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
# Install the default routes as the lowest priority.
|
# Install the default routes as the lowest priority.
|
||||||
# Note: These default routes make all actions in every controller accessible via GET requests. You should
|
# Note: These default routes make all actions in every controller accessible via GET requests. You should
|
||||||
# consider removing or commenting them out if you're using named routes and resources.
|
# consider removing or commenting them out if you're using named routes and resources.
|
||||||
|
|
||||||
|
map.connect 'f/i', :controller => "flickr", :action => "index"
|
||||||
|
map.connect 'f/:id', :controller => "flickr", :action => "photo"
|
||||||
|
|
||||||
|
map.connect 's/i', :controller => "screenshot", :action => "index"
|
||||||
|
map.connect 's/:id', :controller => "screenshot", :action => "single"
|
||||||
|
|
||||||
map.connect ':controller/:action/:id'
|
map.connect ':controller/:action/:id'
|
||||||
map.connect ':controller/:action/:id.:format'
|
map.connect ':controller/:action/:id.:format'
|
||||||
|
|
||||||
|
map.root :controller => "flickr", :action => "home"
|
||||||
end
|
end
|
||||||
|
|
1
db/development.sqlite3
Normal file
1
db/development.sqlite3
Normal file
|
@ -0,0 +1 @@
|
||||||
|
S
|
37
public/stylesheets/global.css
Normal file
37
public/stylesheets/global.css
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
body {
|
||||||
|
color: #858C94;
|
||||||
|
background-color: #332920;
|
||||||
|
font-family: Helvetica, Verdana, sans-serif;
|
||||||
|
font-size: .8em;
|
||||||
|
}
|
||||||
|
#wrapper {
|
||||||
|
width:100%;
|
||||||
|
overflow:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
color:#BBB3A6;
|
||||||
|
font-size:1.5em;
|
||||||
|
padding:40px;
|
||||||
|
margin:0 auto;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
color:#BBB3A6;
|
||||||
|
font-size:.6em;
|
||||||
|
margin:0 auto;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.flickr {
|
||||||
|
padding-top:100px;
|
||||||
|
margin:0em auto;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
div.border {
|
||||||
|
background-color:#BBB3A6;
|
||||||
|
padding:5px;
|
||||||
|
margin:0 auto;
|
||||||
|
color:#48362A;
|
||||||
|
}
|
0
tmp/restart.txt
Normal file
0
tmp/restart.txt
Normal file
Loading…
Reference in a new issue