Assembla home | Assembla project page
 

Changeset 10

Show
Ignore:
Timestamp:
06/15/08 16:22:05 (4 months ago)
Author:
battlehorse
Message:

Fixes #18 : tags browsing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rails/app/views/home/index.html.erb

    r9 r10  
    1616  </table> 
    1717   
    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> 
    1919  <p style="color: red"><%= flash[:notice] %></p> 
    2020  <% form_for :flickr_user , :url => { :controller => "flickr_users" , :action => "create" } do |f| %> 
     
    2323  <% end %> 
    2424  <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> 
    2630</div> 
    2731 
     
    4246        } 
    4347         
    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_show 
    67           img.src = imgs[curimg].src; 
    68         } 
    69          
    7048        Event.observe(window,'load', 
    7149          function() { 
     
    7351              show_no_images_warning(); 
    7452            } else { 
    75               load_next_image(); 
     53              new Slideshow($('coverFlowId'), $("coverFlowParagraphId"), "<%= flickr_users_url %>/", imgs, true).start(); 
    7654            } 
    77           }); 
    78          
     55    }); 
    7956</script> 
    8057<%= footer %> 
  • trunk/rails/app/views/layouts/home.html.erb

    r4 r10  
    1010  <%= javascript_include_tag 'effects' %> 
    1111  <%= javascript_include_tag 'cvi_reflex_lib' %> 
     12  <%= javascript_include_tag 'application' %> 
    1213</head> 
    1314<body> 
  • trunk/rails/config/initializers/railtrackr.rb

    r9 r10  
    44::AppConfig = OpenStruct.new 
    55AppConfig.FLICKR_UNDEF = "API_KEY_MISSING" 
    6 AppConfig.CONFIG_FILE = File.dirname(__FILE__) + "/../railtrackr_#{ENV['RAILS_ENV']}.yml" 
     6AppConfig.CONFIG_FILE = File.dirname(__FILE__) + "/../railtrackr_#{ENV['RAILS_ENV'] ? ENV['RAILS_ENV'] : "development"}.yml" 
    77 
    88config = YAML.load_file(AppConfig.CONFIG_FILE) 
  • trunk/rails/config/routes.rb

    r4 r10  
    11ActionController::Routing::Routes.draw do |map| 
    2   # map.resources :photos 
    3  
    4   # map.resources :photosets 
    52 
    63  map.resources :flickr_users 
     4   
    75  map.resources :flickr_users, :has_many => :photosets    
    86  map.resources :photosets, :has_many => :photos 
     7  map.resources :tags 
    98 
    109  # The priority is based upon order of creation: first created -> highest priority. 
  • trunk/rails/public/javascripts/application.js

    r4 r10  
    11// Place your application-specific JavaScript functions and classes here 
    22// This file is automatically included by javascript_include_tag :defaults 
     3 
     4var 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  
    8989} 
    9090 
     91div.tagSelector { 
     92        cursor: pointer; 
     93        border: 1px solid transparent; 
     94        width: 250px; 
     95} 
     96 
     97div.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