Assembla home | Assembla project page
 

Changeset 9

Show
Ignore:
Timestamp:
06/15/08 10:56:14 (6 months ago)
Author:
battlehorse
Message:

Fixes #14. Provide a first-time wizard to configure application at first launch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rails

    • Property svn:ignore set to
      log
  • trunk/rails/app/controllers/application.rb

    r4 r9  
    33 
    44class ApplicationController < ActionController::Base 
     5  before_filter :welcome_check 
     6   
    57  helper :all # include all helpers, all the time 
    68 
     
    810  # Uncomment the :secret if you're not using the cookie session store 
    911  protect_from_forgery # :secret => 'a5f2541f4f32fffc2fe6698f2cbb8dbf' 
     12   
     13  def welcome_check 
     14    redirect_to :controller => "welcome" if AppConfig.flickr == AppConfig.FLICKR_UNDEF 
     15  end 
    1016end 
  • trunk/rails/app/views/home/index.html.erb

    r7 r9  
    3333        var curimg = 0; 
    3434         
     35        function show_no_images_warning() { 
     36          var warningEl = new Element('p', { 'style' : 'color:red'}); 
     37          warningEl.appendChild(document.createTextNode('No images found.')); 
     38          warningEl.appendChild(new Element('br')); 
     39          warningEl.appendChild(document.createTextNode(' You may want to double-check your configuration file and restart RailTrackr.')); 
     40          $('coverFlowId').appendChild(warningEl); 
     41          $('coverFlowId').appendChild(document.createTextNode('<%= AppConfig.CONFIG_FILE %>')); 
     42        } 
     43         
    3544        function open_user(imgnum) { 
    3645          $("coverFlowParagraphId").innerHTML = "Loading photosets from the requested user..." 
     
    6170        Event.observe(window,'load', 
    6271          function() { 
    63             load_next_image(); 
     72            if (imgs.length == 0) { 
     73              show_no_images_warning(); 
     74            } else { 
     75              load_next_image(); 
     76            } 
    6477          }); 
    6578         
  • trunk/rails/config/environments/development.rb

    r4 r9  
    1717# Don't care if the mailer can't send 
    1818config.action_mailer.raise_delivery_errors = false 
     19 
     20require 'ruby-debug' 
  • trunk/rails/config/initializers/railtrackr.rb

    r8 r9  
    11require 'ostruct' 
     2require 'yaml' 
    23 
    34::AppConfig = OpenStruct.new 
     5AppConfig.FLICKR_UNDEF = "API_KEY_MISSING" 
     6AppConfig.CONFIG_FILE = File.dirname(__FILE__) + "/../railtrackr_#{ENV['RAILS_ENV']}.yml" 
    47 
    5 # Put your flickr API key here 
    6 AppConfig.flickr = "YOUR API KEY HERE" 
     8config = YAML.load_file(AppConfig.CONFIG_FILE) 
    79 
    8 # Put your Google Analytics code here (old version), if you have one 
    9 AppConfig.urchin = "" 
     10AppConfig.flickr = config['flickrapikey'].blank? ? AppConfig.FLICKR_UNDEF : config['flickrapikey'] 
     11AppConfig.urchin = config['urchin']