- Timestamp:
- 06/15/08 16:22:05 (7 months ago)
- Files:
-
- trunk/rails/app/controllers/tags_controller.rb (added)
- trunk/rails/app/helpers/tags_helper.rb (added)
- trunk/rails/app/models/tag.rb (added)
- trunk/rails/app/views/home/index.html.erb (modified) (4 diffs)
- trunk/rails/app/views/layouts/home.html.erb (modified) (1 diff)
- trunk/rails/app/views/layouts/tags.html.erb (added)
- trunk/rails/app/views/tags (added)
- trunk/rails/app/views/tags/index.html.erb (added)
- trunk/rails/app/views/tags/show.html.erb (added)
- trunk/rails/config/initializers/railtrackr.rb (modified) (1 diff)
- trunk/rails/config/routes.rb (modified) (1 diff)
- trunk/rails/db (added)
- trunk/rails/db/migrate (added)
- trunk/rails/public/images/tag.png (added)
- trunk/rails/public/javascripts/application.js (modified) (1 diff)
- trunk/rails/public/stylesheets/scaffold.css (modified) (1 diff)
- trunk/rails/test/fixtures/tags.yml (added)
- trunk/rails/test/functional/tags_controller_test.rb (added)
- trunk/rails/test/unit/tag_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rails/app/views/home/index.html.erb
r9 r10 16 16 </table> 17 17 18 <p style="margin: 0;padding: 0; margin-top: 100px"> Username or e-mail address: </p>18 <p style="margin: 0;padding: 0; margin-top: 100px">Browse photos: </p> 19 19 <p style="color: red"><%= flash[:notice] %></p> 20 20 <% form_for :flickr_user , :url => { :controller => "flickr_users" , :action => "create" } do |f| %> … … 23 23 <% end %> 24 24 <script>$("flickr_user_username").focus()</script> 25 <p style="font-size: 80%" id="coverFlowParagraphId">You can also click on a photo in the Cover Flow</p> 25 <p style="font-size: 80%" id="coverFlowParagraphId"> 26 Type in a Flickr username or mail address. <br /> 27 You can also click on a photo in the Cover Flow 28 </p> 29 <p><sup style="color:red">new!</sup><%= link_to "Browse Flickr Tags" , :controller => 'tags' %> with RailTrackr!</p> 26 30 </div> 27 31 … … 42 46 } 43 47 44 function open_user(imgnum) {45 $("coverFlowParagraphId").innerHTML = "Loading photosets from the requested user..."46 location.href = "<%= flickr_users_url %>/" + imgs[imgnum].owner;47 }48 49 function show(obj) {50 var imgEl = new Element('img', {src: imgs[curimg].src, id: "coverFlowImageId" });51 var a = new Element('a', { onclick: "open_user(" + curimg + ")" , style: "cursor:pointer"})52 a.appendChild(imgEl);53 $('coverFlowId').update(a);54 cvi_reflex.add(document.getElementById("coverFlowImageId"), { tilt: "right", distance: 5, border: 10, transparency: 80,color: "#ffffff" });55 Effect.Appear($('coverFlowId'), {duration: 0.5});56 setTimeout(load_next_image,5000);57 }58 59 function fade_and_show() {60 Effect.Fade($('coverFlowId'), { duration: 0.5, afterFinish: show});61 }62 63 function load_next_image() {64 curimg = Math.floor(Math.random()*imgs.length);65 var img = new Image ;66 img.onload = fade_and_show67 img.src = imgs[curimg].src;68 }69 70 48 Event.observe(window,'load', 71 49 function() { … … 73 51 show_no_images_warning(); 74 52 } else { 75 load_next_image();53 new Slideshow($('coverFlowId'), $("coverFlowParagraphId"), "<%= flickr_users_url %>/", imgs, true).start(); 76 54 } 77 }); 78 55 }); 79 56 </script> 80 57 <%= footer %> trunk/rails/app/views/layouts/home.html.erb
r4 r10 10 10 <%= javascript_include_tag 'effects' %> 11 11 <%= javascript_include_tag 'cvi_reflex_lib' %> 12 <%= javascript_include_tag 'application' %> 12 13 </head> 13 14 <body> trunk/rails/config/initializers/railtrackr.rb
r9 r10 4 4 ::AppConfig = OpenStruct.new 5 5 AppConfig.FLICKR_UNDEF = "API_KEY_MISSING" 6 AppConfig.CONFIG_FILE = File.dirname(__FILE__) + "/../railtrackr_#{ENV['RAILS_ENV'] }.yml"6 AppConfig.CONFIG_FILE = File.dirname(__FILE__) + "/../railtrackr_#{ENV['RAILS_ENV'] ? ENV['RAILS_ENV'] : "development"}.yml" 7 7 8 8 config = YAML.load_file(AppConfig.CONFIG_FILE) trunk/rails/config/routes.rb
r4 r10 1 1 ActionController::Routing::Routes.draw do |map| 2 # map.resources :photos3 4 # map.resources :photosets5 2 6 3 map.resources :flickr_users 4 7 5 map.resources :flickr_users, :has_many => :photosets 8 6 map.resources :photosets, :has_many => :photos 7 map.resources :tags 9 8 10 9 # The priority is based upon order of creation: first created -> highest priority. trunk/rails/public/javascripts/application.js
r4 r10 1 1 // Place your application-specific JavaScript functions and classes here 2 2 // This file is automatically included by javascript_include_tag :defaults 3 4 var Slideshow = Class.create({ 5 initialize: function(placeholder, messageholder, flickr_users_url, imgs, opt_random_order) { 6 this.placeholder = $(placeholder); 7 this.messageholder = $(messageholder); 8 this.flickr_users_url = flickr_users_url; 9 this.imgs = imgs; 10 this.random_order = opt_random_order; 11 this.curImgNum = 0; 12 this.curImg = null; 13 }, 14 15 open_user: function(imgnum) { 16 this.messageholder.innerHTML = "Loading photosets from the requested user..." 17 location.href = this.flickr_users_url + this.imgs[this.curImgNum].owner; 18 }, 19 20 show: function() { 21 var imgEl = new Element('img', {src: this.imgs[this.curImgNum].src, id: "coverFlowImageId" }); 22 var a = new Element('a', { style: "cursor:pointer"}); 23 a.appendChild(imgEl); 24 this.placeholder.update(a); 25 Event.observe(a, 'click', this.open_user.bind(this, this.curImgNum)); 26 cvi_reflex.add(document.getElementById("coverFlowImageId"), { tilt: "right", distance: 5, border: 10, transparency: 80,color: "#ffffff" }); 27 Effect.Appear(this.placeholder, {duration: 0.5}); 28 setTimeout(this.load_next_image.bind(this),5000); 29 }, 30 31 fade_and_show: function() { 32 Effect.Fade(this.placeholder, { duration: 0.5, afterFinish: this.show.bind(this)}); 33 }, 34 35 load_next_image: function() { 36 if (this.random_order) { 37 this.curImgNum = Math.floor(Math.random()*this.imgs.length); 38 } else { 39 this.curImgNum += 1; 40 if (this.curImgNum == this.imgs.length) { 41 this.curImgNum = 0; 42 } 43 } 44 this.curImg = new Image ; 45 this.curImg.onload = this.fade_and_show.bind(this); 46 this.curImg.src = this.imgs[this.curImgNum].src; 47 }, 48 49 start: function() { 50 this.load_next_image(); 51 } 52 }); trunk/rails/public/stylesheets/scaffold.css
r4 r10 89 89 } 90 90 91 div.tagSelector { 92 cursor: pointer; 93 border: 1px solid transparent; 94 width: 250px; 95 } 96 97 div.tagSelector:hover { 98 background-color: #FFEDDD; 99 border-top: 1px solid #999; 100 border-left: 1px solid #999; 101 border-bottom: 1px solid #fff; 102 border-right: 1px solid #fff; 103 } 104