diff --git a/CHUCKSLIST-TODO b/CHUCKSLIST-TODO
index 791a0fa..b338f08 100644
--- a/CHUCKSLIST-TODO
+++ b/CHUCKSLIST-TODO
@@ -8,7 +8,7 @@ TODO for v0.2 and beyond (in no particular order)
6. Add RSS feed for each category (instead of just a main one)
7. add ability to upload image(s) with your ad
8. add more tests (we started strong but then got sidetracked)
-9. should we consider making ChucksList an ENGINE - such as
+9. should we consider making ChucksList an ENGINE - such as
10. ability to flag posts as spam/miscategorized/etc.
11. do more to enforce banned authors (ban the IP?)
12. enhance functions for managing authors and ads in admin section
\ No newline at end of file
diff --git a/README b/README
index bb6045b..9d044fc 100644
--- a/README
+++ b/README
@@ -8,18 +8,18 @@ Refer to /doc/INSTALL for setup instructions.
COPYRIGHT AND LICENSE
---------------------
-ChucksList is Copyright (c) 2008 by Alexander Barbara and Kevin Ewe.
+ChucksList is Copyright (c) 2008 by Alexander Barbara and Kevin Ewe.
ChucksList is open source software made available under the GNU GPL License v3. Refer to /doc/LICENSE for details.
WARRANTY
--------
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index ea3e5aa..af6f7fe 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -27,7 +27,7 @@ def signup
return unless request.post?
@user.save!
if !logged_in?
- self.current_user = @user
+ self.current_user = @user
end
#redirect_back_or_default(:controller => '/account', :action => 'index')
#TODO - do redirection to calling page
@@ -39,11 +39,11 @@ def signup
flash[:notice] = "Thanks for signing up!"
redirect_to :controller => 'main', :action => 'index'
end
-
+
rescue ActiveRecord::RecordInvalid
render :action => 'signup'
end
-
+
def logout
self.current_user.forget_me if logged_in?
cookies.delete :auth_token
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index f4c27ca..366585c 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -1,29 +1,29 @@
class AdminController < ApplicationController
include AuthenticatedSystem
-
+
before_filter :login_required
-
+
def index
if (!current_user.isAdmin)
redirect_to :controller => 'main', :action => 'index'
end
end
-
+
def manager
#@ads = Ad.find(:all)
@display_data = Ad.display_paged_data(params[:page])
end
-
+
def authors
@display_data = Author.display_paged_data(params[:page])
end
-
+
def category
@display_data = Category.display_paged_data(params[:page])
@parents = ParentCategory.find(:all)
@parent_categories = @parents.collect { |p| [p.name, p.id] }
end
-
+
def create_category
if request.post? && params[:new_category] != ""
begin
@@ -37,7 +37,7 @@ def create_category
end
redirect_to :action => 'category'
end
-
+
def delete_cat
if request.post?
cat = Category.find(params[:id])
@@ -47,11 +47,11 @@ def delete_cat
end
redirect_to :action => 'category'
end
-
+
def parent_category
@display_data = ParentCategory.display_paged_data(params[:page])
end
-
+
def create_parent_category
if request.post? && params[:parent_category] != ""
begin
@@ -65,7 +65,7 @@ def create_parent_category
end
redirect_to :action => 'parent_category'
end
-
+
def del_parent
#Add check for child dependencies in the model
if request.post?
@@ -75,7 +75,7 @@ def del_parent
redirect_to :action => 'parent_category'
end
end
-
+
def delete_author_and_ads
@author = Author.find_by_id(params[:id])
if request.post? && !@author.nil?
@@ -87,12 +87,12 @@ def delete_author_and_ads
end
redirect_to :action => "authors"
end
-
-
+
+
def user
@display_data = User.display_paged_data(params[:page])
end
-
+
def delete_user
#simple check to prevent last user to be deleted
if request.post? && User.count > 1
@@ -102,7 +102,7 @@ def delete_user
end
redirect_to :action => 'user'
end
-
+
def toggle_user_admin
if request.post?
user = User.find(params[:id])
@@ -117,7 +117,7 @@ def toggle_user_admin
end
redirect_to :action => 'user'
end
-
+
def expire_ad
if request.post?
ad = Ad.find(params[:id])
@@ -126,7 +126,7 @@ def expire_ad
end
redirect_to :action => 'manager'
end
-
+
def extend_ad
if request.post?
ad = Ad.find(params[:id])
@@ -135,7 +135,7 @@ def extend_ad
end
redirect_to :action => 'manager'
end
-
+
def reset_ad
if request.post?
ad = Ad.find(params[:id])
@@ -144,7 +144,7 @@ def reset_ad
end
redirect_to :action => 'manager'
end
-
+
def delete_ad
if request.post?
ad = Ad.find(params[:id])
@@ -153,17 +153,17 @@ def delete_ad
end
redirect_to :action => 'manager'
end
-
+
def destroy
if logged_in?
reset_session
- flash[:notice] = 'You have successfully logged out'
+ flash[:notice] = 'You have successfully logged out'
end
redirect_to :controller => 'main', :action => 'index'
end
-
+
def change_password
- if (params[:old_password].empty? || params[:new_password].empty? )
+ if (params[:old_password].empty? || params[:new_password].empty? )
flash[:warning] = 'Passwords cannot be empty'
render :action => 'pwd'
else
@@ -173,7 +173,7 @@ def change_password
begin
current_user.save!
flash[:notice] = 'Password successfully changed'
- redirect_to :action => "index"
+ redirect_to :action => "index"
rescue ActiveRecord::RecordInvalid => e
flash[:warning] = "Could not change your password: #{e}"
render :action => 'pwd'
@@ -182,9 +182,9 @@ def change_password
flash[:warning] = 'You supplied the wrong password'
render :action => 'pwd'
end
- end
+ end
end
-
+
def reset_password
@user = User.find_by_id(params[:id])
if request.post? && logged_in? && current_user.isAdmin && !@user.nil?
@@ -200,7 +200,7 @@ def reset_password
redirect_to :controller => "main", :action => "index"
end
end
-
+
def ban_user
@user = User.find_by_id(params[:id])
if request.post? && logged_in? && current_user.isAdmin && !@user.nil?
@@ -211,7 +211,7 @@ def ban_user
end
end
end
-
+
def unban_user
@user = User.find_by_id(params[:id])
if request.post? && logged_in? && current_user.isAdmin && !@user.nil?
@@ -222,9 +222,9 @@ def unban_user
end
end
end
-
-
- # not needed for now
+
+
+ # not needed for now
# def edit_category
# @category = Category.find_by_id(params[:id])
# if @category.nil?
@@ -232,7 +232,7 @@ def unban_user
# redirect_to :action => 'index'
# end
# end
-
+
def update_category
# update the category
@category = Category.find_by_id(params[:id])
@@ -248,14 +248,14 @@ def update_category
flash[:warning] = "Error Updating Category"
end
end
-
+
# fail gracefully if non ajax
# (if we make this function ajax)
#respond_to do |format|
# format.html { redirect_to :action => "category" }
# format.js # will just execute the RJS
#end
-
+
redirect_to :action => 'category'
end
@@ -267,7 +267,7 @@ def update_category
# redirect_to :action => 'index'
# end
# end
-
+
def update_ad
@ad = Ad.find_by_id(params[:id])
if @ad.nil?
@@ -285,7 +285,7 @@ def update_ad
end
redirect_to :action => 'manager'
end
-
+
def update_parent_category
# update the category
@parent_category = ParentCategory.find_by_id(params[:id])
@@ -325,6 +325,6 @@ def update_parent_category
# redirect_to :action => 'user'
# end
-
-
+
+
end
diff --git a/app/controllers/ads_controller.rb b/app/controllers/ads_controller.rb
index cb8f5ad..fd8f8e4 100644
--- a/app/controllers/ads_controller.rb
+++ b/app/controllers/ads_controller.rb
@@ -7,10 +7,10 @@ def show
flash[:warning] = 'Error - That Ad Does Not Exist'
redirect_to root_path
end
-
+
@category = @ad.category
end
-
+
# destroy ad with that particular hash
def destroy
if request.post?
@@ -27,10 +27,10 @@ def destroy
end
end
end
-
+
# show a list of ads in a category
- # we need a clever way to do this - if both parent and child categories
- # have a page slug how to identify one vs. the other? might be easier to
+ # we need a clever way to do this - if both parent and child categories
+ # have a page slug how to identify one vs. the other? might be easier to
# inherit then do this code checking tfor a blank array..
def list
@slug = params[:slug]
@@ -40,24 +40,24 @@ def list
redirect_to root_path
end
end
-
-
+
+
# show parent category list for new ad
def post
@parents = ParentCategory.find :all, :order => 'name ASC'
end
-
+
# ajaxy function to show subcategories when they select a parent
def select_category
@parent_category = ParentCategory.find_by_id(params[:id])
end
-
+
# show the ajaxy form for a new ad
def show_form
@category = Category.find_by_id(params[:id])
end
-
+
# ajaxy - create new ad
def new
if (params[:email] != params[:email_verify])
@@ -81,21 +81,21 @@ def new
@ad.ad = params[:ad].gsub("\n", " ")
@ad.expiration = Time.now + 30.days
@ad.author = @author
-
+
# record author IP address
@ad.author_ip = request.env['REMOTE_ADDR']
@ad.save
-
+
# handle image attachments
- @ad.handle_images(params[:image_attachments])
+ @ad.handle_images(params[:image_attachments])
# send confirmation email with activation url
Mailman.deliver_confirmation_email(@ad, @author.email)
flash[:notice] = 'A Confirmation Email Has Been Sent To ' + @author.email
-
+
end
end
-
+
# activate an ad that is new but not active yet
def activate
@ad = Ad.find_by_activation_hash(params[:activation_hash])
@@ -120,8 +120,8 @@ def activate
#end
end
end
-
-
+
+
# manage an ad based on the hash
def manage
@ad = Ad.find_by_activation_hash(params[:activation_hash])
@@ -135,7 +135,7 @@ def manage
#render :action => 'show'
end
end
-
+
# edit an ad based on the hash
def edit
@ad = Ad.find_by_activation_hash(params[:activation_hash])
@@ -147,7 +147,7 @@ def edit
# show the ad and let them edit it
end
end
-
+
# update an ad after someone edits (via the edit form) and hits 'submit'
def update
@ad = Ad.find_by_activation_hash(params[:activation_hash])
@@ -159,51 +159,51 @@ def update
@ad.ad = params[:ad].gsub("\n", " ")
@ad.title = params[:title]
if @ad.save
-
+
# handle image attachments
@ad.handle_images(params["image_attachments"])
-
+
flash[:notice] = "Ad Updated Successfully"
else
flash[:warning] = "Error Updating Ad"
end
redirect_to :controller => 'ads', :action => 'manage', :activation_hash => @ad.activation_hash
- end
+ end
end
-
+
def delete_image
@ad = Ad.find_by_activation_hash(params[:activation_hash])
@ad_image = @ad.ad_images.find_by_id(params[:id])
-
+
if @ad_image.destroy
flash[:notice] = "Ad Image Deleted"
else
flash[:warning] = "Unable to Find Ad Image to Delete"
end
-
+
redirect_to :controller => 'ads', :action => 'manage', :activation_hash => @ad.activation_hash
end
-
-
+
+
# rss feed for the whole site
def feed
@ads = Ad.all_active
-
+
respond_to do |format|
format.rss { render :layout => false }
format.atom # index.atom.builder
end
end
-
+
# rss feed for just one category
def category_feed
@ads = Ad.all_active_by_slug(params[:slug])
-
+
respond_to do |format|
format.rss { render :layout => false }
format.atom # index.atom.builder
end
end
-
-
+
+
end
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index 1f9cf5e..68df7b0 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -3,10 +3,10 @@
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
- include AuthenticatedSystem
+ include AuthenticatedSystem
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => '71bf309b503986bd21afc01d170ccb13'
-
-
+
+
end
diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
index 596ad4f..b3d5fc1 100644
--- a/app/controllers/main_controller.rb
+++ b/app/controllers/main_controller.rb
@@ -8,6 +8,6 @@ def index
flash[:warning] = "No categories are set up. Either add them in the Admin section, or run 'rake db:fixtures:import'. (Refer to README file for installation instructions.)"
end
end
-
-
+
+
end
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index d8ddba7..cc433d1 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -1,5 +1,5 @@
module AdminHelper
-
+
# UNTESTED
# I came across this here: http://www.railsforum.com/viewtopic.php?pid=7689
# and thought it could come in handy later..
@@ -11,9 +11,9 @@ module AdminHelper
# end
# end
-
+
def ad_text_area_size(ad)
((ad.ad.size/255)+1*4)
end
-
+
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4617316..6fb19e4 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,21 +1,21 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
-
+
#@TODO - both methods will be removed - next commit
# Placeholder method - email address constant
def garbage_email_address
"garbage@chuckslist.org"
end
-
+
# Generate random number from values
def random(values = nil)
if values.respond_to? :sort_by
values.sort_by { rand }.first
- else
+ else
rand(values)
end
end
-
+
def is_admin
if logged_in? && current_user.isAdmin
return true
@@ -23,12 +23,12 @@ def is_admin
return false
end
end
-
+
def rss_url(slug)
if slug
- return '/' + slug + '/feed'
- else
- return '/feed'
+ return '/' + slug + '/feed'
+ else
+ return '/feed'
end
end
diff --git a/app/models/ad.rb b/app/models/ad.rb
index b87132f..4e1e755 100644
--- a/app/models/ad.rb
+++ b/app/models/ad.rb
@@ -2,49 +2,49 @@
class Ad < ActiveRecord::Base
belongs_to :category
belongs_to :author
-
+
has_many :ad_images
-
+
validate :expiration_is_set
-
+
def handle_images(image_attachments)
return unless image_attachments.respond_to? :each
-
+
image_attachments.each do |image|
ad_image = self.ad_images.build(:uploaded_data => image)
ad_image.save
end
end
-
+
def expiration_is_set
if expiration.nil?
expiration = Time.now + 30.days
end
end
-
+
def expire!
self.expiration = Time.now - 1.day
self.save
end
-
+
def extend!
self.expiration = Time.now + 30.days
self.save
end
-
+
def reset!
self.active = false
self.save
end
-
+
def expired?
self.expiration < Time.now
end
-
+
# TODO
- def self.fetch_by_category_slug(slug)
+ def self.fetch_by_category_slug(slug)
end
-
+
# activate an ad
# pass the activation hash/params as "conf"
# let the model validate it for us
@@ -60,12 +60,12 @@ def activate(conf)
return false
end
end
-
-
+
+
def self.all_active
find(:all, :conditions => ['expiration > ? and active = ?', Time.now, true], :order => 'created_at ASC')
end
-
+
def self.all_active_by_slug(slug)
category = Category.find_by_slug(slug)
if category
@@ -79,16 +79,16 @@ def self.all_active_by_slug(slug)
end
return false
end
-
-
+
+
find(:all, :conditions => ['expiration > ? and active = ?', Time.now, true], :order => 'created_at ASC')
end
-
+
def self.display_paged_data(page)
paginate(:page => page, :per_page => 10,:order => "id")
end
-
-
+
+
protected
def before_create
self.activation_hash = UUID.new
@@ -101,7 +101,7 @@ def before_create
end
-
-
-
+
+
+
end
diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb
index 3fd076a..6d85c9a 100644
--- a/app/models/ad_image.rb
+++ b/app/models/ad_image.rb
@@ -1,18 +1,18 @@
class AdImage < ActiveRecord::Base
belongs_to :ad
-
+
# allow image attachments
has_attachment :content_type => :image,
:max_size => 1.megabytes,
:storage => :file_system,
# uncomment the next line to use S3 (you'll need to set it up and add a config)
# :storage => :s3,
-
+
# uncomment the next line to generate thumbnails
:thumbnails => { :thumb => 70, :show => ">500x500" },
:processor => :mini_magick
-
+
validates_as_attachment
-
+
end
diff --git a/app/models/author.rb b/app/models/author.rb
index e8b717e..bb02016 100644
--- a/app/models/author.rb
+++ b/app/models/author.rb
@@ -2,15 +2,15 @@ class Author < ActiveRecord::Base
validates_length_of :email, :within => 3..100
validates_uniqueness_of :email, :case_sensitive => false
has_many :ads do
-
+
def active
find(:all, :conditions => ["expiration > ? and active = ?", Time.now, true])
end
-
+
def remove_all
find(:all).each { |a| a.destroy }
end
-
+
end
diff --git a/app/models/category.rb b/app/models/category.rb
index 817dd48..400e35f 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -1,44 +1,44 @@
class Category < ActiveRecord::Base
has_many :ads
belongs_to :parent_category
-
+
validates_presence_of :name
validates_uniqueness_of :name, :case_sensitive => false
validates_length_of :name, :within => 4..40
validates_presence_of :slug
validates_uniqueness_of :slug, :case_sensitive => false
validates_length_of :slug, :within => 3..40
-
-
-
+
+
+
# set default categories
def self.set_defaults
if self.find(:all).blank?
# set default parents
ParentCategory.set_defaults
-
+
# parent: "for sale"
c = self.create(:name => 'books', :slug => 'bks', :parent_category_id => 1)
c = self.create(:name => 'cars & trucks', :slug => 'car', :parent_category_id => 1)
c = self.create(:name => 'electronics', :slug => 'ele', :parent_category_id => 1)
-
+
# parent: "jobs"
c = self.create(:name => "admin / office", :slug => 'ofc', :parent_category_id => 2)
c = self.create(:name => 'customer service', :slug => 'csr', :parent_category_id => 2)
c = self.create(:name => 'writing / editing', :slug => 'wri', :parent_category_id => 2)
-
+
# parent: "services"
c = self.create(:name => 'computer', :slug => 'cps', :parent_category_id => 3)
c = self.create(:name => 'financial', :slug => 'fns', :parent_category_id => 3)
c = self.create(:name => 'real estate', :slug => 'rts', :parent_category_id => 3)
-
+
# parent: "gigs"
c = self.create(:name => 'event', :slug => 'evg', :parent_category_id => 4)
c = self.create(:name => 'labor', :slug => 'lbg', :parent_category_id => 4)
c = self.create(:name => 'talent', :slug => 'tlg', :parent_category_id => 4)
end
end
-
+
def self.display_paged_data(page)
paginate(:page => page, :per_page => 10,:order => "name")
end
diff --git a/app/models/mailman.rb b/app/models/mailman.rb
index 55fabb3..4bc0c68 100644
--- a/app/models/mailman.rb
+++ b/app/models/mailman.rb
@@ -1,6 +1,6 @@
class Mailman < ActionMailer::Base
- helper :application
-
+ helper :application
+
def receive(email)
ad_enquiry_email_regex = /^\d{18}@(chuckslist.org)$/
#post_confirmation_email_regex = /^([a-zA-Z]{22}@(chuckslist.org))$/
@@ -10,9 +10,9 @@ def receive(email)
#catch all - decision? Junk the email or
# redirect to garbage@chuckslist.com?
Mailman.deliver_forward_email(email)
- end
+ end
end
-
+
# this e-mail gets send for confirmation before the ad is activated
def confirmation_email(ad, author)
recipients author
@@ -20,15 +20,15 @@ def confirmation_email(ad, author)
subject "Your Ad Activation"
body :ad => ad
end
-
+
# this e-mail gets sent after activation
def activation_email(ad, author)
recipients author
from "ChucksList "
subject "Your Ad Has Been Activated"
body :ad => ad
- end
-
+ end
+
# this gets sent when password has been reset
def password_reset_email(user, password)
recipients user
@@ -36,7 +36,7 @@ def password_reset_email(user, password)
subject "Your Password Has Been Reset"
body :password => password
end
-
+
#-------------------------------------------------------------------------------
private
def forward_email(email)
@@ -45,7 +45,7 @@ def forward_email(email)
subject email.subject
body :email => email
end
-
+
def unmulch(mulched_address)
@ad = Ad.find(:first, :conditions => ["email = ?", mulched_address])
if @ad.nil?
diff --git a/app/models/parent_category.rb b/app/models/parent_category.rb
index 9c0be35..01aa4ff 100644
--- a/app/models/parent_category.rb
+++ b/app/models/parent_category.rb
@@ -1,23 +1,23 @@
class ParentCategory < ActiveRecord::Base
has_many :categories do
-
+
def in_order
find(:all, :order => 'name ASC')
end
-
+
end
-
-
+
+
def all_ads
@subcats = self.categories
@results = []
@subcats.each { |c| c.ads.all_active.each { |a| @results << a } }
-
+
return @results
end
-
-
+
+
def self.set_defaults
if self.find(:all).blank?
c = self.create(:name => 'for sale', :slug => 'forsale')
@@ -26,7 +26,7 @@ def self.set_defaults
c = self.create(:name => 'gigs', :slug => 'gigs')
end
end
-
+
def self.display_paged_data(page)
self.paginate(:page => page, :per_page => 10,:order => "name")
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 92307c4..5f6f7f1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -34,9 +34,9 @@ def authenticated?(password)
end
def remember_token?
- remember_token_expires_at && Time.now.utc < remember_token_expires_at
+ remember_token_expires_at && Time.now.utc < remember_token_expires_at
end
-
+
# These create and unset the fields required for remembering users between browser closes
def remember_me
self.remember_token_expires_at = 2.weeks.from_now.utc
@@ -49,22 +49,22 @@ def forget_me
self.remember_token = nil
save(false)
end
-
+
def no_users?
User.count == 0
end
-
+
def self.display_paged_data(page)
paginate(:page => page, :per_page => 10,:order => "id")
end
-
+
# reset password to a random password
# return the password if successful,
# else return false
def reset_password(length = 8)
- chars = ("a".."z").to_a
- chars += ("A".."Z").to_a
- chars += ("0".."9").to_a
+ chars = ("a".."z").to_a
+ chars += ("A".."Z").to_a
+ chars += ("0".."9").to_a
new_password = ""
1.upto(length) { |i| new_password << chars[rand(chars.size-1)] }
@@ -78,17 +78,17 @@ def reset_password(length = 8)
end
protected
- # before filter
+ # before filter
def encrypt_password
return if password.blank?
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--") if new_record?
self.crypted_password = encrypt(password)
end
-
+
def password_required?
crypted_password.blank? || !password.blank?
end
-
+
def first_record_is_admin
if no_users?
self.isAdmin = true
diff --git a/app/views/account/index.rhtml b/app/views/account/index.rhtml
index d600d59..76e6053 100644
--- a/app/views/account/index.rhtml
+++ b/app/views/account/index.rhtml
@@ -1,53 +1,53 @@
In the Caboose.
<% content_for 'poem' do -%>
-"Train delayed? and what's to say?"
-"Blocked by last night's snow they say."
-Seven hours or so to wait;
-Well, that's pleasant! but there's the freight.
-Depot loafing no one fancies,
-We'll try the caboose and take our chances.
-
-Cool this morning in Watertown,
-Somewhat frosty___mercury down;
-Enter caboose___roaring fire,
-With never an air-hole; heat so dire
-That we shrivel and pant; we are roasted through-
-Outside, thermometer thirty-two.
-
-We start with a jerk and suddenly stop.
-"What's broke?" says one; another "What's up?",
-"Oh, nothing," they answer, "That's our way:
-You must stand the jerking, sorry to say."
-We "stand it" with oft this painful thought:
-Are our heads on yet, or are they not?
-
-Comrades in misery___let me see;
-Girl like a statue opposite me;
-Back and forth the others jostle___
-She never winks, nor moves a muscle;
-See her, as she sits there now;
-She's "well balanced," anyhow.
-
-Woman in trouble, tearful eyes,
-Sits by the window, softly cries,
-Pity___for griefs we may not know,
-For breasts that ache, for tears that flow,
-Though we know not why. Her eyelids red
-Tell a sorrowful tale___some hope is dead.
-
-Man who follows the Golden Rule,
-And lends his papers___a pocket full,
-Has a blank book___once in a minute
-Has an idea, and writes it in it.
-Guess him? Yes, of course I can,
-He's a___well___a newspaper man.
-
-Blue-eyed fairy, wrapped in fur;
-Sweet young mother tending her.
-Fairy thinks it's "awful far,"
-Wants to get off this "naughty car."
-So do we, young golden-hair;
+"Train delayed? and what's to say?"
+"Blocked by last night's snow they say."
+Seven hours or so to wait;
+Well, that's pleasant! but there's the freight.
+Depot loafing no one fancies,
+We'll try the caboose and take our chances.
+
+Cool this morning in Watertown,
+Somewhat frosty___mercury down;
+Enter caboose___roaring fire,
+With never an air-hole; heat so dire
+That we shrivel and pant; we are roasted through-
+Outside, thermometer thirty-two.
+
+We start with a jerk and suddenly stop.
+"What's broke?" says one; another "What's up?",
+"Oh, nothing," they answer, "That's our way:
+You must stand the jerking, sorry to say."
+We "stand it" with oft this painful thought:
+Are our heads on yet, or are they not?
+
+Comrades in misery___let me see;
+Girl like a statue opposite me;
+Back and forth the others jostle___
+She never winks, nor moves a muscle;
+See her, as she sits there now;
+She's "well balanced," anyhow.
+
+Woman in trouble, tearful eyes,
+Sits by the window, softly cries,
+Pity___for griefs we may not know,
+For breasts that ache, for tears that flow,
+Though we know not why. Her eyelids red
+Tell a sorrowful tale___some hope is dead.
+
+Man who follows the Golden Rule,
+And lends his papers___a pocket full,
+Has a blank book___once in a minute
+Has an idea, and writes it in it.
+Guess him? Yes, of course I can,
+He's a___well___a newspaper man.
+
+Blue-eyed fairy, wrapped in fur;
+Sweet young mother tending her.
+Fairy thinks it's "awful far,"
+Wants to get off this "naughty car."
+So do we, young golden-hair;
All this crowd are with you there!
<% end -%>
diff --git a/app/views/admin/_ad.html.erb b/app/views/admin/_ad.html.erb
index 3272ff0..cdc041a 100644
--- a/app/views/admin/_ad.html.erb
+++ b/app/views/admin/_ad.html.erb
@@ -12,4 +12,4 @@
<%= link_to image_tag('/images/trash2.png'), {:action => 'delete_ad', :id => ad}, {:method => :post, :confirm => "Confirm Delete Ad:#{ad.title}"} %>
-<%= render :partial => 'edit_ad_form', :locals => { :ad => ad }%>
\ No newline at end of file
+<%= render :partial => 'edit_ad_form', :locals => { :ad => ad }%>
\ No newline at end of file
diff --git a/app/views/admin/_admin.html.erb b/app/views/admin/_admin.html.erb
index 65ef8a6..6c6b52d 100644
--- a/app/views/admin/_admin.html.erb
+++ b/app/views/admin/_admin.html.erb
@@ -2,7 +2,7 @@
diff --git a/app/views/admin/_edit_category_form.html.erb b/app/views/admin/_edit_category_form.html.erb
index 2551f36..585bf08 100644
--- a/app/views/admin/_edit_category_form.html.erb
+++ b/app/views/admin/_edit_category_form.html.erb
@@ -1,10 +1,10 @@
<% # can't get the ajax form working yet! FRUSTRATING!! '%>
<% @category = category # because @category is nil but we need it to use a form_for tag %>
-
diff --git a/app/views/admin/_edit_parent_category_form.html.erb b/app/views/admin/_edit_parent_category_form.html.erb
index 33e6708..bce02dd 100644
--- a/app/views/admin/_edit_parent_category_form.html.erb
+++ b/app/views/admin/_edit_parent_category_form.html.erb
@@ -1,8 +1,8 @@
<% # can't get the ajax form working yet! FRUSTRATING!! '%>
<% @parent_category = parent_category # because @parent_category is nil but we need it to use a form_for tag %>
-
\ No newline at end of file
diff --git a/app/views/admin/category.html.erb b/app/views/admin/category.html.erb
index b1e2507..0346679 100644
--- a/app/views/admin/category.html.erb
+++ b/app/views/admin/category.html.erb
@@ -7,7 +7,7 @@
\ No newline at end of file
diff --git a/app/views/admin/manager.html.erb b/app/views/admin/manager.html.erb
index 3d5b27f..4d43b6e 100644
--- a/app/views/admin/manager.html.erb
+++ b/app/views/admin/manager.html.erb
@@ -7,7 +7,7 @@
-
-
+
+
<%= hidden_field_tag 'activation_hash', @ad.activation_hash %>
<%= submit_tag 'Update Ad »' %>
<% end %>
\ No newline at end of file
diff --git a/app/views/ads/feed.atom.builder b/app/views/ads/feed.atom.builder
index fd67045..94f3338 100644
--- a/app/views/ads/feed.atom.builder
+++ b/app/views/ads/feed.atom.builder
@@ -2,7 +2,7 @@
atom_feed do |feed|
feed.title "Latest Ads"
feed.updated((@ads.last.created_at))
-
+
for a in @ads
feed.entry(a) do |entry|
entry.title(a.title)
diff --git a/app/views/ads/feed.rss.builder b/app/views/ads/feed.rss.builder
index c8684d3..245c6f8 100644
--- a/app/views/ads/feed.rss.builder
+++ b/app/views/ads/feed.rss.builder
@@ -11,7 +11,7 @@ xml.rss(:version => "2.0") {
xml.description(a.ad)
xml.author(a.email)
xml.pubDate(a.created_at.strftime("%a %d %b %Y %H:%M:%S %z"))
- xml.link(url_for(:controller => 'ads',
+ xml.link(url_for(:controller => 'ads',
:action => 'show', :host => DOMAIN,
:id => a.id, :only_path => false))
xml.guid(url_for(:controller => 'ads',
diff --git a/app/views/ads/show.html.erb b/app/views/ads/show.html.erb
index e53a053..a972510 100644
--- a/app/views/ads/show.html.erb
+++ b/app/views/ads/show.html.erb
@@ -5,5 +5,5 @@
<%=h @ad.ad %>
<% @ad.ad_images.each do |ad_image| %>
- <%= link_to image_tag(ad_image.public_filename(:show)), ad_image.public_filename, :target => "_blank" %>
+ <%= link_to image_tag(ad_image.public_filename(:show)), ad_image.public_filename, :target => "_blank" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index afa79f4..105afbd 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -12,7 +12,7 @@
-
+
diff --git a/app/views/mailman/activation_email.text.plain.erb b/app/views/mailman/activation_email.text.plain.erb
index fdf1ee9..586d103 100644
--- a/app/views/mailman/activation_email.text.plain.erb
+++ b/app/views/mailman/activation_email.text.plain.erb
@@ -1,6 +1,6 @@
Hi,
-Your Ad has been activated on Chuckslist.
+Your Ad has been activated on Chuckslist.
You can see your ad here:
<%= SITE_URL + 'ads/show/' + @ad.id.to_s + '/' %>
diff --git a/app/views/mailman/confirmation_email.text.plain.erb b/app/views/mailman/confirmation_email.text.plain.erb
index 7f4e9e3..a60a85b 100644
--- a/app/views/mailman/confirmation_email.text.plain.erb
+++ b/app/views/mailman/confirmation_email.text.plain.erb
@@ -1,6 +1,6 @@
Hi,
-Thank you for your latest Ad post on Chuckslist.
+Thank you for your latest Ad post on Chuckslist.
Please visit the page below to activate your ad.
<%= SITE_URL + 'activate/' + @ad.activation_hash + '/' %>
diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb
index 3aaa0e7..4eaf9aa 100644
--- a/app/views/main/index.html.erb
+++ b/app/views/main/index.html.erb
@@ -12,7 +12,7 @@
diff --git a/config/environment.rb b/config/environment.rb
index 89dd935..7786da4 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -14,7 +14,7 @@
SITE_URL = 'http://chuckslist.org/'
JUNK_MAIL = 'garbage@chuckslist.org'
-
+
# ######### END OF CHUCKSLIST CONFIGURATION VALUES ########
@@ -30,13 +30,13 @@
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# See Rails::Configuration for more options.
-
-
+
+
# Skip frameworks you're not going to use (only works if using vendor/rails).
# To use Rails without a database, you must remove the Active Record framework
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
- # Only load the plugins named here, in the order given. By default, all plugins
+ # Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
@@ -50,7 +50,7 @@
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
- # Make sure the secret is at least 30 characters and all random,
+ # Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
config.action_controller.session = {
:session_key => '_chuckslist_session',
@@ -72,11 +72,11 @@
# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc
-
+
config.load_paths += %W( #{RAILS_ROOT}/vendor/uuid-1.0.4/lib )
end
-
+
# Define DateTime format for use in our ads email address generator
# e.g. DateTime.now.to_s(:generate_hash)
Time::DATE_FORMATS[:generate_hash] = "%Y%j%S%H%M"
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index 09158b8..5261cd1 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format
+# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
diff --git a/config/routes.rb b/config/routes.rb
index a0d2487..f56a6b1 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,63 +4,63 @@
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
-
+
map.connect 'update_category/:id', :controller => 'admin', :action => 'update_category'
# maps a route of
- # http://chuckslist.org/admin/
+ # http://chuckslist.org/admin/
# to admin login screen
map.connect 'admin', :controller => 'admin', :action => 'index'
-
+
#maps route to admin/logout
map.connect 'logout', :controller => 'admin', :action => 'destroy'
-
+
#maps route to admin/login
map.connect 'login', :controller => 'admin', :action =>'index'
-
+
#maps route to admin/pwd
map.connect 'password', :controller => 'admin', :action =>'pwd'
-
+
#maps route to admin/manager
map.connect 'manager', :controller => 'admin', :action =>'manager'
-
+
#maps route to admin/authors
map.connect 'authors', :controller => 'admin', :action => 'authors'
-
+
#maps route to admin/category
map.connect 'category', :controller => 'admin', :action =>'category'
-
+
#maps route to admin/user
map.connect 'user', :controller => 'admin', :action => 'user'
-
+
#maps route to admin/parent_category
map.connect 'parent', :controller => 'admin', :action => 'parent_category'
# maps route to rss/atom feed
map.connect 'feed', :controller => 'ads', :action => 'feed'
-
+
# maps a route of http://chuckslist.org/forsale/ to list all ads with the category slug 'forsale'
map.connect ':slug', :controller => 'ads', :action => 'list'
-
+
map.connect ':slug/feed', :controller => 'ads', :action => 'category_feed'
-
+
# maps a route of /destroy/hash/ to ads controller, action destroy
map.connect 'ads/destroy/:activation_hash', :controller => 'ads', :action => 'destroy', :method => :post
-
+
# maps a route of
# http://chuckslist.org/activate/6e042790-d1a5-012a-f3ee-0011243b04a2
# to the ads controller, activation
map.connect 'activate/:activation_hash', :controller => 'ads', :action => 'activate'
-
-
+
+
# maps a route of
# http://chuckslist.org/edit/6e042790-d1a5-012a-f3ee-0011243b04a2
# to the ads controller, edit
map.connect 'ads/edit/:activation_hash', :controller => 'ads', :action => 'edit'
-
+
# maps /ads/manage/hash to ads controller, activation hash
map.connect 'ads/manage/:activation_hash', :controller => 'ads', :action => 'manage'
-
-
+
+
#map.resources :ads
#, :collection => { :list => :get, :create => :post, :post => :get }
diff --git a/db/migrate/001_create_ads.rb b/db/migrate/001_create_ads.rb
index a6132c6..81c1d65 100644
--- a/db/migrate/001_create_ads.rb
+++ b/db/migrate/001_create_ads.rb
@@ -4,7 +4,7 @@ def self.up
t.column :title, :string
t.column :ad, :text
t.column :expiration, :datetime # defaults to 30 days after posting
- t.column :email, :string # response e-mail so each ad has its own
+ t.column :email, :string # response e-mail so each ad has its own
t.column :author_id, :integer
t.column :category_id, :integer
t.timestamps
diff --git a/db/migrate/006_add_fields_to_ads_model.rb b/db/migrate/006_add_fields_to_ads_model.rb
index 6b52b9f..428223d 100644
--- a/db/migrate/006_add_fields_to_ads_model.rb
+++ b/db/migrate/006_add_fields_to_ads_model.rb
@@ -8,5 +8,5 @@ def self.down
remove_column :ads, :active
remove_column :ads, :activation_hash
end
-
+
end
diff --git a/db/migrate/010_create_ad_images.rb b/db/migrate/010_create_ad_images.rb
index 73ea653..8a923d5 100644
--- a/db/migrate/010_create_ad_images.rb
+++ b/db/migrate/010_create_ad_images.rb
@@ -1,7 +1,7 @@
class CreateAdImages < ActiveRecord::Migration
def self.up
create_table :ad_images do |t|
-
+
t.integer :ad_id
diff --git a/db/schema.rb b/db/schema.rb
index b6e16b7..803905d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,4 +1,4 @@
-# This file is auto-generated from the current state of the database. Instead of editing this file,
+# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
#
diff --git a/doc/INSTALL b/doc/INSTALL
index 780fefa..f8cbffe 100644
--- a/doc/INSTALL
+++ b/doc/INSTALL
@@ -40,16 +40,16 @@ Once you've set up the app and gotten it running, go to yourdomain.com/account/s
EMAIL FORWARDING/REDIRECTION
----------------------------
-We set up ChucksList to handle the email forwarding and redirecting as discussed here:
+We set up ChucksList to handle the email forwarding and redirecting as discussed here:
http://wiki.rubyonrails.org/rails/pages/HowToReceiveEmailsWithActionMailer
You will have to set up a cron job to run mailman or postfix (depending on your server setup) and pipe the data into Mailman.receive. If you are using sendmail to receive emails you should be able to execute the following as a cron job:
-mailman: "|/path/to/app/script/runner 'Mailman.receive(STDIN.read)'"
+mailman: "|/path/to/app/script/runner 'Mailman.receive(STDIN.read)'"
(be sure to change /path/to/app/ to be the actual path to your app)
-Also, be sure to edit the domain in the regular expression used in the Mailman.receive() function of /app/models/mailman.rb
+Also, be sure to edit the domain in the regular expression used in the Mailman.receive() function of /app/models/mailman.rb
CONTACT
diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb
index 7e73acb..402a992 100644
--- a/lib/authenticated_system.rb
+++ b/lib/authenticated_system.rb
@@ -5,18 +5,18 @@ module AuthenticatedSystem
def logged_in?
current_user != :false
end
-
+
# Accesses the current user from the session.
def current_user
@current_user ||= (session[:user] && User.find_by_id(session[:user])) || :false
end
-
+
# Store the given user in the session.
def current_user=(new_user)
session[:user] = (new_user.nil? || new_user.is_a?(Symbol)) ? nil : new_user.id
@current_user = new_user
end
-
+
# Check if the user is authorized.
#
# Override this method in your controllers if you want to restrict access
@@ -52,7 +52,7 @@ def login_required
self.current_user ||= User.authenticate(username, passwd) || :false if username && passwd
logged_in? && authorized? ? true : access_denied
end
-
+
# Redirect as appropriate when an access request fails.
#
# The default action is to redirect to the login screen.
@@ -74,22 +74,22 @@ def access_denied
end
end
false
- end
-
+ end
+
# Store the URI of the current request in the session.
#
# We can return to this location by calling #redirect_back_or_default.
def store_location
session[:return_to] = request.request_uri
end
-
+
# Redirect to the URI stored by the most recent store_location call or
# to the passed default.
def redirect_back_or_default(default)
session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)
session[:return_to] = nil
end
-
+
# Inclusion hook to make #current_user and #logged_in?
# available as ActionView helper methods.
def self.included(base)
@@ -115,6 +115,6 @@ def login_from_cookie
def get_auth_data
auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }
auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
- return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
+ return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
end
end
diff --git a/lib/authenticated_test_helper.rb b/lib/authenticated_test_helper.rb
index a704035..a812c93 100644
--- a/lib/authenticated_test_helper.rb
+++ b/lib/authenticated_test_helper.rb
@@ -32,7 +32,7 @@ def authorize_as(user)
# # ...
# end
# end
- #
+ #
def assert_difference(object, method = nil, difference = 1)
initial_value = object.send(method)
yield
@@ -44,7 +44,7 @@ def assert_no_difference(object, method, &block)
end
# Assert the block redirects to the login
- #
+ #
# assert_requires_login(:bob) { |c| c.get :edit, :id => 1 }
#
def assert_requires_login(login = nil)
@@ -76,11 +76,11 @@ def initialize(controller, login)
def authenticated
raise NotImplementedError
end
-
+
def check
raise NotImplementedError
end
-
+
def method_missing(method, *args)
@controller.reset!
authenticate
@@ -94,7 +94,7 @@ class HttpLoginProxy < BaseLoginProxy
def authenticate
@controller.login_as @login if @login
end
-
+
def check
@controller.assert_redirected_to :controller => 'account', :action => 'login'
end
@@ -106,7 +106,7 @@ def authenticate
@controller.accept 'application/xml'
@controller.authorize_as @login if @login
end
-
+
def check
@controller.assert_response 401
end
diff --git a/lib/tasks/load_fixtures.rake b/lib/tasks/load_fixtures.rake
index 2ff2f28..cfeb698 100644
--- a/lib/tasks/load_fixtures.rake
+++ b/lib/tasks/load_fixtures.rake
@@ -4,28 +4,28 @@
#=> rake db:fixtures:import TABLE=assessment_components,lookups (Note: There should not be spaces between commas)
#Specific environment using the environment variable "RAILS_ENV"
#=> rake db:fixtures:import TABLE=assessment_components,lookups RAILS_ENV=test
-#
+#
# source: http://www.michaelhill.info/blog/?p=16 (Thanks!)
desc "Sets default categories and parent categories for ChucksList using fixtures provided."
namespace :db do
namespace :fixtures do
task :import => :environment do
-
+
require 'active_record/fixtures'
require 'rake'
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
## set directory to import
- file_base_path = File.join(RAILS_ROOT, 'test', 'fixtures', 'app_default_data', 'import')
+ file_base_path = File.join(RAILS_ROOT, 'test', 'fixtures', 'app_default_data', 'import')
puts "importing from: " + file_base_path
-
+
puts "the RAILS_ENV is " + RAILS_ENV
-
+
if ENV["TABLE"] != nil
files_array = ENV["TABLE"].to_s.split(",")
else
files_array = Dir.glob(File.join(file_base_path, '*.{yml}'))
end
-
+
files_array.each do |fixture_file|
puts "\n Importing " + File.basename(fixture_file.strip, ".yml") + "..."
begin
@@ -40,7 +40,7 @@ namespace :db do
end
end
puts "\nTask completed!"
-
+
end
end
end
diff --git a/public/.htaccess b/public/.htaccess
index d9d211c..1d37bd9 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -5,14 +5,14 @@ Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
-#
+#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]
# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
-#
+#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
@@ -33,7 +33,7 @@ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
-#
+#
# Example:
# ErrorDocument 500 /500.html
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index ee9a163..3f8f6af 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1,17 +1,17 @@
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
-document.observe('dom:loaded', function() {
+document.observe('dom:loaded', function() {
// add some lowpro
- Event.addBehavior.reassignAfterAjax = true;
+ Event.addBehavior.reassignAfterAjax = true;
Event.addBehavior({
'a.clone:click' : function(e) {
-
+
// jquery is much nicer... w
$("image_attachment").insert({
after: " "
- });
+ });
}
});
-});
+});
diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js
index fbc4418..88f74a9 100644
--- a/public/javascripts/controls.js
+++ b/public/javascripts/controls.js
@@ -5,18 +5,18 @@
// Richard Livsey
// Rahul Bhargava
// Rob Wills
-//
+//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
-// Autocompleter.Base handles all the autocompletion functionality
+// Autocompleter.Base handles all the autocompletion functionality
// that's independent of the data source for autocompletion. This
// includes drawing the autocompletion menu, observing keyboard
// and mouse events, and similar.
//
-// Specific autocompleters need to provide, at the very least,
+// Specific autocompleters need to provide, at the very least,
// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method
+// the text inside the monitored textbox changes. This method
// should get the text for which to provide autocompletion by
// invoking this.getToken(), NOT by directly accessing
// this.element.value. This is to allow incremental tokenized
@@ -30,8 +30,8 @@
// will incrementally autocomplete with a comma as the token.
// Additionally, ',' in the above example can be replaced with
// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most
-// useful when one of the tokens is \n (a newline), as it
+// enables autocompletion on multiple tokens. This is most
+// useful when one of the tokens is \n (a newline), as it
// allows smart autocompletion after linebreaks.
if(typeof Effect == 'undefined')
@@ -41,12 +41,12 @@ var Autocompleter = { }
Autocompleter.Base = Class.create({
baseInitialize: function(element, update, options) {
element = $(element)
- this.element = element;
- this.update = $(update);
- this.hasFocus = false;
- this.changed = false;
- this.active = false;
- this.index = 0;
+ this.element = element;
+ this.update = $(update);
+ this.hasFocus = false;
+ this.changed = false;
+ this.active = false;
+ this.index = 0;
this.entryCount = 0;
this.oldElementValue = this.element.value;
@@ -59,28 +59,28 @@ Autocompleter.Base = Class.create({
this.options.tokens = this.options.tokens || [];
this.options.frequency = this.options.frequency || 0.4;
this.options.minChars = this.options.minChars || 1;
- this.options.onShow = this.options.onShow ||
- function(element, update){
+ this.options.onShow = this.options.onShow ||
+ function(element, update){
if(!update.style.position || update.style.position=='absolute') {
update.style.position = 'absolute';
Position.clone(element, update, {
- setHeight: false,
+ setHeight: false,
offsetTop: element.offsetHeight
});
}
Effect.Appear(update,{duration:0.15});
};
- this.options.onHide = this.options.onHide ||
+ this.options.onHide = this.options.onHide ||
function(element, update){ new Effect.Fade(update,{duration:0.15}) };
- if(typeof(this.options.tokens) == 'string')
+ if(typeof(this.options.tokens) == 'string')
this.options.tokens = new Array(this.options.tokens);
// Force carriage returns as token delimiters anyway
if (!this.options.tokens.include('\n'))
this.options.tokens.push('\n');
this.observer = null;
-
+
this.element.setAttribute('autocomplete','off');
Element.hide(this.update);
@@ -91,10 +91,10 @@ Autocompleter.Base = Class.create({
show: function() {
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
- if(!this.iefix &&
+ if(!this.iefix &&
(Prototype.Browser.IE) &&
(Element.getStyle(this.update, 'position')=='absolute')) {
- new Insertion.After(this.update,
+ new Insertion.After(this.update,
'');
@@ -102,7 +102,7 @@ Autocompleter.Base = Class.create({
}
if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
},
-
+
fixIEOverlapping: function() {
Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
this.iefix.style.zIndex = 1;
@@ -150,15 +150,15 @@ Autocompleter.Base = Class.create({
Event.stop(event);
return;
}
- else
- if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
+ else
+ if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
(Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
this.changed = true;
this.hasFocus = true;
if(this.observer) clearTimeout(this.observer);
- this.observer =
+ this.observer =
setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
},
@@ -170,35 +170,35 @@ Autocompleter.Base = Class.create({
onHover: function(event) {
var element = Event.findElement(event, 'LI');
- if(this.index != element.autocompleteIndex)
+ if(this.index != element.autocompleteIndex)
{
this.index = element.autocompleteIndex;
this.render();
}
Event.stop(event);
},
-
+
onClick: function(event) {
var element = Event.findElement(event, 'LI');
this.index = element.autocompleteIndex;
this.selectEntry();
this.hide();
},
-
+
onBlur: function(event) {
// needed to make click events working
setTimeout(this.hide.bind(this), 250);
this.hasFocus = false;
- this.active = false;
- },
-
+ this.active = false;
+ },
+
render: function() {
if(this.entryCount > 0) {
for (var i = 0; i < this.entryCount; i++)
- this.index==i ?
- Element.addClassName(this.getEntry(i),"selected") :
+ this.index==i ?
+ Element.addClassName(this.getEntry(i),"selected") :
Element.removeClassName(this.getEntry(i),"selected");
- if(this.hasFocus) {
+ if(this.hasFocus) {
this.show();
this.active = true;
}
@@ -207,27 +207,27 @@ Autocompleter.Base = Class.create({
this.hide();
}
},
-
+
markPrevious: function() {
if(this.index > 0) this.index--
else this.index = this.entryCount-1;
this.getEntry(this.index).scrollIntoView(true);
},
-
+
markNext: function() {
if(this.index < this.entryCount-1) this.index++
else this.index = 0;
this.getEntry(this.index).scrollIntoView(false);
},
-
+
getEntry: function(index) {
return this.update.firstChild.childNodes[index];
},
-
+
getCurrentEntry: function() {
return this.getEntry(this.index);
},
-
+
selectEntry: function() {
this.active = false;
this.updateElement(this.getCurrentEntry());
@@ -244,7 +244,7 @@ Autocompleter.Base = Class.create({
if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
} else
value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-
+
var bounds = this.getTokenBounds();
if (bounds[0] != -1) {
var newValue = this.element.value.substr(0, bounds[0]);
@@ -257,7 +257,7 @@ Autocompleter.Base = Class.create({
}
this.oldElementValue = this.element.value;
this.element.focus();
-
+
if (this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element, selectedElement);
},
@@ -269,20 +269,20 @@ Autocompleter.Base = Class.create({
Element.cleanWhitespace(this.update.down());
if(this.update.firstChild && this.update.down().childNodes) {
- this.entryCount =
+ this.entryCount =
this.update.down().childNodes.length;
for (var i = 0; i < this.entryCount; i++) {
var entry = this.getEntry(i);
entry.autocompleteIndex = i;
this.addObservers(entry);
}
- } else {
+ } else {
this.entryCount = 0;
}
this.stopIndicator();
this.index = 0;
-
+
if(this.entryCount==1 && this.options.autoSelect) {
this.selectEntry();
this.hide();
@@ -298,7 +298,7 @@ Autocompleter.Base = Class.create({
},
onObserverEvent: function() {
- this.changed = false;
+ this.changed = false;
this.tokenBounds = null;
if(this.getToken().length>=this.options.minChars) {
this.getUpdatedChoices();
@@ -351,16 +351,16 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
getUpdatedChoices: function() {
this.startIndicator();
-
- var entry = encodeURIComponent(this.options.paramName) + '=' +
+
+ var entry = encodeURIComponent(this.options.paramName) + '=' +
encodeURIComponent(this.getToken());
this.options.parameters = this.options.callback ?
this.options.callback(this.element, entry) : entry;
- if(this.options.defaultParams)
+ if(this.options.defaultParams)
this.options.parameters += '&' + this.options.defaultParams;
-
+
new Ajax.Request(this.url, this.options);
},
@@ -382,7 +382,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
// - choices - How many autocompletion choices to offer
//
// - partialSearch - If false, the autocompleter will match entered
-// text only at the beginning of strings in the
+// text only at the beginning of strings in the
// autocomplete array. Defaults to true, which will
// match text at the beginning of any *word* in the
// strings in the autocomplete array. If you want to
@@ -399,7 +399,7 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
// - ignoreCase - Whether to ignore case when autocompleting.
// Defaults to true.
//
-// It's possible to pass in a custom function as the 'selector'
+// It's possible to pass in a custom function as the 'selector'
// option, if you prefer to write your own autocompletion logic.
// In that case, the other options above will not apply unless
// you support them.
@@ -427,20 +427,20 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
var entry = instance.getToken();
var count = 0;
- for (var i = 0; i < instance.options.array.length &&
- ret.length < instance.options.choices ; i++) {
+ for (var i = 0; i < instance.options.array.length &&
+ ret.length < instance.options.choices ; i++) {
var elem = instance.options.array[i];
- var foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase()) :
+ var foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase()) :
elem.indexOf(entry);
while (foundPos != -1) {
- if (foundPos == 0 && elem.length != entry.length) {
- ret.push("
");
break;
- } else if (entry.length >= instance.options.partialChars &&
+ } else if (entry.length >= instance.options.partialChars &&
instance.options.partialSearch && foundPos != -1) {
if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
partial.push("
" + elem.substr(0, foundPos) + "" +
@@ -450,8 +450,8 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
}
}
- foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
+ foundPos = instance.options.ignoreCase ?
+ elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
elem.indexOf(entry, foundPos + 1);
}
@@ -937,7 +937,7 @@ Ajax.InPlaceCollectionEditor.DefaultOptions = {
loadingCollectionText: 'Loading options...'
};
-// Delayed observer, like Form.Element.Observer,
+// Delayed observer, like Form.Element.Observer,
// but waits for delay after last key input
// Ideal for live-search fields
@@ -947,7 +947,7 @@ Form.Element.DelayedObserver = Class.create({
this.element = $(element);
this.callback = callback;
this.timer = null;
- this.lastValue = $F(this.element);
+ this.lastValue = $F(this.element);
Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
},
delayedListener: function(event) {
diff --git a/public/javascripts/dragdrop.js b/public/javascripts/dragdrop.js
index ccf4a1e..c356ddf 100644
--- a/public/javascripts/dragdrop.js
+++ b/public/javascripts/dragdrop.js
@@ -1,6 +1,6 @@
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
+//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -32,7 +32,7 @@ var Droppables = {
options._containers.push($(containment));
}
}
-
+
if(options.accept) options.accept = [options.accept].flatten();
Element.makePositioned(element); // fix IE
@@ -40,34 +40,34 @@ var Droppables = {
this.drops.push(options);
},
-
+
findDeepestChild: function(drops) {
deepest = drops[0];
-
+
for (i = 1; i < drops.length; ++i)
if (Element.isParent(drops[i].element, deepest.element))
deepest = drops[i];
-
+
return deepest;
},
isContained: function(element, drop) {
var containmentNode;
if(drop.tree) {
- containmentNode = element.treeNode;
+ containmentNode = element.treeNode;
} else {
containmentNode = element.parentNode;
}
return drop._containers.detect(function(c) { return containmentNode == c });
},
-
+
isAffected: function(point, element, drop) {
return (
(drop.element!=element) &&
((!drop._containers) ||
this.isContained(element, drop)) &&
((!drop.accept) ||
- (Element.classNames(element).detect(
+ (Element.classNames(element).detect(
function(v) { return drop.accept.include(v) } ) )) &&
Position.within(drop.element, point[0], point[1]) );
},
@@ -87,12 +87,12 @@ var Droppables = {
show: function(point, element) {
if(!this.drops.length) return;
var drop, affected = [];
-
+
this.drops.each( function(drop) {
if(Droppables.isAffected(point, element, drop))
affected.push(drop);
});
-
+
if(affected.length>0)
drop = Droppables.findDeepestChild(affected);
@@ -101,7 +101,7 @@ var Droppables = {
Position.within(drop.element, point[0], point[1]);
if(drop.onHover)
drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
+
if (drop != this.last_active) Droppables.activate(drop);
}
},
@@ -112,8 +112,8 @@ var Droppables = {
if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
if (this.last_active.onDrop) {
- this.last_active.onDrop(element, this.last_active.element, event);
- return true;
+ this.last_active.onDrop(element, this.last_active.element, event);
+ return true;
}
},
@@ -126,20 +126,20 @@ var Droppables = {
var Draggables = {
drags: [],
observers: [],
-
+
register: function(draggable) {
if(this.drags.length == 0) {
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
+
Event.observe(document, "mouseup", this.eventMouseUp);
Event.observe(document, "mousemove", this.eventMouseMove);
Event.observe(document, "keypress", this.eventKeypress);
}
this.drags.push(draggable);
},
-
+
unregister: function(draggable) {
this.drags = this.drags.reject(function(d) { return d==draggable });
if(this.drags.length == 0) {
@@ -148,24 +148,24 @@ var Draggables = {
Event.stopObserving(document, "keypress", this.eventKeypress);
}
},
-
+
activate: function(draggable) {
- if(draggable.options.delay) {
- this._timeout = setTimeout(function() {
- Draggables._timeout = null;
- window.focus();
- Draggables.activeDraggable = draggable;
- }.bind(this), draggable.options.delay);
+ if(draggable.options.delay) {
+ this._timeout = setTimeout(function() {
+ Draggables._timeout = null;
+ window.focus();
+ Draggables.activeDraggable = draggable;
+ }.bind(this), draggable.options.delay);
} else {
window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
this.activeDraggable = draggable;
}
},
-
+
deactivate: function() {
this.activeDraggable = null;
},
-
+
updateDrag: function(event) {
if(!this.activeDraggable) return;
var pointer = [Event.pointerX(event), Event.pointerY(event)];
@@ -173,36 +173,36 @@ var Draggables = {
// the same coordinates, prevent needless redrawing (moz bug?)
if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
this._lastPointer = pointer;
-
+
this.activeDraggable.updateDrag(event, pointer);
},
-
+
endDrag: function(event) {
- if(this._timeout) {
- clearTimeout(this._timeout);
- this._timeout = null;
+ if(this._timeout) {
+ clearTimeout(this._timeout);
+ this._timeout = null;
}
if(!this.activeDraggable) return;
this._lastPointer = null;
this.activeDraggable.endDrag(event);
this.activeDraggable = null;
},
-
+
keyPress: function(event) {
if(this.activeDraggable)
this.activeDraggable.keyPress(event);
},
-
+
addObserver: function(observer) {
this.observers.push(observer);
this._cacheObserverCallbacks();
},
-
+
removeObserver: function(element) { // element instead of observer fixes mem leaks
this.observers = this.observers.reject( function(o) { return o.element==element });
this._cacheObserverCallbacks();
},
-
+
notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
if(this[eventName+'Count'] > 0)
this.observers.each( function(o) {
@@ -210,7 +210,7 @@ var Draggables = {
});
if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
},
-
+
_cacheObserverCallbacks: function() {
['onStart','onEnd','onDrag'].each( function(eventName) {
Draggables[eventName+'Count'] = Draggables.observers.select(
@@ -234,12 +234,12 @@ var Draggable = Class.create({
},
endeffect: function(element) {
var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
+ new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
queue: {scope:'_draggable', position:'end'},
- afterFinish: function(){
- Draggable._dragging[element] = false
+ afterFinish: function(){
+ Draggable._dragging[element] = false
}
- });
+ });
},
zindex: 1000,
revert: false,
@@ -250,57 +250,57 @@ var Draggable = Class.create({
snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
delay: 0
};
-
+
if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
Object.extend(defaults, {
starteffect: function(element) {
element._opacity = Element.getOpacity(element);
Draggable._dragging[element] = true;
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
+ new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
}
});
-
+
var options = Object.extend(defaults, arguments[1] || { });
this.element = $(element);
-
+
if(options.handle && Object.isString(options.handle))
this.handle = this.element.down('.'+options.handle, 0);
-
+
if(!this.handle) this.handle = $(options.handle);
if(!this.handle) this.handle = this.element;
-
+
if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
options.scroll = $(options.scroll);
this._isScrollChild = Element.childOf(this.element, options.scroll);
}
- Element.makePositioned(this.element); // fix IE
+ Element.makePositioned(this.element); // fix IE
this.options = options;
- this.dragging = false;
+ this.dragging = false;
this.eventMouseDown = this.initDrag.bindAsEventListener(this);
Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
+
Draggables.register(this);
},
-
+
destroy: function() {
Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
Draggables.unregister(this);
},
-
+
currentDelta: function() {
return([
parseInt(Element.getStyle(this.element,'left') || '0'),
parseInt(Element.getStyle(this.element,'top') || '0')]);
},
-
+
initDrag: function(event) {
if(!Object.isUndefined(Draggable._dragging[this.element]) &&
Draggable._dragging[this.element]) return;
- if(Event.isLeftClick(event)) {
+ if(Event.isLeftClick(event)) {
// abort on form elements, fixes a Firefox issue
var src = Event.element(event);
if((tag_name = src.tagName.toUpperCase()) && (
@@ -309,26 +309,26 @@ var Draggable = Class.create({
tag_name=='OPTION' ||
tag_name=='BUTTON' ||
tag_name=='TEXTAREA')) return;
-
+
var pointer = [Event.pointerX(event), Event.pointerY(event)];
var pos = Position.cumulativeOffset(this.element);
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
+
Draggables.activate(this);
Event.stop(event);
}
},
-
+
startDrag: function(event) {
this.dragging = true;
if(!this.delta)
this.delta = this.currentDelta();
-
+
if(this.options.zindex) {
this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
this.element.style.zIndex = this.options.zindex;
}
-
+
if(this.options.ghosting) {
this._clone = this.element.cloneNode(true);
this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
@@ -336,7 +336,7 @@ var Draggable = Class.create({
Position.absolutize(this.element);
this.element.parentNode.insertBefore(this._clone, this.element);
}
-
+
if(this.options.scroll) {
if (this.options.scroll == window) {
var where = this._getWindowScroll(this.options.scroll);
@@ -347,28 +347,28 @@ var Draggable = Class.create({
this.originalScrollTop = this.options.scroll.scrollTop;
}
}
-
+
Draggables.notify('onStart', this, event);
-
+
if(this.options.starteffect) this.options.starteffect(this.element);
},
-
+
updateDrag: function(event, pointer) {
if(!this.dragging) this.startDrag(event);
-
+
if(!this.options.quiet){
Position.prepare();
Droppables.show(pointer, this.element);
}
-
+
Draggables.notify('onDrag', this, event);
-
+
this.draw(pointer);
if(this.options.change) this.options.change(this);
-
+
if(this.options.scroll) {
this.stopScrolling();
-
+
var p;
if (this.options.scroll == window) {
with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
@@ -386,16 +386,16 @@ var Draggable = Class.create({
if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
this.startScrolling(speed);
}
-
+
// fix AppleWebKit rendering
if(Prototype.Browser.WebKit) window.scrollBy(0,0);
-
+
Event.stop(event);
},
-
+
finishDrag: function(event, success) {
this.dragging = false;
-
+
if(this.options.quiet){
Position.prepare();
var pointer = [Event.pointerX(event), Event.pointerY(event)];
@@ -410,17 +410,17 @@ var Draggable = Class.create({
this._clone = null;
}
- var dropped = false;
- if(success) {
- dropped = Droppables.fire(event, this.element);
- if (!dropped) dropped = false;
+ var dropped = false;
+ if(success) {
+ dropped = Droppables.fire(event, this.element);
+ if (!dropped) dropped = false;
}
if(dropped && this.options.onDropped) this.options.onDropped(this.element);
Draggables.notify('onEnd', this, event);
var revert = this.options.revert;
if(revert && Object.isFunction(revert)) revert = revert(this.element);
-
+
var d = this.currentDelta();
if(revert && this.options.reverteffect) {
if (dropped == 0 || revert != 'failure')
@@ -433,45 +433,45 @@ var Draggable = Class.create({
if(this.options.zindex)
this.element.style.zIndex = this.originalZ;
- if(this.options.endeffect)
+ if(this.options.endeffect)
this.options.endeffect(this.element);
-
+
Draggables.deactivate(this);
Droppables.reset();
},
-
+
keyPress: function(event) {
if(event.keyCode!=Event.KEY_ESC) return;
this.finishDrag(event, false);
Event.stop(event);
},
-
+
endDrag: function(event) {
if(!this.dragging) return;
this.stopScrolling();
this.finishDrag(event, true);
Event.stop(event);
},
-
+
draw: function(point) {
var pos = Position.cumulativeOffset(this.element);
if(this.options.ghosting) {
var r = Position.realOffset(this.element);
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
}
-
+
var d = this.currentDelta();
pos[0] -= d[0]; pos[1] -= d[1];
-
+
if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
}
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
+
+ var p = [0,1].map(function(i){
+ return (point[i]-pos[i]-this.offset[i])
}.bind(this));
-
+
if(this.options.snap) {
if(Object.isFunction(this.options.snap)) {
p = this.options.snap(p[0],p[1],this);
@@ -484,16 +484,16 @@ var Draggable = Class.create({
return (v/this.options.snap).round()*this.options.snap }.bind(this))
}
}}
-
+
var style = this.element.style;
if((!this.options.constraint) || (this.options.constraint=='horizontal'))
style.left = p[0] + "px";
if((!this.options.constraint) || (this.options.constraint=='vertical'))
style.top = p[1] + "px";
-
+
if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
},
-
+
stopScrolling: function() {
if(this.scrollInterval) {
clearInterval(this.scrollInterval);
@@ -501,14 +501,14 @@ var Draggable = Class.create({
Draggables._lastScrollPointer = null;
}
},
-
+
startScrolling: function(speed) {
if(!(speed[0] || speed[1])) return;
this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
this.lastScrolled = new Date();
this.scrollInterval = setInterval(this.scroll.bind(this), 10);
},
-
+
scroll: function() {
var current = new Date();
var delta = current - this.lastScrolled;
@@ -524,7 +524,7 @@ var Draggable = Class.create({
this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
}
-
+
Position.prepare();
Droppables.show(Draggables._lastPointer, this.element);
Draggables.notify('onDrag', this);
@@ -538,10 +538,10 @@ var Draggable = Class.create({
Draggables._lastScrollPointer[1] = 0;
this.draw(Draggables._lastScrollPointer);
}
-
+
if(this.options.change) this.options.change(this);
},
-
+
_getWindowScroll: function(w) {
var T, L, W, H;
with (w.document) {
@@ -577,11 +577,11 @@ var SortableObserver = Class.create({
this.observer = observer;
this.lastValue = Sortable.serialize(this.element);
},
-
+
onStart: function() {
this.lastValue = Sortable.serialize(this.element);
},
-
+
onEnd: function() {
Sortable.unmark();
if(this.lastValue != Sortable.serialize(this.element))
@@ -591,11 +591,11 @@ var SortableObserver = Class.create({
var Sortable = {
SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-
+
sortables: { },
-
+
_findRootElement: function(element) {
- while (element.tagName.toUpperCase() != "BODY") {
+ while (element.tagName.toUpperCase() != "BODY") {
if(element.id && Sortable.sortables[element.id]) return element;
element = element.parentNode;
}
@@ -606,22 +606,22 @@ var Sortable = {
if(!element) return;
return Sortable.sortables[element.id];
},
-
+
destroy: function(element){
var s = Sortable.options(element);
-
+
if(s) {
Draggables.removeObserver(s.element);
s.droppables.each(function(d){ Droppables.remove(d) });
s.draggables.invoke('destroy');
-
+
delete Sortable.sortables[s.element.id];
}
},
create: function(element) {
element = $(element);
- var options = Object.extend({
+ var options = Object.extend({
element: element,
tag: 'li', // assumes li children, override with tag: 'tagname'
dropOnEmpty: false,
@@ -635,17 +635,17 @@ var Sortable = {
delay: 0,
hoverclass: null,
ghosting: false,
- quiet: false,
+ quiet: false,
scroll: false,
scrollSensitivity: 20,
scrollSpeed: 15,
format: this.SERIALIZE_RULE,
-
- // these take arrays of elements or ids and can be
+
+ // these take arrays of elements or ids and can be
// used for better initialization performance
elements: false,
handles: false,
-
+
onChange: Prototype.emptyFunction,
onUpdate: Prototype.emptyFunction
}, arguments[1] || { });
@@ -682,7 +682,7 @@ var Sortable = {
if(options.zindex)
options_for_draggable.zindex = options.zindex;
- // build options for the droppables
+ // build options for the droppables
var options_for_droppable = {
overlap: options.overlap,
containment: options.containment,
@@ -690,7 +690,7 @@ var Sortable = {
hoverclass: options.hoverclass,
onHover: Sortable.onHover
}
-
+
var options_for_tree = {
onHover: Sortable.onEmptyHover,
overlap: options.overlap,
@@ -699,7 +699,7 @@ var Sortable = {
}
// fix for gecko engine
- Element.cleanWhitespace(element);
+ Element.cleanWhitespace(element);
options.draggables = [];
options.droppables = [];
@@ -712,14 +712,14 @@ var Sortable = {
(options.elements || this.findElements(element, options) || []).each( function(e,i) {
var handle = options.handles ? $(options.handles[i]) :
- (options.handle ? $(e).select('.' + options.handle)[0] : e);
+ (options.handle ? $(e).select('.' + options.handle)[0] : e);
options.draggables.push(
new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
Droppables.add(e, options_for_droppable);
if(options.tree) e.treeNode = element;
- options.droppables.push(e);
+ options.droppables.push(e);
});
-
+
if(options.tree) {
(Sortable.findTreeElements(element, options) || []).each( function(e) {
Droppables.add(e, options_for_tree);
@@ -741,7 +741,7 @@ var Sortable = {
return Element.findChildren(
element, options.only, options.tree ? true : false, options.tag);
},
-
+
findTreeElements: function(element, options) {
return Element.findChildren(
element, options.only, options.tree ? true : false, options.treeTag);
@@ -758,7 +758,7 @@ var Sortable = {
var oldParentNode = element.parentNode;
element.style.visibility = "hidden"; // fix gecko rendering
dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
+ if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);
Sortable.options(dropon.parentNode).onChange(element);
}
@@ -769,26 +769,26 @@ var Sortable = {
var oldParentNode = element.parentNode;
element.style.visibility = "hidden"; // fix gecko rendering
dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
+ if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);
Sortable.options(dropon.parentNode).onChange(element);
}
}
},
-
+
onEmptyHover: function(element, dropon, overlap) {
var oldParentNode = element.parentNode;
var droponOptions = Sortable.options(dropon);
-
+
if(!Element.isParent(dropon, element)) {
var index;
-
+
var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
var child = null;
-
+
if(children) {
var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
+
for (index = 0; index < children.length; index += 1) {
if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
offset -= Element.offsetSize (children[index], droponOptions.overlap);
@@ -801,9 +801,9 @@ var Sortable = {
}
}
}
-
+
dropon.insertBefore(element, child);
-
+
Sortable.options(oldParentNode).onChange(element);
droponOptions.onChange(element);
}
@@ -816,34 +816,34 @@ var Sortable = {
mark: function(dropon, position) {
// mark on ghosting only
var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
+ if(sortable && !sortable.ghosting) return;
if(!Sortable._marker) {
- Sortable._marker =
+ Sortable._marker =
($('dropmarker') || Element.extend(document.createElement('DIV'))).
hide().addClassName('dropmarker').setStyle({position:'absolute'});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
+ }
var offsets = Position.cumulativeOffset(dropon);
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-
+
if(position=='after')
- if(sortable.overlap == 'horizontal')
+ if(sortable.overlap == 'horizontal')
Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
else
Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-
+
Sortable._marker.show();
},
-
+
_tree: function(element, options, parent) {
var children = Sortable.findElements(element, options) || [];
-
+
for (var i = 0; i < children.length; ++i) {
var match = children[i].id.match(options.format);
if (!match) continue;
-
+
var child = {
id: encodeURIComponent(match ? match[1] : null),
element: element,
@@ -852,15 +852,15 @@ var Sortable = {
position: parent.children.length,
container: $(children[i]).down(options.treeTag)
}
-
+
/* Get the element containing the children and recurse over it */
if (child.container)
this._tree(child.container, options, child)
-
+
parent.children.push (child);
}
- return parent;
+ return parent;
},
tree: function(element) {
@@ -873,7 +873,7 @@ var Sortable = {
name: element.id,
format: sortableOptions.format
}, arguments[1] || { });
-
+
var root = {
id: null,
parent: null,
@@ -881,7 +881,7 @@ var Sortable = {
container: element,
position: 0
}
-
+
return Sortable._tree(element, options, root);
},
@@ -897,7 +897,7 @@ var Sortable = {
sequence: function(element) {
element = $(element);
var options = Object.extend(this.options(element), arguments[1] || { });
-
+
return $(this.findElements(element, options) || []).map( function(item) {
return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
});
@@ -906,14 +906,14 @@ var Sortable = {
setSequence: function(element, new_sequence) {
element = $(element);
var options = Object.extend(this.options(element), arguments[2] || { });
-
+
var nodeMap = { };
this.findElements(element, options).each( function(n) {
if (n.id.match(options.format))
nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
n.parentNode.removeChild(n);
});
-
+
new_sequence.each(function(ident) {
var n = nodeMap[ident];
if (n) {
@@ -922,16 +922,16 @@ var Sortable = {
}
});
},
-
+
serialize: function(element) {
element = $(element);
var options = Object.extend(Sortable.options(element), arguments[1] || { });
var name = encodeURIComponent(
(arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
+
if (options.tree) {
return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "[id]=" +
+ return [name + Sortable._constructIndex(item) + "[id]=" +
encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
}).flatten().join('&');
} else {
@@ -949,7 +949,7 @@ Element.isParent = function(child, element) {
return Element.isParent(child.parentNode, element);
}
-Element.findChildren = function(element, only, recursive, tagName) {
+Element.findChildren = function(element, only, recursive, tagName) {
if(!element.hasChildNodes()) return null;
tagName = tagName.toUpperCase();
if(only) only = [only].flatten();
diff --git a/public/javascripts/effects.js b/public/javascripts/effects.js
index 65aed23..4650a34 100644
--- a/public/javascripts/effects.js
+++ b/public/javascripts/effects.js
@@ -3,46 +3,46 @@
// Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/)
// Martin Bialasinki
-//
+//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
+// For details, see the script.aculo.us web site: http://script.aculo.us/
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable
+String.prototype.parseColor = function() {
var color = '#';
- if (this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if (this.slice(0,1) == '#') {
- if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if (this.length==7) color = this.toLowerCase();
- }
- }
- return (color.length==7 ? color : (arguments[0] || this));
+ if (this.slice(0,4) == 'rgb(') {
+ var cols = this.slice(4,this.length-1).split(',');
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
+ } else {
+ if (this.slice(0,1) == '#') {
+ if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
+ if (this.length==7) color = this.toLowerCase();
+ }
+ }
+ return (color.length==7 ? color : (arguments[0] || this));
};
/*--------------------------------------------------------------------------*/
-Element.collectTextNodes = function(element) {
+Element.collectTextNodes = function(element) {
return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
+ return (node.nodeType==3 ? node.nodeValue :
(node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
}).flatten().join('');
};
-Element.collectTextNodesIgnoreClass = function(element, className) {
+Element.collectTextNodesIgnoreClass = function(element, className) {
return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
+ return (node.nodeType==3 ? node.nodeValue :
+ ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
Element.collectTextNodesIgnoreClass(node, className) : ''));
}).flatten().join('');
};
Element.setContentZoom = function(element, percent) {
- element = $(element);
- element.setStyle({fontSize: (percent/100) + 'em'});
+ element = $(element);
+ element.setStyle({fontSize: (percent/100) + 'em'});
if (Prototype.Browser.WebKit) window.scrollBy(0,0);
return element;
};
@@ -82,16 +82,16 @@ var Effect = {
wobble: function(pos) {
return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
},
- pulse: function(pos, pulses) {
- pulses = pulses || 5;
+ pulse: function(pos, pulses) {
+ pulses = pulses || 5;
return (
- ((pos % (1/pulses)) * pulses).round() == 0 ?
- ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
+ ((pos % (1/pulses)) * pulses).round() == 0 ?
+ ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
);
},
- spring: function(pos) {
- return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
+ spring: function(pos) {
+ return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
},
none: function(pos) {
return 0;
@@ -112,14 +112,14 @@ var Effect = {
tagifyText: function(element) {
var tagifyStyle = 'position:relative';
if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
-
+
element = $(element);
$A(element.childNodes).each( function(child) {
if (child.nodeType==3) {
child.nodeValue.toArray().each( function(character) {
element.insertBefore(
new Element('span', {style: tagifyStyle}).update(
- character == ' ' ? String.fromCharCode(160) : character),
+ character == ' ' ? String.fromCharCode(160) : character),
child);
});
Element.remove(child);
@@ -128,13 +128,13 @@ var Effect = {
},
multiple: function(element, effect) {
var elements;
- if (((typeof element == 'object') ||
- Object.isFunction(element)) &&
+ if (((typeof element == 'object') ||
+ Object.isFunction(element)) &&
(element.length))
elements = element;
else
elements = $(element).childNodes;
-
+
var options = Object.extend({
speed: 0.1,
delay: 0.0
@@ -156,7 +156,7 @@ var Effect = {
var options = Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
}, arguments[2] || { });
- Effect[element.visible() ?
+ Effect[element.visible() ?
Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
}
};
@@ -168,20 +168,20 @@ Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
Effect.ScopedQueue = Class.create(Enumerable, {
initialize: function() {
this.effects = [];
- this.interval = null;
+ this.interval = null;
},
_each: function(iterator) {
this.effects._each(iterator);
},
add: function(effect) {
var timestamp = new Date().getTime();
-
- var position = Object.isString(effect.options.queue) ?
+
+ var position = Object.isString(effect.options.queue) ?
effect.options.queue : effect.options.queue.position;
-
+
switch(position) {
case 'front':
- // move unstarted effects after this effect
+ // move unstarted effects after this effect
this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
e.startOn += effect.finishOn;
e.finishOn += effect.finishOn;
@@ -195,13 +195,13 @@ Effect.ScopedQueue = Class.create(Enumerable, {
timestamp = this.effects.pluck('finishOn').max() || timestamp;
break;
}
-
+
effect.startOn += timestamp;
effect.finishOn += timestamp;
if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
this.effects.push(effect);
-
+
if (!this.interval)
this.interval = setInterval(this.loop.bind(this), 15);
},
@@ -214,7 +214,7 @@ Effect.ScopedQueue = Class.create(Enumerable, {
},
loop: function() {
var timePos = new Date().getTime();
- for(var i=0, len=this.effects.length;i0) {
@@ -430,9 +430,9 @@ Effect.Scale = Class.create(Effect.Base, {
this.fontSizeType = fontSizeType;
}
}.bind(this));
-
+
this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-
+
this.dims = null;
if (this.options.scaleMode=='box')
this.dims = [this.element.offsetHeight, this.element.offsetWidth];
@@ -509,7 +509,7 @@ Effect.ScrollTo = function(element) {
var options = arguments[1] || { },
scrollOffsets = document.viewport.getScrollOffsets(),
elementOffsets = $(element).cumulativeOffset(),
- max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
+ max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
if (options.offset) elementOffsets[1] += options.offset;
@@ -529,9 +529,9 @@ Effect.Fade = function(element) {
var options = Object.extend({
from: element.getOpacity() || 1.0,
to: 0.0,
- afterFinishInternal: function(effect) {
+ afterFinishInternal: function(effect) {
if (effect.options.to!=0) return;
- effect.element.hide().setStyle({opacity: oldOpacity});
+ effect.element.hide().setStyle({opacity: oldOpacity});
}
}, arguments[1] || { });
return new Effect.Opacity(element,options);
@@ -547,15 +547,15 @@ Effect.Appear = function(element) {
effect.element.forceRerendering();
},
beforeSetup: function(effect) {
- effect.element.setOpacity(effect.options.from).show();
+ effect.element.setOpacity(effect.options.from).show();
}}, arguments[1] || { });
return new Effect.Opacity(element,options);
};
Effect.Puff = function(element) {
element = $(element);
- var oldStyle = {
- opacity: element.getInlineOpacity(),
+ var oldStyle = {
+ opacity: element.getInlineOpacity(),
position: element.getStyle('position'),
top: element.style.top,
left: element.style.left,
@@ -563,10 +563,10 @@ Effect.Puff = function(element) {
height: element.style.height
};
return new Effect.Parallel(
- [ new Effect.Scale(element, 200,
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
- Object.extend({ duration: 1.0,
+ [ new Effect.Scale(element, 200,
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
+ Object.extend({ duration: 1.0,
beforeSetupInternal: function(effect) {
Position.absolutize(effect.effects[0].element)
},
@@ -580,12 +580,12 @@ Effect.BlindUp = function(element) {
element = $(element);
element.makeClipping();
return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
restoreAfterFinish: true,
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping();
- }
+ }
}, arguments[1] || { })
);
};
@@ -593,15 +593,15 @@ Effect.BlindUp = function(element) {
Effect.BlindDown = function(element) {
element = $(element);
var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
scaleX: false,
scaleFrom: 0,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
restoreAfterFinish: true,
afterSetup: function(effect) {
- effect.element.makeClipping().setStyle({height: '0px'}).show();
- },
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
afterFinishInternal: function(effect) {
effect.element.undoClipping();
}
@@ -616,10 +616,10 @@ Effect.SwitchOff = function(element) {
from: 0,
transition: Effect.Transitions.flicker,
afterFinishInternal: function(effect) {
- new Effect.Scale(effect.element, 1, {
+ new Effect.Scale(effect.element, 1, {
duration: 0.3, scaleFromCenter: true,
scaleX: false, scaleContent: false, restoreAfterFinish: true,
- beforeSetup: function(effect) {
+ beforeSetup: function(effect) {
effect.element.makePositioned().makeClipping();
},
afterFinishInternal: function(effect) {
@@ -637,16 +637,16 @@ Effect.DropOut = function(element) {
left: element.getStyle('left'),
opacity: element.getInlineOpacity() };
return new Effect.Parallel(
- [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
+ [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
Object.extend(
{ duration: 0.5,
beforeSetup: function(effect) {
- effect.effects[0].element.makePositioned();
+ effect.effects[0].element.makePositioned();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
- }
+ }
}, arguments[1] || { }));
};
@@ -682,9 +682,9 @@ Effect.SlideDown = function(element) {
// SlideDown need to have the content of the element wrapped in a container element with fixed height!
var oldInnerBottom = element.down().getStyle('bottom');
var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
scaleFrom: window.opera ? 0 : 1,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
restoreAfterFinish: true,
@@ -692,11 +692,11 @@ Effect.SlideDown = function(element) {
effect.element.makePositioned();
effect.element.down().makePositioned();
if (window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping().setStyle({height: '0px'}).show();
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
},
afterUpdateInternal: function(effect) {
effect.element.down().setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
},
afterFinishInternal: function(effect) {
effect.element.undoClipping().undoPositioned();
@@ -710,8 +710,8 @@ Effect.SlideUp = function(element) {
var oldInnerBottom = element.down().getStyle('bottom');
var elementDimensions = element.getDimensions();
return new Effect.Scale(element, window.opera ? 0 : 1,
- Object.extend({ scaleContent: false,
- scaleX: false,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
scaleMode: 'box',
scaleFrom: 100,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
@@ -721,7 +721,7 @@ Effect.SlideUp = function(element) {
effect.element.down().makePositioned();
if (window.opera) effect.element.setStyle({top: ''});
effect.element.makeClipping().show();
- },
+ },
afterUpdateInternal: function(effect) {
effect.element.down().setStyle({bottom:
(effect.dims[0] - effect.element.clientHeight) + 'px' });
@@ -734,15 +734,15 @@ Effect.SlideUp = function(element) {
);
};
-// Bug in opera makes the TD containing this element expand for a instance after finish
+// Bug in opera makes the TD containing this element expand for a instance after finish
Effect.Squish = function(element) {
- return new Effect.Scale(element, window.opera ? 1 : 0, {
+ return new Effect.Scale(element, window.opera ? 1 : 0, {
restoreAfterFinish: true,
beforeSetup: function(effect) {
- effect.element.makeClipping();
- },
+ effect.element.makeClipping();
+ },
afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping();
+ effect.element.hide().undoClipping();
}
});
};
@@ -762,13 +762,13 @@ Effect.Grow = function(element) {
width: element.style.width,
opacity: element.getInlineOpacity() };
- var dims = element.getDimensions();
+ var dims = element.getDimensions();
var initialMoveX, initialMoveY;
var moveX, moveY;
-
+
switch (options.direction) {
case 'top-left':
- initialMoveX = initialMoveY = moveX = moveY = 0;
+ initialMoveX = initialMoveY = moveX = moveY = 0;
break;
case 'top-right':
initialMoveX = dims.width;
@@ -793,11 +793,11 @@ Effect.Grow = function(element) {
moveY = -dims.height / 2;
break;
}
-
+
return new Effect.Move(element, {
x: initialMoveX,
y: initialMoveY,
- duration: 0.01,
+ duration: 0.01,
beforeSetup: function(effect) {
effect.element.hide().makeClipping().makePositioned();
},
@@ -806,14 +806,14 @@ Effect.Grow = function(element) {
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
new Effect.Scale(effect.element, 100, {
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
+ scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
], Object.extend({
beforeSetup: function(effect) {
- effect.effects[0].element.setStyle({height: '0px'}).show();
+ effect.effects[0].element.setStyle({height: '0px'}).show();
},
afterFinishInternal: function(effect) {
- effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
+ effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
}
}, options)
)
@@ -838,7 +838,7 @@ Effect.Shrink = function(element) {
var dims = element.getDimensions();
var moveX, moveY;
-
+
switch (options.direction) {
case 'top-left':
moveX = moveY = 0;
@@ -855,19 +855,19 @@ Effect.Shrink = function(element) {
moveX = dims.width;
moveY = dims.height;
break;
- case 'center':
+ case 'center':
moveX = dims.width / 2;
moveY = dims.height / 2;
break;
}
-
+
return new Effect.Parallel(
[ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
- ], Object.extend({
+ ], Object.extend({
beforeStartInternal: function(effect) {
- effect.effects[0].element.makePositioned().makeClipping();
+ effect.effects[0].element.makePositioned().makeClipping();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
@@ -882,7 +882,7 @@ Effect.Pulsate = function(element) {
var transition = options.transition || Effect.Transitions.sinoidal;
var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
reverser.bind(transition);
- return new Effect.Opacity(element,
+ return new Effect.Opacity(element,
Object.extend(Object.extend({ duration: 2.0, from: 0,
afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
}, options), {transition: reverser}));
@@ -896,12 +896,12 @@ Effect.Fold = function(element) {
width: element.style.width,
height: element.style.height };
element.makeClipping();
- return new Effect.Scale(element, 5, Object.extend({
+ return new Effect.Scale(element, 5, Object.extend({
scaleContent: false,
scaleX: false,
afterFinishInternal: function(effect) {
- new Effect.Scale(element, 1, {
- scaleContent: false,
+ new Effect.Scale(element, 1, {
+ scaleContent: false,
scaleY: false,
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping().setStyle(oldStyle);
@@ -916,7 +916,7 @@ Effect.Morph = Class.create(Effect.Base, {
var options = Object.extend({
style: { }
}, arguments[1] || { });
-
+
if (!Object.isString(options.style)) this.style = $H(options.style);
else {
if (options.style.include(':'))
@@ -939,13 +939,13 @@ Effect.Morph = Class.create(Effect.Base, {
}
this.start(options);
},
-
+
setup: function(){
function parseColor(color){
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
color = color.parseColor();
return $R(0,2).map(function(i){
- return parseInt( color.slice(i*2+1,i*2+3), 16 )
+ return parseInt( color.slice(i*2+1,i*2+3), 16 )
});
}
this.transforms = this.style.map(function(pair){
@@ -965,9 +965,9 @@ Effect.Morph = Class.create(Effect.Base, {
}
var originalValue = this.element.getStyle(property);
- return {
- style: property.camelize(),
- originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
+ return {
+ style: property.camelize(),
+ originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
targetValue: unit=='color' ? parseColor(value) : value,
unit: unit
};
@@ -984,7 +984,7 @@ Effect.Morph = Class.create(Effect.Base, {
update: function(position) {
var style = { }, transform, i = this.transforms.length;
while(i--)
- style[(transform = this.transforms[i]).style] =
+ style[(transform = this.transforms[i]).style] =
transform.unit=='color' ? '#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
@@ -993,7 +993,7 @@ Effect.Morph = Class.create(Effect.Base, {
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
(transform.originalValue +
- (transform.targetValue - transform.originalValue) * position).toFixed(3) +
+ (transform.targetValue - transform.originalValue) * position).toFixed(3) +
(transform.unit === null ? '' : transform.unit);
this.element.setStyle(style, true);
}
@@ -1030,7 +1030,7 @@ Effect.Transform = Class.create({
});
Element.CSS_PROPERTIES = $w(
- 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
+ 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
@@ -1039,7 +1039,7 @@ Element.CSS_PROPERTIES = $w(
'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
'right textIndent top width wordSpacing zIndex');
-
+
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
String.__parseStyleElement = document.createElement('div');
@@ -1051,11 +1051,11 @@ String.prototype.parseStyle = function(){
String.__parseStyleElement.innerHTML = '';
style = String.__parseStyleElement.childNodes[0].style;
}
-
+
Element.CSS_PROPERTIES.each(function(property){
- if (style[property]) styleRules.set(property, style[property]);
+ if (style[property]) styleRules.set(property, style[property]);
});
-
+
if (Prototype.Browser.IE && this.include('opacity'))
styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
@@ -1104,7 +1104,7 @@ Effect.Methods = {
$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
'pulsate shake puff squish switchOff dropOut').each(
- function(effect) {
+ function(effect) {
Effect.Methods[effect] = function(element, options){
element = $(element);
Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
@@ -1113,7 +1113,7 @@ $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
}
);
-$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
function(f) { Effect.Methods[f] = Element[f]; }
);
diff --git a/public/javascripts/lowpro.js b/public/javascripts/lowpro.js
index 6bd2787..d3dcc49 100644
--- a/public/javascripts/lowpro.js
+++ b/public/javascripts/lowpro.js
@@ -3,10 +3,10 @@ LowPro.Version = '0.5';
LowPro.CompatibleWithPrototype = '1.6';
if (Prototype.Version.indexOf(LowPro.CompatibleWithPrototype) != 0 && console && console.warn)
- console.warn("This version of Low Pro is tested with Prototype " + LowPro.CompatibleWithPrototype +
+ console.warn("This version of Low Pro is tested with Prototype " + LowPro.CompatibleWithPrototype +
" it may not work as expected with this version (" + Prototype.Version + ")");
-if (!Element.addMethods)
+if (!Element.addMethods)
Element.addMethods = function(o) { Object.extend(Element.Methods, o) };
// Simple utility methods for working with the DOM
@@ -16,14 +16,14 @@ DOM = {};
DOM.Builder = {
tagFunc : function(tag) {
return function() {
- var attrs, children;
- if (arguments.length>0) {
- if (arguments[0].nodeName ||
- typeof arguments[0] == "string")
- children = arguments;
- else {
- attrs = arguments[0];
- children = Array.prototype.slice.call(arguments, 1);
+ var attrs, children;
+ if (arguments.length>0) {
+ if (arguments[0].nodeName ||
+ typeof arguments[0] == "string")
+ children = arguments;
+ else {
+ attrs = arguments[0];
+ children = Array.prototype.slice.call(arguments, 1);
};
}
return DOM.Builder.create(tag, attrs, children);
@@ -32,9 +32,9 @@ DOM.Builder = {
create : function(tag, attrs, children) {
attrs = attrs || {}; children = children || []; tag = tag.toLowerCase();
var el = new Element(tag, attrs);
-
+
for (var i=0; i 'quentin@example.com', :password => 'test', :remember_me => "0"
assert_nil @response.cookies["auth_token"]
end
-
+
def test_should_delete_token_on_logout
login_as :quentin
get :logout
@@ -107,14 +107,14 @@ def test_should_fail_cookie_login
protected
def create_user(options = {})
- post :signup, :user => { :email => 'quire@example.com',
+ post :signup, :user => { :email => 'quire@example.com',
:password => 'quire', :password_confirmation => 'quire' }.merge(options)
end
-
+
def auth_token(token)
CGI::Cookie.new('name' => 'auth_token', 'value' => token)
end
-
+
def cookie_for(user)
auth_token users(user).remember_token
end
diff --git a/test/functional/ads_controller_test.rb b/test/functional/ads_controller_test.rb
index 8203e99..871e115 100644
--- a/test/functional/ads_controller_test.rb
+++ b/test/functional/ads_controller_test.rb
@@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../test_helper'
class AdsControllerTest < ActionController::TestCase
-
+
def test_ad_post_and_email_sent
get :new, {:category => 1, :title => 'test', :ad => 'test ad'}
assert_response :success
end
-
+
def test_url_click_activates_post
assert true
end
-
+
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 9f19269..24e9b85 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -16,7 +16,7 @@ class Test::Unit::TestCase
# don't care one way or the other, switching from MyISAM to InnoDB tables
# is recommended.
#
- # The only drawback to using transactional fixtures is when you actually
+ # The only drawback to using transactional fixtures is when you actually
# need to test transactions. Since your test is bracketed by a transaction,
# any transactions started in your code will be automatically rolled back.
self.use_transactional_fixtures = true
diff --git a/test/unit/ad_test.rb b/test/unit/ad_test.rb
index 5bdf48f..d5b43d0 100644
--- a/test/unit/ad_test.rb
+++ b/test/unit/ad_test.rb
@@ -1,7 +1,7 @@
require File.dirname(__FILE__) + '/../test_helper'
class ClassifiedAdTest < ActiveSupport::TestCase
-
+
#check log/test.log for generated UUID
def test_ad_creation
ad = Ad.create(:title => ads(:test_one).title)
@@ -10,13 +10,13 @@ def test_ad_creation
assert_equal(false, ad.active)
assert !ad.activation_hash.nil?
end
-
+
def test_email_generation_is_working
ad = Ad.create(:title => ads(:test_one).title)
assert ad.valid?
assert_match(/^\d{18}@(chuckslist.com)$/i, ad.email)
end
-
+
def test_no_clash_in_generated_email_address
# Simulate 10000 simultaneous email address generated via Ad creation
# this will take a while to complete
@@ -26,7 +26,7 @@ def test_no_clash_in_generated_email_address
assert_not_equal(ad1.email, ad2.email)
end
end
-
+
def test_created_ads
#ad = Ad.create(:title => 'Ad')
#assert_equal('user', ad.user.email)
diff --git a/test/unit/mailman_test.rb b/test/unit/mailman_test.rb
index 691ecae..a12acd7 100644
--- a/test/unit/mailman_test.rb
+++ b/test/unit/mailman_test.rb
@@ -2,12 +2,12 @@
class MailmanTest < ActionMailer::TestCase
tests Mailman
-
+
def test_email_fixture_is_working
email_text = read_fixture("test_mail_001").join
assert_match(/jalopy/i, email_text)
end
-
+
def test_receive_email_is_working
email_text = read_fixture("test_mail_001").join
response = Mailman.receive(email_text)
@@ -17,32 +17,32 @@ def test_receive_email_is_working
assert_match(/jalopy/i, response.body)
assert_match(/Email delivered by Chuckslist/i, response.body)
end
-
+
def test_fake_email_is_garbaged
email_test = read_fixture("test_mail_002").join
response = Mailman.receive(email_test)
- assert_not_equal("quentin@example.com", response.to[0])
+ assert_not_equal("quentin@example.com", response.to[0])
assert_equal("garbage@chuckslist.org", response.to[0])
end
-
+
def test_regex_match_reply_to_ad_email
assert_match(/^\d{18}@(chuckslist.com)$/i, "200806159145300001@chuckslist.com")
end
-
+
def test_regex_match_ad_activation_email
assert_match(/^([a-zA-Z]{22}@(chuckslist.com))$/i, "abcdefghiJKLmnOPQrstUV@chuckslist.com")
end
-
+
def test_ad_confirmation_email_is_sent
-
+
end
-
+
def test_ad_confirmation_set_true_when_clicked
-
+
end
-
+
def test_ad_confirmation_email_is_working
-
+
end
-
+
end
diff --git a/vendor/plugins/acts_as_authenticated/CHANGELOG b/vendor/plugins/acts_as_authenticated/CHANGELOG
index 339de30..75ba3c3 100644
--- a/vendor/plugins/acts_as_authenticated/CHANGELOG
+++ b/vendor/plugins/acts_as_authenticated/CHANGELOG
@@ -58,7 +58,7 @@
Redirect to signup page if no users have been created [Bousquet]
Experimental generator for creating the users table. Requires edge rails and does not let you set the table name:
-
+
./script/generate authenticated_migration
* (18 Nov 2005)
@@ -70,7 +70,7 @@
Commented out the activate action in the controller [tobyjoe]
fixed notifier.rb's erb variables [tobyjoe]
removed last old instance of set_current_user [tobyjoe]
-
+
* (13 Nov 2005)
@@ -80,7 +80,7 @@
added index template, updated login_required comments [corp]
removed troublesome login_required class method. use the filter instead
-* (12 Nov 2005)
+* (12 Nov 2005)
renaming generators to authentication and authentication_mailer
store user ID in session by default
\ No newline at end of file
diff --git a/vendor/plugins/acts_as_authenticated/README b/vendor/plugins/acts_as_authenticated/README
index 7b9182d..e2816f3 100644
--- a/vendor/plugins/acts_as_authenticated/README
+++ b/vendor/plugins/acts_as_authenticated/README
@@ -19,4 +19,3 @@ Generate your mailer:
./script/generate authenticated_mailer user
Consult the Acts As Authenticated wiki for more: http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated
-
\ No newline at end of file
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb
index 9c8a625..e35eabf 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/authenticated_generator.rb
@@ -30,8 +30,8 @@ def initialize(runtime_args, runtime_options = {})
def manifest
record do |m|
# Check for class naming collisions.
- m.class_collisions controller_class_path, "#{controller_class_name}Controller",
- #"#{controller_class_name}ControllerTest",
+ m.class_collisions controller_class_path, "#{controller_class_name}Controller",
+ #"#{controller_class_name}ControllerTest",
"#{controller_class_name}Helper"
m.class_collisions class_path, "#{class_name}"
#"#{class_name}Test"
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb
index be2f506..c556e61 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_system.rb
@@ -5,18 +5,18 @@ module AuthenticatedSystem
def logged_in?
current_<%= file_name %> != :false
end
-
+
# Accesses the current <%= file_name %> from the session.
def current_<%= file_name %>
@current_<%= file_name %> ||= (session[:<%= file_name %>] && <%= class_name %>.find_by_id(session[:<%= file_name %>])) || :false
end
-
+
# Store the given <%= file_name %> in the session.
def current_<%= file_name %>=(new_<%= file_name %>)
session[:<%= file_name %>] = (new_<%= file_name %>.nil? || new_<%= file_name %>.is_a?(Symbol)) ? nil : new_<%= file_name %>.id
@current_<%= file_name %> = new_<%= file_name %>
end
-
+
# Check if the <%= file_name %> is authorized.
#
# Override this method in your controllers if you want to restrict access
@@ -52,7 +52,7 @@ def login_required
self.current_<%= file_name %> ||= <%= class_name %>.authenticate(username, passwd) || :false if username && passwd
logged_in? && authorized? ? true : access_denied
end
-
+
# Redirect as appropriate when an access request fails.
#
# The default action is to redirect to the login screen.
@@ -74,22 +74,22 @@ def access_denied
end
end
false
- end
-
+ end
+
# Store the URI of the current request in the session.
#
# We can return to this location by calling #redirect_back_or_default.
def store_location
session[:return_to] = request.request_uri
end
-
+
# Redirect to the URI stored by the most recent store_location call or
# to the passed default.
def redirect_back_or_default(default)
session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)
session[:return_to] = nil
end
-
+
# Inclusion hook to make #current_<%= file_name %> and #logged_in?
# available as ActionView helper methods.
def self.included(base)
@@ -115,6 +115,6 @@ def login_from_cookie
def get_auth_data
auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }
auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
- return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
+ return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
end
end
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb
index 0f2cd03..90886f3 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/authenticated_test_helper.rb
@@ -32,7 +32,7 @@ def authorize_as(user)
# # ...
# end
# end
- #
+ #
def assert_difference(object, method = nil, difference = 1)
initial_value = object.send(method)
yield
@@ -44,7 +44,7 @@ def assert_no_difference(object, method, &block)
end
# Assert the block redirects to the login
- #
+ #
# assert_requires_login(:bob) { |c| c.get :edit, :id => 1 }
#
def assert_requires_login(login = nil)
@@ -76,11 +76,11 @@ def initialize(controller, login)
def authenticated
raise NotImplementedError
end
-
+
def check
raise NotImplementedError
end
-
+
def method_missing(method, *args)
@controller.reset!
authenticate
@@ -94,7 +94,7 @@ class HttpLoginProxy < BaseLoginProxy
def authenticate
@controller.login_as @login if @login
end
-
+
def check
@controller.assert_redirected_to :controller => 'account', :action => 'login'
end
@@ -106,7 +106,7 @@ def authenticate
@controller.accept 'application/xml'
@controller.authorize_as @login if @login
end
-
+
def check
@controller.assert_response 401
end
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb
index 56a460b..fc306e2 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/controller.rb
@@ -32,7 +32,7 @@ def signup
rescue ActiveRecord::RecordInvalid
render :action => 'signup'
end
-
+
def logout
self.current_<%= file_name %>.forget_me if logged_in?
cookies.delete :auth_token
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb
index 48273e8..7b4053a 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/functional_test.rb
@@ -84,7 +84,7 @@ def test_should_not_remember_me
post :login, :login => 'quentin', :password => 'test', :remember_me => "0"
assert_nil @response.cookies["auth_token"]
end
-
+
def test_should_delete_token_on_logout
login_as :quentin
get :logout
@@ -115,14 +115,14 @@ def test_should_fail_cookie_login
protected
def create_<%= file_name %>(options = {})
- post :signup, :<%= file_name %> => { :login => 'quire', :email => 'quire@example.com',
+ post :signup, :<%= file_name %> => { :login => 'quire', :email => 'quire@example.com',
:password => 'quire', :password_confirmation => 'quire' }.merge(options)
end
-
+
def auth_token(token)
CGI::Cookie.new('name' => 'auth_token', 'value' => token)
end
-
+
def cookie_for(<%= file_name %>)
auth_token <%= table_name %>(<%= file_name %>).remember_token
end
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml
index 9c706f8..b762c41 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/index.rhtml
@@ -1,53 +1,53 @@
In the Caboose.
<%% content_for 'poem' do -%>
-"Train delayed? and what's to say?"
-"Blocked by last night's snow they say."
-Seven hours or so to wait;
-Well, that's pleasant! but there's the freight.
-Depot loafing no one fancies,
-We'll try the caboose and take our chances.
-
-Cool this morning in Watertown,
-Somewhat frosty___mercury down;
-Enter caboose___roaring fire,
-With never an air-hole; heat so dire
-That we shrivel and pant; we are roasted through-
-Outside, thermometer thirty-two.
-
-We start with a jerk and suddenly stop.
-"What's broke?" says one; another "What's up?",
-"Oh, nothing," they answer, "That's our way:
-You must stand the jerking, sorry to say."
-We "stand it" with oft this painful thought:
-Are our heads on yet, or are they not?
-
-Comrades in misery___let me see;
-Girl like a statue opposite me;
-Back and forth the others jostle___
-She never winks, nor moves a muscle;
-See her, as she sits there now;
-She's "well balanced," anyhow.
-
-Woman in trouble, tearful eyes,
-Sits by the window, softly cries,
-Pity___for griefs we may not know,
-For breasts that ache, for tears that flow,
-Though we know not why. Her eyelids red
-Tell a sorrowful tale___some hope is dead.
-
-Man who follows the Golden Rule,
-And lends his papers___a pocket full,
-Has a blank book___once in a minute
-Has an idea, and writes it in it.
-Guess him? Yes, of course I can,
-He's a___well___a newspaper man.
-
-Blue-eyed fairy, wrapped in fur;
-Sweet young mother tending her.
-Fairy thinks it's "awful far,"
-Wants to get off this "naughty car."
-So do we, young golden-hair;
+"Train delayed? and what's to say?"
+"Blocked by last night's snow they say."
+Seven hours or so to wait;
+Well, that's pleasant! but there's the freight.
+Depot loafing no one fancies,
+We'll try the caboose and take our chances.
+
+Cool this morning in Watertown,
+Somewhat frosty___mercury down;
+Enter caboose___roaring fire,
+With never an air-hole; heat so dire
+That we shrivel and pant; we are roasted through-
+Outside, thermometer thirty-two.
+
+We start with a jerk and suddenly stop.
+"What's broke?" says one; another "What's up?",
+"Oh, nothing," they answer, "That's our way:
+You must stand the jerking, sorry to say."
+We "stand it" with oft this painful thought:
+Are our heads on yet, or are they not?
+
+Comrades in misery___let me see;
+Girl like a statue opposite me;
+Back and forth the others jostle___
+She never winks, nor moves a muscle;
+See her, as she sits there now;
+She's "well balanced," anyhow.
+
+Woman in trouble, tearful eyes,
+Sits by the window, softly cries,
+Pity___for griefs we may not know,
+For breasts that ache, for tears that flow,
+Though we know not why. Her eyelids red
+Tell a sorrowful tale___some hope is dead.
+
+Man who follows the Golden Rule,
+And lends his papers___a pocket full,
+Has a blank book___once in a minute
+Has an idea, and writes it in it.
+Guess him? Yes, of course I can,
+He's a___well___a newspaper man.
+
+Blue-eyed fairy, wrapped in fur;
+Sweet young mother tending her.
+Fairy thinks it's "awful far,"
+Wants to get off this "naughty car."
+So do we, young golden-hair;
All this crowd are with you there!
<%% end -%>
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb
index 308618b..c11e7c7 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated/templates/model.rb
@@ -34,7 +34,7 @@ def authenticated?(password)
end
def remember_token?
- remember_token_expires_at && Time.now.utc < remember_token_expires_at
+ remember_token_expires_at && Time.now.utc < remember_token_expires_at
end
# These create and unset the fields required for remembering users between browser closes
@@ -51,13 +51,13 @@ def forget_me
end
protected
- # before filter
+ # before filter
def encrypt_password
return if password.blank?
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?
self.crypted_password = encrypt(password)
end
-
+
def password_required?
crypted_password.blank? || !password.blank?
end
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb
index df2a94a..8cd83ce 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/authenticated_mailer_generator.rb
@@ -14,7 +14,7 @@ def manifest
class_path,
"#{file_name}_#{model_type}.rb")
end
-
+
m.template 'notifier_test.rb', File.join('test/unit', class_path, "#{file_name}_notifier_test.rb")
# Mailer templates
diff --git a/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb b/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb
index df52af8..4744a49 100644
--- a/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb
+++ b/vendor/plugins/acts_as_authenticated/generators/authenticated_mailer/templates/notifier.rb
@@ -4,13 +4,13 @@ def signup_notification(<%= file_name %>)
@subject += 'Please activate your new account'
@body[:url] = "http://YOURSITE/account/activate/#{<%= file_name %>.activation_code}"
end
-
+
def activation(<%= file_name %>)
setup_email(<%= file_name %>)
@subject += 'Your account has been activated!'
@body[:url] = "http://YOURSITE/"
end
-
+
protected
def setup_email(<%= file_name %>)
@recipients = "#{<%= file_name %>.email}"
diff --git a/vendor/plugins/attachment_fu/README b/vendor/plugins/attachment_fu/README
index d9da4ef..00d1fb3 100644
--- a/vendor/plugins/attachment_fu/README
+++ b/vendor/plugins/attachment_fu/README
@@ -21,7 +21,7 @@ attachment_fu models
====================
For all three of these storage options a table of metadata is required. This table will contain information about the file (hence the 'meta') and its location. This table has no restrictions on naming, unlike the extra table required for database storage, which must have a table name of db_files (and by convention a model of DbFile).
-
+
In the model there are two methods made available by this plugins: has_attachment and validates_as_attachment.
has_attachment(options = {})
@@ -42,13 +42,13 @@ has_attachment(options = {})
:thumbnail_class # Set which model class to use for thumbnails.
# This current attachment class is used by default.
:path_prefix # path to store the uploaded files.
- # Uses public/#{table_name} by default for the filesystem, and just #{table_name} for the S3 backend.
+ # Uses public/#{table_name} by default for the filesystem, and just #{table_name} for the S3 backend.
# Setting this sets the :storage to :file_system.
:storage # Specifies the storage system to use..
# Defaults to :db_file. Options are :file_system, :db_file, and :s3.
:processor # Sets the image processor to use for resizing of the attached image.
# Options include ImageScience, Rmagick, and MiniMagick. Default is whatever is installed.
-
+
Examples:
has_attachment :max_size => 1.kilobyte
@@ -59,7 +59,7 @@ has_attachment(options = {})
has_attachment :content_type => ['application/pdf', :image], :resize_to => 'x50'
has_attachment :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
has_attachment :storage => :file_system, :path_prefix => 'public/files'
- has_attachment :storage => :file_system, :path_prefix => 'public/files',
+ has_attachment :storage => :file_system, :path_prefix => 'public/files',
:content_type => :image, :resize_to => [50,50]
has_attachment :storage => :file_system, :path_prefix => 'public/files',
:thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
@@ -67,7 +67,7 @@ has_attachment(options = {})
validates_as_attachment
This method prevents files outside of the valid range (:min_size to :max_size, or the :size range) from being saved. It does not however, halt the upload of such files. They will be uploaded into memory regardless of size before validation.
-
+
Example:
validates_as_attachment
@@ -86,12 +86,12 @@ Fields for attachment_fu metadata tables...
that reference images that will be thumbnailed:
parent_id, :integer # id of parent image (on the same table, a self-referencing foreign-key).
# Only populated if the current object is a thumbnail.
- thumbnail, :string # the 'type' of thumbnail this attachment record describes.
+ thumbnail, :string # the 'type' of thumbnail this attachment record describes.
# Only populated if the current object is a thumbnail.
# Usage:
# [ In Model 'Avatar' ]
- # has_attachment :content_type => :image,
- # :storage => :file_system,
+ # has_attachment :content_type => :image,
+ # :storage => :file_system,
# :max_size => 500.kilobytes,
# :resize_to => '320x200>',
# :thumbnails => { :small => '10x10>',
@@ -100,7 +100,7 @@ Fields for attachment_fu metadata tables...
# @user.avatar.thumbnails.first.thumbnail #=> 'small'
that reference files stored in the database (:db_file):
db_file_id, :integer # id of the file in the database (foreign key)
-
+
Field for attachment_fu db_files table:
data, :binary # binary file data, for use in database file storage
@@ -114,7 +114,7 @@ There are two parts of the upload form that differ from typical usage.
1. Include ':multipart => true' in the html options of the form_for tag.
Example:
<% form_for(:attachment_metadata, :url => { :action => "create" }, :html => { :multipart => true }) do |form| %>
-
+
2. Use the file_field helper with :uploaded_data as the field name.
Example:
<%= form.file_field :uploaded_data %>
@@ -142,7 +142,7 @@ Example:
def readme
send_file '/path/to/readme.txt', :type => 'plain/text', :disposition => 'inline'
end
-
+
See the possible values for send_file for reference.
@@ -155,7 +155,7 @@ Example in controller:
@attachable_file = AttachmentMetadataModel.new(params[:attachable])
if @attachable_file.save
flash[:notice] = 'Attachment was successfully created.'
- redirect_to attachable_url(@attachable_file)
+ redirect_to attachable_url(@attachable_file)
else
render :action => :new
end
diff --git a/vendor/plugins/attachment_fu/amazon_s3.yml.tpl b/vendor/plugins/attachment_fu/amazon_s3.yml.tpl
index 81cb807..44a89ec 100644
--- a/vendor/plugins/attachment_fu/amazon_s3.yml.tpl
+++ b/vendor/plugins/attachment_fu/amazon_s3.yml.tpl
@@ -1,14 +1,14 @@
development:
bucket_name: appname_development
- access_key_id:
- secret_access_key:
+ access_key_id:
+ secret_access_key:
test:
bucket_name: appname_test
- access_key_id:
- secret_access_key:
+ access_key_id:
+ secret_access_key:
production:
bucket_name: appname
- access_key_id:
- secret_access_key:
+ access_key_id:
+ secret_access_key:
diff --git a/vendor/plugins/attachment_fu/lib/geometry.rb b/vendor/plugins/attachment_fu/lib/geometry.rb
index 2d6e381..45bd4b3 100644
--- a/vendor/plugins/attachment_fu/lib/geometry.rb
+++ b/vendor/plugins/attachment_fu/lib/geometry.rb
@@ -29,7 +29,7 @@ def initialize(width=nil, height=nil, x=nil, y=nil, flag=nil)
def self.from_s(str)
raise(ArgumentError, "no geometry string specified") unless str
-
+
if m = RE.match(str)
new(m[1].to_i, m[2].to_i, m[3].to_i, m[4].to_i, RFLAGS[m[5]])
else
@@ -46,7 +46,7 @@ def to_s
str << "%+d%+d" % [@x, @y] if (@x != 0 || @y != 0)
str << FLAGS[@flag.to_i]
end
-
+
# attempts to get new dimensions for the current geometry string given these old dimensions.
# This doesn't implement the aspect flag (!) or the area flag (@). PDI
def new_dimensions_for(orig_width, orig_height)
diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb
index 41199bd..4c775fe 100644
--- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb
+++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb
@@ -10,7 +10,7 @@ class ThumbnailError < StandardError; end
class AttachmentError < StandardError; end
module ActMethods
- # Options:
+ # Options:
# * :content_type - Allowed content types. Allows all by default. Use :image to allow all standard image types.
# * :min_size - Minimum size allowed. 1 byte is the default.
# * :max_size - Maximum size allowed. 1.megabyte is the default.
@@ -31,7 +31,7 @@ module ActMethods
# has_attachment :content_type => ['application/pdf', :image], :resize_to => 'x50'
# has_attachment :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
# has_attachment :storage => :file_system, :path_prefix => 'public/files'
- # has_attachment :storage => :file_system, :path_prefix => 'public/files',
+ # has_attachment :storage => :file_system, :path_prefix => 'public/files',
# :content_type => :image, :resize_to => [50,50]
# has_attachment :storage => :file_system, :path_prefix => 'public/files',
# :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
@@ -45,11 +45,11 @@ def has_attachment(options = {})
options[:thumbnail_class] ||= self
options[:s3_access] ||= :public_read
options[:content_type] = [options[:content_type]].flatten.collect! { |t| t == :image ? Technoweenie::AttachmentFu.content_types : t }.flatten unless options[:content_type].nil?
-
+
unless options[:thumbnails].is_a?(Hash)
raise ArgumentError, ":thumbnails option should be a hash: e.g. :thumbnails => { :foo => '50x50' }"
end
-
+
# doing these shenanigans so that #attachment_options is available to processors and backends
class_inheritable_accessor :attachment_options
self.attachment_options = options
@@ -120,7 +120,7 @@ def image?(content_type)
#
# class Foo < ActiveRecord::Base
# acts_as_attachment
- # after_resize do |record, img|
+ # after_resize do |record, img|
# record.aspect_ratio = img.columns.to_f / img.rows.to_f
# end
# end
@@ -167,7 +167,7 @@ def copy_to_temp_file(file, temp_base_name)
FileUtils.cp file, tmp.path
end
end
-
+
# Writes the given data to a new tempfile, returning the closed tempfile.
def write_to_temp_file(data, temp_base_name)
returning Tempfile.new(temp_base_name, Technoweenie::AttachmentFu.tempfile_path) do |tmp|
@@ -183,7 +183,7 @@ module InstanceMethods
def image?
self.class.image?(content_type)
end
-
+
# Returns true/false if an attachment is thumbnailable. A thumbnailable attachment has an image content type and the parent_id attribute.
def thumbnailable?
image? && respond_to?(:parent_id) && parent_id.nil?
@@ -211,8 +211,8 @@ def create_or_update_thumbnail(temp_file, file_name_suffix, *size)
thumbnailable? || raise(ThumbnailError.new("Can't create a thumbnail if the content type is not an image or there is no parent_id column"))
returning find_or_initialize_thumbnail(file_name_suffix) do |thumb|
thumb.attributes = {
- :content_type => content_type,
- :filename => thumbnail_name_for(file_name_suffix),
+ :content_type => content_type,
+ :filename => thumbnail_name_for(file_name_suffix),
:temp_path => temp_file,
:thumbnail_resize_options => size
}
@@ -225,7 +225,7 @@ def create_or_update_thumbnail(temp_file, file_name_suffix, *size)
def content_type=(new_type)
write_attribute :content_type, new_type.to_s.strip
end
-
+
# Sanitizes a filename.
def filename=(new_name)
write_attribute :filename, sanitize_filename(new_name)
@@ -256,14 +256,14 @@ def uploaded_data() nil; end
#
# TODO: Allow it to work with Merb tempfiles too.
def uploaded_data=(file_data)
- return nil if file_data.nil? || file_data.size == 0
-
+ return nil if file_data.nil? || file_data.size == 0
+
if File.respond_to?(:mime_type?)
self.content_type = !(file_data.content_type.strip == "application/octet-stream") ? file_data.content_type : File.mime_type?(file_data.original_filename)
else
self.content_type = file_data.content_type
end
-
+
self.filename = file_data.original_filename if respond_to?(:filename)
if file_data.is_a?(StringIO)
file_data.rewind
@@ -281,13 +281,13 @@ def temp_path
p = temp_paths.first
p.respond_to?(:path) ? p.path : p.to_s
end
-
+
# Gets an array of the currently used temp paths. Defaults to a copy of #full_filename.
def temp_paths
@temp_paths ||= (new_record? || !File.exist?(full_filename)) ? [] : [copy_to_temp_file(full_filename)]
end
-
- # Adds a new temp_path to the array. This should take a string or a Tempfile. This class makes no
+
+ # Adds a new temp_path to the array. This should take a string or a Tempfile. This class makes no
# attempt to remove the files, so Tempfiles should be used. Tempfiles remove themselves when they go out of scope.
# You can also use string paths for temporary files, such as those used for uploaded files in a web server.
def temp_path=(value)
@@ -299,22 +299,22 @@ def temp_path=(value)
def temp_data
save_attachment? ? File.read(temp_path) : nil
end
-
+
# Writes the given data to a Tempfile and adds it to the collection of temp files.
def temp_data=(data)
self.temp_path = write_to_temp_file data unless data.nil?
end
-
+
# Copies the given file to a randomly named Tempfile.
def copy_to_temp_file(file)
self.class.copy_to_temp_file file, random_tempfile_filename
end
-
+
# Writes the given file to a randomly named Tempfile.
def write_to_temp_file(data)
self.class.write_to_temp_file data, random_tempfile_filename
end
-
+
# Stub for creating a temp file from the attachment data. This should be defined in the backend module.
def create_temp_file() end
@@ -329,7 +329,7 @@ def with_image(&block)
end
protected
- # Generates a unique filename for a Tempfile.
+ # Generates a unique filename for a Tempfile.
def random_tempfile_filename
"#{rand Time.now.to_i}#{filename || 'attachment'}"
end
@@ -339,7 +339,7 @@ def sanitize_filename(filename)
# NOTE: File.basename doesn't work right with Windows paths on Unix
# get only the filename, not the whole path
name.gsub! /^.*(\\|\/)/, ''
-
+
# Finally, replace all non alphanumeric, underscore or periods with underscore
name.gsub! /[^\w\.\-]/, '_'
end
@@ -389,7 +389,7 @@ def resize_image_or_thumbnail!(img)
if (!respond_to?(:parent_id) || parent_id.nil?) && attachment_options[:resize_to] # parent image
resize_image(img, attachment_options[:resize_to])
elsif thumbnail_resize_options # thumbnail
- resize_image(img, thumbnail_resize_options)
+ resize_image(img, thumbnail_resize_options)
end
end
@@ -406,7 +406,7 @@ def callback_with_args(method, arg = self)
return result
end
-
+
# Removes the thumbnails for the attachment, if it has any
def destroy_thumbnails
self.thumbnails.each { |thumbnail| thumbnail.destroy } if thumbnailable?
diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb
index 23881e7..0dec0d9 100644
--- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb
+++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb
@@ -12,18 +12,18 @@ def self.included(base) #:nodoc:
def create_temp_file
write_to_temp_file current_data
end
-
+
# Gets the current data from the database
def current_data
db_file.data
end
-
+
protected
# Destroys the file. Called in the after_destroy callback
def destroy_file
db_file.destroy if db_file
end
-
+
# Saves the data to the DbFile model
def save_to_storage
if save_attachment?
diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb
index 464b9c7..0a4e257 100644
--- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb
+++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb
@@ -7,11 +7,11 @@ module FileSystemBackend
def self.included(base) #:nodoc:
base.before_update :rename_file
end
-
+
# Gets the full path to the filename in this format:
#
# # This assumes a model name like MyModel
- # # public/#{table_name} is the default filesystem path
+ # # public/#{table_name} is the default filesystem path
# RAILS_ROOT/public/my_models/5/blah.jpg
#
# Overwrite this method in your model to customize the filename.
@@ -20,29 +20,29 @@ def full_filename(thumbnail = nil)
file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s
File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail)))
end
-
+
# Used as the base path that #public_filename strips off full_filename to create the public path
def base_path
@base_path ||= File.join(RAILS_ROOT, 'public')
end
-
+
# The attachment ID used in the full path of a file
def attachment_path_id
((respond_to?(:parent_id) && parent_id) || id).to_i
end
-
- # overrwrite this to do your own app-specific partitioning.
+
+ # overrwrite this to do your own app-specific partitioning.
# you can thank Jamis Buck for this: http://www.37signals.com/svn/archives2/id_partitioning.php
def partitioned_path(*args)
("%08d" % attachment_path_id).scan(/..../) + args
end
-
+
# Gets the public path to the file
# The optional thumbnail argument will output the thumbnail's filename.
def public_filename(thumbnail = nil)
full_filename(thumbnail).gsub %r(^#{Regexp.escape(base_path)}), ''
end
-
+
def filename=(value)
@old_filename = full_filename unless filename.nil? || @old_filename
write_attribute :filename, sanitize_filename(value)
@@ -75,7 +75,7 @@ def rename_file
@old_filename = nil
true
end
-
+
# Saves the file to the file system
def save_to_storage
if save_attachment?
@@ -87,7 +87,7 @@ def save_to_storage
@old_filename = nil
true
end
-
+
def current_data
File.file?(full_filename) ? File.read(full_filename) : nil
end
diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
index b81fbde..535c4fd 100644
--- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
+++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
@@ -18,17 +18,17 @@ module Backends
# You can sign up for S3 and get access keys by visiting http://aws.amazon.com/s3.
#
# Example configuration (RAILS_ROOT/config/amazon_s3.yml)
- #
+ #
# development:
# bucket_name: appname_development
# access_key_id:
# secret_access_key:
- #
+ #
# test:
# bucket_name: appname_test
# access_key_id:
# secret_access_key:
- #
+ #
# production:
# bucket_name: appname
# access_key_id:
@@ -84,7 +84,7 @@ module Backends
# === Permissions
#
# By default, files are stored on S3 with public access permissions. You can customize this using
- # the :s3_access option to has_attachment. Available values are
+ # the :s3_access option to has_attachment. Available values are
# :private, :public_read_write, and :authenticated_read.
#
# === Other options
@@ -123,7 +123,7 @@ class ConfigFileNotFoundError < StandardError; end
def self.included(base) #:nodoc:
mattr_reader :bucket_name, :s3_config
-
+
begin
require 'aws/s3'
include AWS::S3
@@ -156,11 +156,11 @@ def self.included(base) #:nodoc:
def self.protocol
@protocol ||= s3_config[:use_ssl] ? 'https://' : 'http://'
end
-
+
def self.hostname
@hostname ||= s3_config[:server] || AWS::S3::DEFAULT_HOST
end
-
+
def self.port_string
@port_string ||= s3_config[:port] == (s3_config[:use_ssl] ? 443 : 80) ? '' : ":#{s3_config[:port]}"
end
@@ -169,11 +169,11 @@ module ClassMethods
def s3_protocol
Technoweenie::AttachmentFu::Backends::S3Backend.protocol
end
-
+
def s3_hostname
Technoweenie::AttachmentFu::Backends::S3Backend.hostname
end
-
+
def s3_port_string
Technoweenie::AttachmentFu::Backends::S3Backend.port_string
end
@@ -202,7 +202,7 @@ def full_filename(thumbnail = nil)
File.join(base_path, thumbnail_name_for(thumbnail))
end
- # All public objects are accessible via a GET request to the S3 servers. You can generate a
+ # All public objects are accessible via a GET request to the S3 servers. You can generate a
# url for an object using the s3_url method.
#
# @photo.s3_url
@@ -217,7 +217,7 @@ def s3_url(thumbnail = nil)
end
alias :public_filename :s3_url
- # All private objects are accessible via an authenticated GET request to the S3 servers. You can generate an
+ # All private objects are accessible via an authenticated GET request to the S3 servers. You can generate an
# authenticated url for an object like this:
#
# @photo.authenticated_s3_url
@@ -229,7 +229,7 @@ def s3_url(thumbnail = nil)
#
# # Absolute expiration date (October 13th, 2025)
# @photo.authenticated_s3_url(:expires => Time.mktime(2025,10,13).to_i)
- #
+ #
# # Expiration in five hours from now
# @photo.authenticated_s3_url(:expires_in => 5.hours)
#
@@ -258,11 +258,11 @@ def current_data
def s3_protocol
Technoweenie::AttachmentFu::Backends::S3Backend.protocol
end
-
+
def s3_hostname
Technoweenie::AttachmentFu::Backends::S3Backend.hostname
end
-
+
def s3_port_string
Technoweenie::AttachmentFu::Backends::S3Backend.port_string
end
@@ -275,7 +275,7 @@ def destroy_file
def rename_file
return unless @old_filename && @old_filename != filename
-
+
old_full_filename = File.join(base_path, @old_filename)
S3Object.rename(
diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb
index b1c821d..22c92cb 100644
--- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb
+++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb
@@ -7,7 +7,7 @@ def self.included(base)
base.send :extend, ClassMethods
base.alias_method_chain :process_attachment, :processing
end
-
+
module ClassMethods
# Yields a block containing an MiniMagick Image for the given binary data.
def with_image(file, &block)
@@ -48,11 +48,11 @@ def resize_image(img, size)
end
self.temp_path = img
end
-
- def resize_and_crop(image, square_size)
- if image[:width] < image[:height]
- shave_off = ((image[:height] - image[:width])/2).round
- image.shave("0x#{shave_off}")
+
+ def resize_and_crop(image, square_size)
+ if image[:width] < image[:height]
+ shave_off = ((image[:height] - image[:width])/2).round
+ image.shave("0x#{shave_off}")
elsif image[:width] > image[:height]
shave_off = ((image[:width] - image[:height])/2).round
image.shave("#{shave_off}x0")
diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
index 7999edb..492e063 100644
--- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
+++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
@@ -7,7 +7,7 @@ def self.included(base)
base.send :extend, ClassMethods
base.alias_method_chain :process_attachment, :processing
end
-
+
module ClassMethods
# Yields a block containing an RMagick Image for the given binary data.
def with_image(file, &block)
@@ -35,7 +35,7 @@ def process_attachment_with_processing
callback_with_args :after_resize, img
end if image?
end
-
+
# Performs the actual resizing operation for a thumbnail
def resize_image(img, size)
size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)
diff --git a/vendor/plugins/attachment_fu/test/backends/db_file_test.rb b/vendor/plugins/attachment_fu/test/backends/db_file_test.rb
index e95bb49..a87a478 100644
--- a/vendor/plugins/attachment_fu/test/backends/db_file_test.rb
+++ b/vendor/plugins/attachment_fu/test/backends/db_file_test.rb
@@ -11,6 +11,6 @@ def test_should_call_after_attachment_saved(klass = Attachment)
end
assert_equal 1, attachment_model.saves
end
-
+
test_against_subclass :test_should_call_after_attachment_saved, Attachment
end
\ No newline at end of file
diff --git a/vendor/plugins/attachment_fu/test/backends/file_system_test.rb b/vendor/plugins/attachment_fu/test/backends/file_system_test.rb
index d3250c1..20e794f 100644
--- a/vendor/plugins/attachment_fu/test/backends/file_system_test.rb
+++ b/vendor/plugins/attachment_fu/test/backends/file_system_test.rb
@@ -11,7 +11,7 @@ def test_filesystem_size_for_file_attachment(klass = FileAttachment)
assert_equal attachment.size, File.open(attachment.full_filename).stat.size
end
end
-
+
test_against_subclass :test_filesystem_size_for_file_attachment, FileAttachment
def test_should_not_overwrite_file_attachment(klass = FileAttachment)
@@ -21,15 +21,15 @@ def test_should_not_overwrite_file_attachment(klass = FileAttachment)
assert_valid real
assert !real.new_record?, real.errors.full_messages.join("\n")
assert !real.size.zero?
-
+
fake = upload_file :filename => '/files/fake/rails.png'
assert_valid fake
assert !fake.size.zero?
-
+
assert_not_equal File.open(real.full_filename).stat.size, File.open(fake.full_filename).stat.size
end
end
-
+
test_against_subclass :test_should_not_overwrite_file_attachment, FileAttachment
def test_should_store_file_attachment_in_filesystem(klass = FileAttachment)
@@ -38,13 +38,13 @@ def test_should_store_file_attachment_in_filesystem(klass = FileAttachment)
assert_created do
attachment = upload_file :filename => '/files/rails.png'
assert_valid attachment
- assert File.exists?(attachment.full_filename), "#{attachment.full_filename} does not exist"
+ assert File.exists?(attachment.full_filename), "#{attachment.full_filename} does not exist"
end
attachment
end
-
+
test_against_subclass :test_should_store_file_attachment_in_filesystem, FileAttachment
-
+
def test_should_delete_old_file_when_updating(klass = FileAttachment)
attachment_model klass
attachment = upload_file :filename => '/files/rails.png'
@@ -54,14 +54,14 @@ def test_should_delete_old_file_when_updating(klass = FileAttachment)
attachment.filename = 'rails2.png'
attachment.temp_path = File.join(fixture_path, file)
attachment.save!
- assert File.exists?(attachment.full_filename), "#{attachment.full_filename} does not exist"
+ assert File.exists?(attachment.full_filename), "#{attachment.full_filename} does not exist"
assert !File.exists?(old_filename), "#{old_filename} still exists"
end
end
end
-
+
test_against_subclass :test_should_delete_old_file_when_updating, FileAttachment
-
+
def test_should_delete_old_file_when_renaming(klass = FileAttachment)
attachment_model klass
attachment = upload_file :filename => '/files/rails.png'
@@ -69,12 +69,12 @@ def test_should_delete_old_file_when_renaming(klass = FileAttachment)
assert_not_created do
attachment.filename = 'rails2.png'
attachment.save
- assert File.exists?(attachment.full_filename), "#{attachment.full_filename} does not exist"
+ assert File.exists?(attachment.full_filename), "#{attachment.full_filename} does not exist"
assert !File.exists?(old_filename), "#{old_filename} still exists"
assert !attachment.reload.size.zero?
assert_equal 'rails2.png', attachment.filename
end
end
-
+
test_against_subclass :test_should_delete_old_file_when_renaming, FileAttachment
end
\ No newline at end of file
diff --git a/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb b/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb
index 82520a0..65a158f 100644
--- a/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb
+++ b/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb
@@ -83,11 +83,11 @@ def http_response_for(url)
url = URI.parse(url)
Net::HTTP.start(url.host, url.port) {|http| http.request_head(url.path) }
end
-
+
def s3_protocol
Technoweenie::AttachmentFu::Backends::S3Backend.protocol
end
-
+
def s3_hostname
Technoweenie::AttachmentFu::Backends::S3Backend.hostname
end
diff --git a/vendor/plugins/attachment_fu/test/base_attachment_tests.rb b/vendor/plugins/attachment_fu/test/base_attachment_tests.rb
index c9dbbd7..c2169a8 100644
--- a/vendor/plugins/attachment_fu/test/base_attachment_tests.rb
+++ b/vendor/plugins/attachment_fu/test/base_attachment_tests.rb
@@ -11,32 +11,32 @@ def test_should_create_file_from_uploaded_file
assert_nil attachment.height
end
end
-
+
def test_reassign_attribute_data
assert_created 1 do
attachment = upload_file :filename => '/files/rails.png'
assert_valid attachment
assert attachment.size > 0, "no data was set"
-
+
attachment.temp_data = 'wtf'
assert attachment.save_attachment?
attachment.save!
-
+
assert_equal 'wtf', attachment_model.find(attachment.id).send(:current_data)
end
end
-
+
def test_no_reassign_attribute_data_on_nil
assert_created 1 do
attachment = upload_file :filename => '/files/rails.png'
assert_valid attachment
assert attachment.size > 0, "no data was set"
-
+
attachment.temp_data = nil
assert !attachment.save_attachment?
end
end
-
+
def test_should_overwrite_old_contents_when_updating
attachment = upload_file :filename => '/files/rails.png'
assert_not_created do # no new db_file records
@@ -47,7 +47,7 @@ def test_should_overwrite_old_contents_when_updating
end
end
end
-
+
def test_should_save_without_updating_file
attachment = upload_file :filename => '/files/foo.txt'
assert_valid attachment
diff --git a/vendor/plugins/attachment_fu/test/basic_test.rb b/vendor/plugins/attachment_fu/test/basic_test.rb
index 2094eb1..b04356d 100644
--- a/vendor/plugins/attachment_fu/test/basic_test.rb
+++ b/vendor/plugins/attachment_fu/test/basic_test.rb
@@ -4,15 +4,15 @@ class BasicTest < Test::Unit::TestCase
def test_should_set_default_min_size
assert_equal 1, Attachment.attachment_options[:min_size]
end
-
+
def test_should_set_default_max_size
assert_equal 1.megabyte, Attachment.attachment_options[:max_size]
end
-
+
def test_should_set_default_size
assert_equal (1..1.megabyte), Attachment.attachment_options[:size]
end
-
+
def test_should_set_default_thumbnails_option
assert_equal Hash.new, Attachment.attachment_options[:thumbnails]
end
@@ -20,19 +20,19 @@ def test_should_set_default_thumbnails_option
def test_should_set_default_thumbnail_class
assert_equal Attachment, Attachment.attachment_options[:thumbnail_class]
end
-
+
def test_should_normalize_content_types_to_array
assert_equal %w(pdf), PdfAttachment.attachment_options[:content_type]
assert_equal %w(pdf doc txt), DocAttachment.attachment_options[:content_type]
assert_equal ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png'], ImageAttachment.attachment_options[:content_type]
assert_equal ['pdf', 'image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png'], ImageOrPdfAttachment.attachment_options[:content_type]
end
-
+
def test_should_sanitize_content_type
@attachment = Attachment.new :content_type => ' foo '
assert_equal 'foo', @attachment.content_type
end
-
+
def test_should_sanitize_filenames
@attachment = Attachment.new :filename => 'blah/foo.bar'
assert_equal 'foo.bar', @attachment.filename
@@ -43,18 +43,18 @@ def test_should_sanitize_filenames
@attachment.filename = 'f o!O-.bar'
assert_equal 'f_o_O-.bar', @attachment.filename
end
-
+
def test_should_convert_thumbnail_name
@attachment = FileAttachment.new :filename => 'foo.bar'
assert_equal 'foo.bar', @attachment.thumbnail_name_for(nil)
assert_equal 'foo.bar', @attachment.thumbnail_name_for('')
assert_equal 'foo_blah.bar', @attachment.thumbnail_name_for(:blah)
assert_equal 'foo_blah.blah.bar', @attachment.thumbnail_name_for('blah.blah')
-
+
@attachment.filename = 'foo.bar.baz'
assert_equal 'foo.bar_blah.baz', @attachment.thumbnail_name_for(:blah)
end
-
+
def test_should_require_valid_thumbnails_option
klass = Class.new(ActiveRecord::Base)
assert_raise ArgumentError do
diff --git a/vendor/plugins/attachment_fu/test/extra_attachment_test.rb b/vendor/plugins/attachment_fu/test/extra_attachment_test.rb
index 15b1852..269c109 100644
--- a/vendor/plugins/attachment_fu/test/extra_attachment_test.rb
+++ b/vendor/plugins/attachment_fu/test/extra_attachment_test.rb
@@ -3,7 +3,7 @@
class OrphanAttachmentTest < Test::Unit::TestCase
include BaseAttachmentTests
attachment_model OrphanAttachment
-
+
def test_should_create_image_from_uploaded_file
assert_created do
attachment = upload_file :filename => '/files/rails.png'
@@ -13,7 +13,7 @@ def test_should_create_image_from_uploaded_file
assert !attachment.size.zero?
end
end
-
+
def test_should_create_file_from_uploaded_file
assert_created do
attachment = upload_file :filename => '/files/foo.txt'
@@ -23,7 +23,7 @@ def test_should_create_file_from_uploaded_file
assert !attachment.size.zero?
end
end
-
+
def test_should_create_image_from_uploaded_file_with_custom_content_type
assert_created do
attachment = upload_file :content_type => 'foo/bar', :filename => '/files/rails.png'
@@ -34,18 +34,18 @@ def test_should_create_image_from_uploaded_file_with_custom_content_type
#assert_equal 1784, attachment.size
end
end
-
+
def test_should_create_thumbnail
attachment = upload_file :filename => '/files/rails.png'
-
+
assert_raise Technoweenie::AttachmentFu::ThumbnailError do
attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 50, 50)
end
end
-
+
def test_should_create_thumbnail_with_geometry_string
attachment = upload_file :filename => '/files/rails.png'
-
+
assert_raise Technoweenie::AttachmentFu::ThumbnailError do
attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 'x50')
end
diff --git a/vendor/plugins/attachment_fu/test/fixtures/attachment.rb b/vendor/plugins/attachment_fu/test/fixtures/attachment.rb
index 77d60c3..3376b81 100644
--- a/vendor/plugins/attachment_fu/test/fixtures/attachment.rb
+++ b/vendor/plugins/attachment_fu/test/fixtures/attachment.rb
@@ -78,7 +78,7 @@ class OrphanAttachment < ActiveRecord::Base
class MinimalAttachment < ActiveRecord::Base
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files', :processor => :rmagick
validates_as_attachment
-
+
def filename
"#{id}.file"
end
diff --git a/vendor/plugins/attachment_fu/test/geometry_test.rb b/vendor/plugins/attachment_fu/test/geometry_test.rb
index ade4f48..39d6957 100644
--- a/vendor/plugins/attachment_fu/test/geometry_test.rb
+++ b/vendor/plugins/attachment_fu/test/geometry_test.rb
@@ -8,42 +8,42 @@ def test_should_resize
"60x60" => [47, 60],
"100x100" => [78, 100]
end
-
+
def test_should_resize_no_width
assert_geometry 50, 64,
"x50" => [39, 50],
"x60" => [47, 60],
"x100" => [78, 100]
end
-
+
def test_should_resize_no_height
assert_geometry 50, 64,
"50" => [50, 64],
"60" => [60, 77],
"100" => [100, 128]
end
-
+
def test_should_resize_with_percent
assert_geometry 50, 64,
"50x50%" => [25, 32],
"60x60%" => [30, 38],
"120x112%" => [60, 72]
end
-
+
def test_should_resize_with_percent_and_no_width
assert_geometry 50, 64,
"x50%" => [50, 32],
"x60%" => [50, 38],
"x112%" => [50, 72]
end
-
+
def test_should_resize_with_percent_and_no_height
assert_geometry 50, 64,
"50%" => [25, 32],
"60%" => [30, 38],
"120%" => [60, 77]
end
-
+
def test_should_resize_with_less
assert_geometry 50, 64,
"50x50<" => [50, 64],
@@ -52,14 +52,14 @@ def test_should_resize_with_less
"100x112<" => [88, 112],
"40x70<" => [50, 64]
end
-
+
def test_should_resize_with_less_and_no_width
assert_geometry 50, 64,
"x50<" => [50, 64],
"x60<" => [50, 64],
"x100<" => [78, 100]
end
-
+
def test_should_resize_with_less_and_no_height
assert_geometry 50, 64,
"50<" => [50, 64],
@@ -75,14 +75,14 @@ def test_should_resize_with_greater
"100x112>" => [50, 64],
"40x70>" => [40, 51]
end
-
+
def test_should_resize_with_greater_and_no_width
assert_geometry 50, 64,
"x40>" => [31, 40],
"x60>" => [47, 60],
"x100>" => [50, 64]
end
-
+
def test_should_resize_with_greater_and_no_height
assert_geometry 50, 64,
"40>" => [40, 51],
diff --git a/vendor/plugins/attachment_fu/test/processors/image_science_test.rb b/vendor/plugins/attachment_fu/test/processors/image_science_test.rb
index 636918d..d613ae9 100644
--- a/vendor/plugins/attachment_fu/test/processors/image_science_test.rb
+++ b/vendor/plugins/attachment_fu/test/processors/image_science_test.rb
@@ -11,14 +11,14 @@ def test_should_resize_image
# test image science thumbnail
assert_equal 42, attachment.width
assert_equal 55, attachment.height
-
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
-
+
# test exact resize dimensions
assert_equal 50, thumb.width
assert_equal 51, thumb.height
-
+
# test geometry string
assert_equal 31, geo.width
assert_equal 41, geo.height
diff --git a/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb b/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb
index 244a4a2..60581d3 100644
--- a/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb
+++ b/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb
@@ -11,14 +11,14 @@ def test_should_resize_image
# test MiniMagick thumbnail
assert_equal 43, attachment.width
assert_equal 55, attachment.height
-
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
-
+
# test exact resize dimensions
assert_equal 50, thumb.width
assert_equal 51, thumb.height
-
+
# test geometry string
assert_equal 31, geo.width
assert_equal 40, geo.height
diff --git a/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb b/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb
index 13d177a..9bdf7d8 100644
--- a/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb
+++ b/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb
@@ -17,7 +17,7 @@ def test_should_create_image_from_uploaded_file
assert_equal '50x64', attachment.image_size
end
end
-
+
def test_should_create_image_from_uploaded_file_with_custom_content_type
assert_created do
attachment = upload_file :content_type => 'foo/bar', :filename => '/files/rails.png'
@@ -31,10 +31,10 @@ def test_should_create_image_from_uploaded_file_with_custom_content_type
assert_equal [], attachment.thumbnails
end
end
-
+
def test_should_create_thumbnail
attachment = upload_file :filename => '/files/rails.png'
-
+
assert_created do
basename, ext = attachment.filename.split '.'
thumbnail = attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 50, 50)
@@ -48,10 +48,10 @@ def test_should_create_thumbnail
assert_equal "#{basename}_thumb.#{ext}", thumbnail.filename
end
end
-
+
def test_should_create_thumbnail_with_geometry_string
attachment = upload_file :filename => '/files/rails.png'
-
+
assert_created do
basename, ext = attachment.filename.split '.'
thumbnail = attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 'x50')
@@ -65,7 +65,7 @@ def test_should_create_thumbnail_with_geometry_string
assert_equal "#{basename}_thumb.#{ext}", thumbnail.filename
end
end
-
+
def test_should_resize_image(klass = ImageAttachment)
attachment_model klass
assert_equal [50, 50], attachment_model.attachment_options[:resize_to]
@@ -78,9 +78,9 @@ def test_should_resize_image(klass = ImageAttachment)
assert_equal 50, attachment.width
assert_equal 50, attachment.height
end
-
+
test_against_subclass :test_should_resize_image, ImageAttachment
-
+
def test_should_resize_image_with_geometry(klass = ImageOrPdfAttachment)
attachment_model klass
assert_equal 'x50', attachment_model.attachment_options[:resize_to]
@@ -93,26 +93,26 @@ def test_should_resize_image_with_geometry(klass = ImageOrPdfAttachment)
assert_equal 39, attachment.width
assert_equal 50, attachment.height
end
-
+
test_against_subclass :test_should_resize_image_with_geometry, ImageOrPdfAttachment
-
+
def test_should_give_correct_thumbnail_filenames(klass = ImageWithThumbsFileAttachment)
attachment_model klass
assert_created 3 do
attachment = upload_file :filename => '/files/rails.png'
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
-
+
[attachment, thumb, geo].each { |record| assert_valid record }
-
+
assert_match /rails\.png$/, attachment.full_filename
assert_match /rails_geometry\.png$/, attachment.full_filename(:geometry)
assert_match /rails_thumb\.png$/, attachment.full_filename(:thumb)
end
end
-
+
test_against_subclass :test_should_give_correct_thumbnail_filenames, ImageWithThumbsFileAttachment
-
+
def test_should_automatically_create_thumbnails(klass = ImageWithThumbsAttachment)
attachment_model klass
assert_created 3 do
@@ -124,7 +124,7 @@ def test_should_automatically_create_thumbnails(klass = ImageWithThumbsAttachmen
assert_equal 55, attachment.height
assert_equal 2, attachment.thumbnails.length
assert_equal 1.0, attachment.aspect_ratio
-
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
assert !thumb.new_record?, thumb.errors.full_messages.join("\n")
assert !thumb.size.zero?
@@ -132,7 +132,7 @@ def test_should_automatically_create_thumbnails(klass = ImageWithThumbsAttachmen
assert_equal 50, thumb.width
assert_equal 50, thumb.height
assert_equal 1.0, thumb.aspect_ratio
-
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
assert !geo.new_record?, geo.errors.full_messages.join("\n")
assert !geo.size.zero?
@@ -142,13 +142,13 @@ def test_should_automatically_create_thumbnails(klass = ImageWithThumbsAttachmen
assert_equal 1.0, geo.aspect_ratio
end
end
-
+
test_against_subclass :test_should_automatically_create_thumbnails, ImageWithThumbsAttachment
-
+
# same as above method, but test it on a file model
test_against_class :test_should_automatically_create_thumbnails, ImageWithThumbsFileAttachment
test_against_subclass :test_should_automatically_create_thumbnails_on_class, ImageWithThumbsFileAttachment
-
+
def test_should_use_thumbnail_subclass(klass = ImageWithThumbsClassFileAttachment)
attachment_model klass
attachment = nil
@@ -164,18 +164,18 @@ def test_should_use_thumbnail_subclass(klass = ImageWithThumbsClassFileAttachmen
"#full_filename does not use thumbnail class' path."
assert_equal attachment.destroy attachment
end
-
+
test_against_subclass :test_should_use_thumbnail_subclass, ImageWithThumbsClassFileAttachment
-
+
def test_should_remove_old_thumbnail_files_when_updating(klass = ImageWithThumbsFileAttachment)
attachment_model klass
attachment = nil
assert_created 3 do
attachment = upload_file :filename => '/files/rails.png'
end
-
+
old_filenames = [attachment.full_filename] + attachment.thumbnails.collect(&:full_filename)
-
+
assert_not_created do
use_temp_file "files/rails.png" do |file|
attachment.filename = 'rails2.png'
@@ -187,9 +187,9 @@ def test_should_remove_old_thumbnail_files_when_updating(klass = ImageWithThumbs
end
end
end
-
+
test_against_subclass :test_should_remove_old_thumbnail_files_when_updating, ImageWithThumbsFileAttachment
-
+
def test_should_delete_file_when_in_file_system_when_attachment_record_destroyed(klass = ImageWithThumbsFileAttachment)
attachment_model klass
attachment = upload_file :filename => '/files/rails.png'
@@ -198,9 +198,9 @@ def test_should_delete_file_when_in_file_system_when_attachment_record_destroyed
attachment.destroy
filenames.each { |f| assert !File.exists?(f), "#{f} still exists" }
end
-
+
test_against_subclass :test_should_delete_file_when_in_file_system_when_attachment_record_destroyed, ImageWithThumbsFileAttachment
-
+
def test_should_overwrite_old_thumbnail_records_when_updating(klass = ImageWithThumbsAttachment)
attachment_model klass
attachment = nil
@@ -215,9 +215,9 @@ def test_should_overwrite_old_thumbnail_records_when_updating(klass = ImageWithT
end
end
end
-
+
test_against_subclass :test_should_overwrite_old_thumbnail_records_when_updating, ImageWithThumbsAttachment
-
+
def test_should_overwrite_old_thumbnail_records_when_renaming(klass = ImageWithThumbsAttachment)
attachment_model klass
attachment = nil
@@ -231,7 +231,7 @@ def test_should_overwrite_old_thumbnail_records_when_renaming(klass = ImageWithT
assert_equal 'rails2.png', attachment.filename
end
end
-
+
test_against_subclass :test_should_overwrite_old_thumbnail_records_when_renaming, ImageWithThumbsAttachment
else
def test_flunk
diff --git a/vendor/plugins/attachment_fu/test/schema.rb b/vendor/plugins/attachment_fu/test/schema.rb
index b2e284d..d8e0cd9 100644
--- a/vendor/plugins/attachment_fu/test/schema.rb
+++ b/vendor/plugins/attachment_fu/test/schema.rb
@@ -13,7 +13,7 @@
create_table :file_attachments, :force => true do |t|
t.column :parent_id, :integer
- t.column :thumbnail, :string
+ t.column :thumbnail, :string
t.column :filename, :string, :limit => 255
t.column :content_type, :string, :limit => 255
t.column :size, :integer
@@ -25,7 +25,7 @@
create_table :image_science_attachments, :force => true do |t|
t.column :parent_id, :integer
- t.column :thumbnail, :string
+ t.column :thumbnail, :string
t.column :filename, :string, :limit => 255
t.column :content_type, :string, :limit => 255
t.column :size, :integer
@@ -36,7 +36,7 @@
create_table :mini_magick_attachments, :force => true do |t|
t.column :parent_id, :integer
- t.column :thumbnail, :string
+ t.column :thumbnail, :string
t.column :filename, :string, :limit => 255
t.column :content_type, :string, :limit => 255
t.column :size, :integer
@@ -47,7 +47,7 @@
create_table :mini_magick_attachments, :force => true do |t|
t.column :parent_id, :integer
- t.column :thumbnail, :string
+ t.column :thumbnail, :string
t.column :filename, :string, :limit => 255
t.column :content_type, :string, :limit => 255
t.column :size, :integer
@@ -62,7 +62,7 @@
t.column :content_type, :string, :limit => 255
t.column :size, :integer
end
-
+
create_table :minimal_attachments, :force => true do |t|
t.column :size, :integer
t.column :content_type, :string, :limit => 255
@@ -74,7 +74,7 @@
create_table :s3_attachments, :force => true do |t|
t.column :parent_id, :integer
- t.column :thumbnail, :string
+ t.column :thumbnail, :string
t.column :filename, :string, :limit => 255
t.column :content_type, :string, :limit => 255
t.column :size, :integer
diff --git a/vendor/plugins/attachment_fu/test/test_helper.rb b/vendor/plugins/attachment_fu/test/test_helper.rb
index 66a0b72..2d9c36a 100644
--- a/vendor/plugins/attachment_fu/test/test_helper.rb
+++ b/vendor/plugins/attachment_fu/test/test_helper.rb
@@ -14,7 +14,7 @@
db_adapter = ENV['DB']
# no db passed, try one of these fine config-free DBs before bombing.
-db_adapter ||=
+db_adapter ||=
begin
require 'rubygems'
require 'sqlite'
@@ -53,7 +53,7 @@ def setup
DbFile.transaction { [Attachment, FileAttachment, OrphanAttachment, MinimalAttachment, DbFile].each { |klass| klass.delete_all } }
attachment_model self.class.attachment_model
end
-
+
def teardown
FileUtils.rm_rf File.join(File.dirname(__FILE__), 'files')
end
@@ -62,7 +62,7 @@ def teardown
self.use_instantiated_fixtures = false
def self.attachment_model(klass = nil)
- @attachment_model = klass if klass
+ @attachment_model = klass if klass
@attachment_model
end
@@ -107,11 +107,11 @@ def assert_created(num = 1)
end
end
end
-
+
def assert_not_created
assert_created(0) { yield }
end
-
+
def should_reject_by_size_with(klass)
attachment_model klass
assert_not_created do
@@ -121,19 +121,19 @@ def should_reject_by_size_with(klass)
assert_nil attachment.db_file if attachment.respond_to?(:db_file)
end
end
-
+
def assert_difference(object, method = nil, difference = 1)
initial_value = object.send(method)
yield
assert_equal initial_value + difference, object.send(method)
end
-
+
def assert_no_difference(object, method, &block)
assert_difference object, method, 0, &block
end
-
+
def attachment_model(klass = nil)
- @attachment_model = klass if klass
+ @attachment_model = klass if klass
@attachment_model
end
end
diff --git a/vendor/plugins/attachment_fu/test/validation_test.rb b/vendor/plugins/attachment_fu/test/validation_test.rb
index a14cf99..3bb056e 100644
--- a/vendor/plugins/attachment_fu/test/validation_test.rb
+++ b/vendor/plugins/attachment_fu/test/validation_test.rb
@@ -5,11 +5,11 @@ def test_should_invalidate_big_files
@attachment = SmallAttachment.new
assert !@attachment.valid?
assert @attachment.errors.on(:size)
-
+
@attachment.size = 2000
assert !@attachment.valid?
assert @attachment.errors.on(:size), @attachment.errors.full_messages.to_sentence
-
+
@attachment.size = 1000
assert !@attachment.valid?
assert_nil @attachment.errors.on(:size)
@@ -19,16 +19,16 @@ def test_should_invalidate_small_files
@attachment = BigAttachment.new
assert !@attachment.valid?
assert @attachment.errors.on(:size)
-
+
@attachment.size = 2000
assert !@attachment.valid?
assert @attachment.errors.on(:size), @attachment.errors.full_messages.to_sentence
-
+
@attachment.size = 1.megabyte
assert !@attachment.valid?
assert_nil @attachment.errors.on(:size)
end
-
+
def test_should_validate_content_type
@attachment = PdfAttachment.new
assert !@attachment.valid?
@@ -47,7 +47,7 @@ def test_should_require_filename
@attachment = Attachment.new
assert !@attachment.valid?
assert @attachment.errors.on(:filename)
-
+
@attachment.filename = 'foo'
assert !@attachment.valid?
assert_nil @attachment.errors.on(:filename)
diff --git a/vendor/plugins/mimetype_fu/lib/mimetype_fu.rb b/vendor/plugins/mimetype_fu/lib/mimetype_fu.rb
index 3fd0ffe..05b2f83 100644
--- a/vendor/plugins/mimetype_fu/lib/mimetype_fu.rb
+++ b/vendor/plugins/mimetype_fu/lib/mimetype_fu.rb
@@ -13,13 +13,13 @@ def self.mime_type?(file)
if mime
return mime
- else
- 'unknown/unknown'
+ else
+ 'unknown/unknown'
end
end
-
+
def self.extensions
EXTENSIONS
end
-
+
end
\ No newline at end of file
diff --git a/vendor/plugins/mimetype_fu/spec/mime_type_spec.rb b/vendor/plugins/mimetype_fu/spec/mime_type_spec.rb
index 7eb3e78..7976493 100644
--- a/vendor/plugins/mimetype_fu/spec/mime_type_spec.rb
+++ b/vendor/plugins/mimetype_fu/spec/mime_type_spec.rb
@@ -2,55 +2,55 @@
require File.dirname(__FILE__) + '/../lib/mimetype_fu'
describe 'A file with a know extension' do
-
+
before(:each) do
@file = File.open(File.dirname(__FILE__) + '/fixtures/file.jpg')
end
-
+
it 'should have an extension' do
File.extname(@file.path).should == '.jpg'
end
-
+
it 'should have a mime type' do
File.mime_type?(@file).should == "image/jpeg"
end
-
+
end
describe 'A file with anunknow extension' do
-
+
before(:each) do
@file = File.open(File.dirname(__FILE__) + '/fixtures/file.unknown')
end
-
+
it 'should have an extension' do
File.extname(@file.path).should == '.unknown'
end
-
+
it 'should have an unkwown mime type' do
File.mime_type?(@file).should == "unknown/unknown"
end
-
+
end
describe 'A valid file path' do
-
+
before(:each) do
@file_path = "#{Dir.pwd} + /picture.png"
end
-
+
it 'should have a mime type' do
File.mime_type?(@file_path).should == "image/png"
end
-
+
end
describe "An unknown extension" do
-
+
before(:each) do
@file_path = 'file.unknown'
end
-
+
it 'should have an unknown mime type' do
File.mime_type?(@file_path).should == "unknown/unknown"
end
diff --git a/vendor/plugins/will_paginate/LICENSE b/vendor/plugins/will_paginate/LICENSE
index 96a48cb..6b598ff 100644
--- a/vendor/plugins/will_paginate/LICENSE
+++ b/vendor/plugins/will_paginate/LICENSE
@@ -1,18 +1,18 @@
Copyright (c) 2007 PJ Hyett and Mislav Marohnić
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
-The above copyright notice and this permission notice shall be included in all
+The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/plugins/will_paginate/README b/vendor/plugins/will_paginate/README
index 162c189..f4cd414 100644
--- a/vendor/plugins/will_paginate/README
+++ b/vendor/plugins/will_paginate/README
@@ -126,7 +126,7 @@ Want to discuss, request features, ask questions? Join the Google group:
http://groups.google.com/group/will_paginate
Authors:: Mislav Marohnić, PJ Hyett
-Original announcement:: http://errtheblog.com/post/929
+Original announcement:: http://errtheblog.com/post/929
Original PHP source:: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php
All these people helped making will_paginate what it is now with their code
diff --git a/vendor/plugins/will_paginate/Rakefile b/vendor/plugins/will_paginate/Rakefile
index e21df94..fd3efa4 100644
--- a/vendor/plugins/will_paginate/Rakefile
+++ b/vendor/plugins/will_paginate/Rakefile
@@ -39,14 +39,14 @@ desc %{Test everything with Rails 1.2.x and 2.0.x gems}
task :test_all do
all = Rake::Task['test_full']
ENV['RAILS_VERSION'] = '~>1.2.6'
- all.invoke
+ all.invoke
# reset the invoked flag
%w( test_full test test_mysql test_postgres ).each do |name|
Rake::Task[name].instance_variable_set '@already_invoked', false
end
# do it again
ENV['RAILS_VERSION'] = '~>2.0.2'
- all.invoke
+ all.invoke
end
desc 'Generate RDoc documentation for the will_paginate plugin.'
@@ -55,10 +55,10 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.add(files)
rdoc.main = "README" # page to start on
rdoc.title = "will_paginate"
-
+
templates = %w[/Users/chris/ruby/projects/err/rock/template.rb /var/www/rock/template.rb]
rdoc.template = templates.find { |t| File.exists? t }
-
+
rdoc.rdoc_dir = 'doc' # rdoc output folder
rdoc.options << '--inline-source'
rdoc.options << '--charset=UTF-8'
diff --git a/vendor/plugins/will_paginate/lib/will_paginate.rb b/vendor/plugins/will_paginate/lib/will_paginate.rb
index c0a5ce1..9440f04 100644
--- a/vendor/plugins/will_paginate/lib/will_paginate.rb
+++ b/vendor/plugins/will_paginate/lib/will_paginate.rb
@@ -14,7 +14,7 @@ def enable
enable_actionpack
enable_activerecord
end
-
+
# mixes in WillPaginate::ViewHelpers in ActionView::Base
def enable_actionpack
return if ActionView::Base.instance_methods.include? 'will_paginate'
@@ -25,7 +25,7 @@ def enable_actionpack
ActionController::Base.rescue_responses['WillPaginate::InvalidPage'] = :not_found
end
end
-
+
# mixes in WillPaginate::Finder in ActiveRecord::Base and classes that deal
# with associations
def enable_activerecord
@@ -35,7 +35,7 @@ def enable_activerecord
associations = ActiveRecord::Associations
collection = associations::AssociationCollection
-
+
# to support paginating finders on associations, we have to mix in the
# method_missing magic from WillPaginate::Finder::ClassMethods to AssociationProxy
# subclasses, but in a different way for Rails 1.2.x and 2.0
diff --git a/vendor/plugins/will_paginate/lib/will_paginate/collection.rb b/vendor/plugins/will_paginate/lib/will_paginate/collection.rb
index f796131..04042e1 100644
--- a/vendor/plugins/will_paginate/lib/will_paginate/collection.rb
+++ b/vendor/plugins/will_paginate/lib/will_paginate/collection.rb
@@ -14,7 +14,7 @@ def initialize(page, page_num)
super "#{page.inspect} given as value, which translates to '#{page_num}' as page number"
end
end
-
+
# Arrays returned from paginating finds are, in fact, instances of this.
# You may think of WillPaginate::Collection as an ordinary array with some
# extra properties. Those properties are used by view helpers to generate
@@ -36,7 +36,7 @@ def initialize(page, per_page, total = nil)
raise InvalidPage.new(page, @current_page) if @current_page < 1
@per_page = per_page.to_i
raise ArgumentError, "`per_page` setting cannot be less than 1 (#{@per_page} given)" if @per_page < 1
-
+
self.total_entries = total if total
end
diff --git a/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb b/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb
index 461153f..34597ec 100644
--- a/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb
+++ b/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb
@@ -8,7 +8,7 @@ def except(*keys)
rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
reject { |key,| rejected.include?(key) }
end
-
+
# Replaces the hash without only the given keys.
def except!(*keys)
replace(except(*keys))
diff --git a/vendor/plugins/will_paginate/lib/will_paginate/finder.rb b/vendor/plugins/will_paginate/lib/will_paginate/finder.rb
index 5d2d73c..713384e 100644
--- a/vendor/plugins/will_paginate/lib/will_paginate/finder.rb
+++ b/vendor/plugins/will_paginate/lib/will_paginate/finder.rb
@@ -17,22 +17,22 @@ class << base
end
# = Paginating finders for ActiveRecord models
- #
+ #
# WillPaginate adds +paginate+ and +per_page+ methods to ActiveRecord::Base
# class methods and associations. It also hooks into +method_missing+ to
# intercept pagination calls to dynamic finders such as
# +paginate_by_user_id+ and translate them to ordinary finders
# (+find_all_by_user_id+ in this case).
- #
+ #
# In short, paginating finders are equivalent to ActiveRecord finders; the
# only difference is that we start with "paginate" instead of "find" and
# that :page is required parameter:
#
# @posts = Post.paginate :all, :page => params[:page], :order => 'created_at DESC'
- #
+ #
# In paginating finders, "all" is implicit. There is no sense in paginating
# a single record, right? So, you can drop the :all argument:
- #
+ #
# Post.paginate(...) => Post.find :all
# Post.paginate_all_by_something => Post.find_all_by_something
# Post.paginate_by_something => Post.find_all_by_something
@@ -75,23 +75,23 @@ def paginate(*args, &block)
WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
count_options = options.except :page, :per_page, :total_entries, :finder
- find_options = count_options.except(:count).update(:offset => pager.offset, :limit => pager.per_page)
-
+ find_options = count_options.except(:count).update(:offset => pager.offset, :limit => pager.per_page)
+
args << find_options
# @options_from_last_find = nil
pager.replace send(finder, *args, &block)
-
+
# magic counting for user convenience:
pager.total_entries = wp_count(count_options, args, finder) unless pager.total_entries
end
end
-
+
# Wraps +find_by_sql+ by simply adding LIMIT and OFFSET to your SQL string
# based on the params otherwise used by paginating finds: +page+ and
# +per_page+.
#
# Example:
- #
+ #
# @developers = Developer.paginate_by_sql ['select * from developers where salary > ?', 80000],
# :page => params[:page], :per_page => 3
#
@@ -99,7 +99,7 @@ def paginate(*args, &block)
# supply :total_entries. If you experience problems with this
# generated SQL, you might want to perform the count manually in your
# application.
- #
+ #
def paginate_by_sql(sql, options)
WillPaginate::Collection.create(*wp_parse_options(options)) do |pager|
query = sanitize_sql(sql)
@@ -108,11 +108,11 @@ def paginate_by_sql(sql, options)
add_limit! query, :offset => pager.offset, :limit => pager.per_page
# perfom the find
pager.replace find_by_sql(query)
-
+
unless pager.total_entries
count_query = original_query.sub /\bORDER\s+BY\s+[\w`,\s]+$/mi, ''
count_query = "SELECT COUNT(*) FROM (#{count_query})"
-
+
unless ['oracle', 'oci'].include?(self.connection.adapter_name.downcase)
count_query << ' AS count_table'
end
@@ -132,23 +132,23 @@ def respond_to?(method, include_priv = false) #:nodoc:
end
protected
-
+
def method_missing_with_paginate(method, *args, &block) #:nodoc:
# did somebody tried to paginate? if not, let them be
unless method.to_s.index('paginate') == 0
- return method_missing_without_paginate(method, *args, &block)
+ return method_missing_without_paginate(method, *args, &block)
end
-
+
# paginate finders are really just find_* with limit and offset
finder = method.to_s.sub('paginate', 'find')
finder.sub!('find', 'find_all') if finder.index('find_by_') == 0
-
+
options = args.pop
raise ArgumentError, 'parameter hash expected' unless options.respond_to? :symbolize_keys
options = options.dup
options[:finder] = finder
args << options
-
+
paginate(*args, &block)
end
@@ -192,7 +192,7 @@ def wp_parse_options(options) #:nodoc:
raise ArgumentError, 'parameter hash expected' unless options.respond_to? :symbolize_keys
options = options.symbolize_keys
raise ArgumentError, ':page parameter required' unless options.key? :page
-
+
if options[:count] and options[:total_entries]
raise ArgumentError, ':count and :total_entries are mutually exclusive'
end
diff --git a/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb b/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
index 34e2ff0..4cc4934 100644
--- a/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
+++ b/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
@@ -7,7 +7,7 @@ module WillPaginate
# pagination links for the given collection. The helper itself is lightweight
# and serves only as a wrapper around link renderer instantiation; the
# renderer then does all the hard work of generating the HTML.
- #
+ #
# == Global options for helpers
#
# Options for pagination helpers are optional and get their default values from the
@@ -38,7 +38,7 @@ module ViewHelpers
# Renders Digg/Flickr-style pagination for a WillPaginate::Collection
# object. Nil is returned if there is only one page in total; no point in
# rendering the pagination in that case...
- #
+ #
# ==== Options
# * :class -- CSS class name for the generated DIV (default: "pagination")
# * :prev_label -- default: "« Previous"
@@ -59,7 +59,7 @@ module ViewHelpers
#
# All options beside listed ones are passed as HTML attributes to the container
# element for pagination links (the DIV). For example:
- #
+ #
# <%= will_paginate @posts, :id => 'wp_posts' %>
#
# ... will result in:
@@ -126,7 +126,7 @@ def to_html
# previous/next buttons
links.unshift page_link_or_span(@collection.previous_page, 'disabled', @options[:prev_label])
links.push page_link_or_span(@collection.next_page, 'disabled', @options[:next_label])
-
+
html = links.join(@options[:separator])
@options[:container] ? @template.content_tag(:div, html, html_attributes) : html
end
@@ -140,11 +140,11 @@ def html_attributes
end
@html_attributes
end
-
+
protected
def gap_marker; '...'; end
-
+
def windowed_links
prev = nil
@@ -161,7 +161,7 @@ def visible_page_numbers
inner_window, outer_window = @options[:inner_window].to_i, @options[:outer_window].to_i
window_from = current_page - inner_window
window_to = current_page + inner_window
-
+
# adjust lower or upper limit if other is out of bounds
if window_to > total_pages
window_from -= window_to - total_pages
@@ -170,7 +170,7 @@ def visible_page_numbers
window_to += 1 - window_from
window_from = 1
end
-
+
visible = (1..total_pages).to_a
left_gap = (2 + outer_window)...window_from
right_gap = (window_to + 1)...(total_pages - outer_window)
@@ -179,7 +179,7 @@ def visible_page_numbers
visible
end
-
+
def page_link_or_span(page, span_class = 'current', text = nil)
text ||= page.to_s
if page and page != current_page
diff --git a/vendor/plugins/will_paginate/test/array_pagination_test.rb b/vendor/plugins/will_paginate/test/array_pagination_test.rb
index 0aad4c8..c94d4fa 100644
--- a/vendor/plugins/will_paginate/test/array_pagination_test.rb
+++ b/vendor/plugins/will_paginate/test/array_pagination_test.rb
@@ -4,7 +4,7 @@
class ArrayPaginationTest < Test::Unit::TestCase
def test_simple
collection = ('a'..'e').to_a
-
+
[{ :page => 1, :per_page => 3, :expected => %w( a b c ) },
{ :page => 2, :per_page => 3, :expected => %w( d e ) },
{ :page => 1, :per_page => 5, :expected => %w( a b c d e ) },
@@ -28,7 +28,7 @@ def test_deprecated_api
assert_equal (11..20).to_a, result
assert_equal 50, result.total_entries
end
-
+
assert_deprecated { [].paginate nil }
end
@@ -61,7 +61,7 @@ def test_paginated_collection
def test_out_of_bounds
entries = create(2, 3, 2){}
assert entries.out_of_bounds?
-
+
entries = create(1, 3, 2){}
assert !entries.out_of_bounds?
end
@@ -72,19 +72,19 @@ def test_guessing_total_count
pager.replace array
end
assert_equal 8, entries.total_entries
-
+
entries = create(2, 5, 10) do |pager|
# collection is shorter than limit, but we have an explicit count
pager.replace array
end
assert_equal 10, entries.total_entries
-
+
entries = create do |pager|
# collection is the same as limit; we can't guess
pager.replace array(5)
end
assert_equal nil, entries.total_entries
-
+
entries = create do |pager|
# collection is empty; we can't guess
pager.replace array(0)
@@ -116,7 +116,7 @@ def create(page = 2, limit = 5, total = nil, &block)
def array(size = 3)
Array.new(size)
end
-
+
def collect_deprecations
old_behavior = WillPaginate::Deprecation.behavior
deprecations = []
diff --git a/vendor/plugins/will_paginate/test/boot.rb b/vendor/plugins/will_paginate/test/boot.rb
index f1bd72b..6fead0a 100644
--- a/vendor/plugins/will_paginate/test/boot.rb
+++ b/vendor/plugins/will_paginate/test/boot.rb
@@ -11,7 +11,7 @@
# simply use installed gems if available
puts "using Rails#{version ? ' ' + version : nil} gems"
require 'rubygems'
-
+
if version
gem 'rails', version
else
diff --git a/vendor/plugins/will_paginate/test/finder_test.rb b/vendor/plugins/will_paginate/test/finder_test.rb
index b272341..649104f 100644
--- a/vendor/plugins/will_paginate/test/finder_test.rb
+++ b/vendor/plugins/will_paginate/test/finder_test.rb
@@ -10,7 +10,7 @@ class FinderTest < ActiveRecordTestCase
def test_new_methods_presence
assert_respond_to_all Topic, %w(per_page paginate paginate_by_sql)
end
-
+
def test_simple_paginate
entries = Topic.paginate :page => nil
assert_equal 1, entries.current_page
@@ -18,7 +18,7 @@ def test_simple_paginate
assert_nil entries.next_page
assert_equal 1, entries.page_count
assert_equal 4, entries.size
-
+
entries = Topic.paginate :page => 2
assert_equal 2, entries.current_page
assert_equal 1, entries.previous_page
@@ -30,14 +30,14 @@ def test_parameter_api
# :page parameter in options is required!
assert_raise(ArgumentError){ Topic.paginate }
assert_raise(ArgumentError){ Topic.paginate({}) }
-
+
# explicit :all should not break anything
assert_equal Topic.paginate(:page => nil), Topic.paginate(:all, :page => 1)
# :count could be nil and we should still not cry
assert_nothing_raised { Topic.paginate :page => 1, :count => nil }
end
-
+
def test_paginate_with_per_page
entries = Topic.paginate :page => 1, :per_page => 1
assert_equal 1, entries.size
@@ -53,14 +53,14 @@ def test_paginate_with_per_page
assert_equal 5, entries.size
assert_equal 3, entries.page_count
end
-
+
def test_paginate_with_order
entries = Topic.paginate :page => 1, :order => 'created_at desc'
expected = [topics(:futurama), topics(:harvey_birdman), topics(:rails), topics(:ar)].reverse
assert_equal expected, entries.to_a
assert_equal 1, entries.page_count
end
-
+
def test_paginate_with_conditions
entries = Topic.paginate :page => 1, :conditions => ["created_at > ?", 30.minutes.ago]
expected = [topics(:rails), topics(:ar)]
@@ -70,30 +70,30 @@ def test_paginate_with_conditions
def test_paginate_with_include_and_conditions
entries = Topic.paginate \
- :page => 1,
- :include => :replies,
- :conditions => "replies.content LIKE 'Bird%' ",
+ :page => 1,
+ :include => :replies,
+ :conditions => "replies.content LIKE 'Bird%' ",
:per_page => 10
- expected = Topic.find :all,
- :include => 'replies',
- :conditions => "replies.content LIKE 'Bird%' ",
+ expected = Topic.find :all,
+ :include => 'replies',
+ :conditions => "replies.content LIKE 'Bird%' ",
:limit => 10
assert_equal expected, entries.to_a
assert_equal 1, entries.total_entries
end
-
+
def test_paginate_with_include_and_order
entries = Topic.paginate \
- :page => 1,
- :include => :replies,
- :order => 'replies.created_at asc, topics.created_at asc',
+ :page => 1,
+ :include => :replies,
+ :order => 'replies.created_at asc, topics.created_at asc',
:per_page => 10
- expected = Topic.find :all,
- :include => 'replies',
- :order => 'replies.created_at asc, topics.created_at asc',
+ expected = Topic.find :all,
+ :include => 'replies',
+ :order => 'replies.created_at asc, topics.created_at asc',
:limit => 10
assert_equal expected, entries.to_a
@@ -106,15 +106,15 @@ def test_paginate_associations_with_include
assert_nothing_raised "THIS IS A BUG in Rails 1.2.3 that was fixed in [7326]. " +
"Please upgrade to the 1-2-stable branch or edge Rails." do
entries = project.topics.paginate \
- :page => 1,
- :include => :replies,
- :conditions => "replies.content LIKE 'Nice%' ",
+ :page => 1,
+ :include => :replies,
+ :conditions => "replies.content LIKE 'Nice%' ",
:per_page => 10
end
- expected = Topic.find :all,
- :include => 'replies',
- :conditions => "project_id = #{project.id} AND replies.content LIKE 'Nice%' ",
+ expected = Topic.find :all,
+ :include => 'replies',
+ :conditions => "project_id = #{project.id} AND replies.content LIKE 'Nice%' ",
:limit => 10
assert_equal expected, entries.to_a
@@ -151,11 +151,11 @@ def test_paginate_association_extension
entries = project.replies.paginate_recent :page => 1
assert_equal [replies(:brave)], entries
end
-
+
def test_paginate_with_joins
entries = Developer.paginate :page => 1,
:joins => 'LEFT JOIN developers_projects ON users.id = developers_projects.developer_id',
- :conditions => 'project_id = 1'
+ :conditions => 'project_id = 1'
assert_equal 2, entries.size
developer_names = entries.map { |d| d.name }
assert developer_names.include?('David')
@@ -232,15 +232,15 @@ def test_implicit_all_with_dynamic_finders
Topic.expects(:count).returns(0)
Topic.paginate_by_foo :page => 1
end
-
+
def test_guessing_the_total_count
Topic.expects(:find).returns(Array.new(2))
Topic.expects(:count).never
-
+
entries = Topic.paginate :page => 2, :per_page => 4
assert_equal 6, entries.total_entries
end
-
+
def test_extra_parameters_stay_untouched
Topic.expects(:find).with(:all, {:foo => 'bar', :limit => 4, :offset => 0 }).returns(Array.new(5))
Topic.expects(:count).with({:foo => 'bar'}).returns(1)
@@ -264,7 +264,7 @@ def test_should_use_scoped_finders_if_present
# scope-out compatibility
Topic.expects(:find_best).returns(Array.new(5))
Topic.expects(:with_best).returns(1)
-
+
Topic.paginate_best :page => 1, :per_page => 4
end
@@ -272,14 +272,14 @@ def test_paginate_by_sql
assert_respond_to Developer, :paginate_by_sql
Developer.expects(:find_by_sql).with(regexp_matches(/sql LIMIT 3(,| OFFSET) 3/)).returns([])
Developer.expects(:count_by_sql).with('SELECT COUNT(*) FROM (sql) AS count_table').returns(0)
-
+
entries = Developer.paginate_by_sql 'sql', :page => 2, :per_page => 3
end
def test_paginate_by_sql_respects_total_entries_setting
Developer.expects(:find_by_sql).returns([])
Developer.expects(:count_by_sql).never
-
+
entries = Developer.paginate_by_sql 'sql', :page => 1, :total_entries => 999
assert_equal 999, entries.total_entries
end
@@ -287,7 +287,7 @@ def test_paginate_by_sql_respects_total_entries_setting
def test_paginate_by_sql_strips_order_by_when_counting
Developer.expects(:find_by_sql).returns([])
Developer.expects(:count_by_sql).with("SELECT COUNT(*) FROM (sql\n ) AS count_table").returns(0)
-
+
entries = Developer.paginate_by_sql "sql\n ORDER\nby foo, bar, `baz` ASC", :page => 1
end
@@ -296,15 +296,15 @@ def test_ability_to_use_with_custom_finders
# acts_as_taggable defines find_tagged_with(tag, options)
Topic.expects(:find_tagged_with).with('will_paginate', :offset => 0, :limit => 5).returns([])
Topic.expects(:count).with({}).returns(0)
-
+
Topic.paginate_tagged_with 'will_paginate', :page => 1, :per_page => 5
end
-
+
def test_array_argument_doesnt_eliminate_count
ids = (1..8).to_a
Developer.expects(:find_all_by_id).returns([])
Developer.expects(:count).returns(0)
-
+
Developer.paginate_by_id(ids, :per_page => 3, :page => 2, :order => 'id')
end
@@ -314,7 +314,7 @@ def test_paginating_finder_doesnt_mangle_options
options = { :page => 1 }
options.expects(:delete).never
options_before = options.dup
-
+
Developer.paginate(options)
assert_equal options, options_before
end
diff --git a/vendor/plugins/will_paginate/test/fixtures/project.rb b/vendor/plugins/will_paginate/test/fixtures/project.rb
index 0f85ef5..02c2a3e 100644
--- a/vendor/plugins/will_paginate/test/fixtures/project.rb
+++ b/vendor/plugins/will_paginate/test/fixtures/project.rb
@@ -1,10 +1,10 @@
class Project < ActiveRecord::Base
has_and_belongs_to_many :developers, :uniq => true
-
+
has_many :topics
# :finder_sql => 'SELECT * FROM topics WHERE (topics.project_id = #{id})',
# :counter_sql => 'SELECT COUNT(*) FROM topics WHERE (topics.project_id = #{id})'
-
+
has_many :replies, :through => :topics do
def find_recent(params = {})
with_scope :find => { :conditions => ['replies.created_at > ?', 15.minutes.ago] } do
diff --git a/vendor/plugins/will_paginate/test/fixtures/replies.yml b/vendor/plugins/will_paginate/test/fixtures/replies.yml
index 9a83c00..10782c3 100644
--- a/vendor/plugins/will_paginate/test/fixtures/replies.yml
+++ b/vendor/plugins/will_paginate/test/fixtures/replies.yml
@@ -3,13 +3,13 @@ witty_retort:
topic_id: 1
content: Birdman is better!
created_at: <%= 6.hours.ago.to_s(:db) %>
-
+
another:
id: 2
topic_id: 2
content: Nuh uh!
created_at: <%= 1.hour.ago.to_s(:db) %>
-
+
spam:
id: 3
topic_id: 1
diff --git a/vendor/plugins/will_paginate/test/fixtures/reply.rb b/vendor/plugins/will_paginate/test/fixtures/reply.rb
index ea84042..15be052 100644
--- a/vendor/plugins/will_paginate/test/fixtures/reply.rb
+++ b/vendor/plugins/will_paginate/test/fixtures/reply.rb
@@ -1,5 +1,5 @@
class Reply < ActiveRecord::Base
belongs_to :topic, :include => [:replies]
-
+
validates_presence_of :content
end
diff --git a/vendor/plugins/will_paginate/test/fixtures/topics.yml b/vendor/plugins/will_paginate/test/fixtures/topics.yml
index 0a26904..b3fb98e 100644
--- a/vendor/plugins/will_paginate/test/fixtures/topics.yml
+++ b/vendor/plugins/will_paginate/test/fixtures/topics.yml
@@ -5,7 +5,7 @@ futurama:
content: I like futurama
created_at: <%= 1.day.ago.to_s(:db) %>
updated_at:
-
+
harvey_birdman:
id: 2
title: Harvey Birdman is the king of all men
diff --git a/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb b/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb
index 35fde8e..70a8f22 100644
--- a/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb
+++ b/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb
@@ -28,14 +28,14 @@ def self.setup
def self.setup_connection
db = ENV['DB'].blank?? 'sqlite3' : ENV['DB']
-
+
configurations = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'database.yml'))
raise "no configuration for '#{db}'" unless configurations.key? db
configuration = configurations[db]
-
+
ActiveRecord::Base.logger = Logger.new(STDOUT) if $0 == 'irb'
puts "using #{configuration['adapter']} adapter" unless ENV['DB'].blank?
-
+
ActiveRecord::Base.establish_connection(configuration)
ActiveRecord::Base.configurations = { db => configuration }
ActiveRecord::Base.connection
diff --git a/vendor/plugins/will_paginate/test/lib/html_inner_text.rb b/vendor/plugins/will_paginate/test/lib/html_inner_text.rb
index 7bb6246..3babb3a 100644
--- a/vendor/plugins/will_paginate/test/lib/html_inner_text.rb
+++ b/vendor/plugins/will_paginate/test/lib/html_inner_text.rb
@@ -6,7 +6,7 @@ def inner_text
children.map(&:inner_text).join('')
end
end
-
+
class Text
def inner_text
self.to_s
diff --git a/vendor/plugins/will_paginate/test/pagination_test.rb b/vendor/plugins/will_paginate/test/pagination_test.rb
index f116391..b44a99b 100644
--- a/vendor/plugins/will_paginate/test/pagination_test.rb
+++ b/vendor/plugins/will_paginate/test/pagination_test.rb
@@ -12,11 +12,11 @@
WillPaginate.enable_actionpack
class PaginationTest < Test::Unit::TestCase
-
+
class DevelopersController < ActionController::Base
def list_developers
@options = session[:wp] || {}
-
+
@developers = (1..11).to_a.paginate(
:page => params[@options[:param_name] || :page] || 1,
:per_page => params[:per_page] || 4
@@ -35,7 +35,7 @@ def guess_collection_name
def rescue_errors(e) raise e end
def rescue_action(e) raise e end
end
-
+
def setup
@controller = DevelopersController.new
@request = ActionController::TestRequest.new
@@ -67,7 +67,7 @@ def test_will_paginate_with_options
:class => 'will_paginate', :prev_label => 'Prev', :next_label => 'Next'
}
assert_response :success
-
+
entries = assigns :developers
assert entries
assert_equal 4, entries.size
@@ -102,36 +102,36 @@ def test_will_paginate_without_page_links
validate_page_numbers [1,3], elements
end
end
-
+
def test_will_paginate_preserves_parameters_on_get
get :list_developers, :foo => { :bar => 'baz' }
assert_links_match /foo%5Bbar%5D=baz/
end
-
+
def test_will_paginate_doesnt_preserve_parameters_on_post
post :list_developers, :foo => 'bar'
assert_no_links_match /foo=bar/
end
-
+
def test_adding_additional_parameters
get :list_developers, {}, :wp => { :params => { :foo => 'bar' } }
assert_links_match /foo=bar/
end
-
+
def test_removing_arbitrary_parameters
get :list_developers, { :foo => 'bar' }, :wp => { :params => { :foo => nil } }
assert_no_links_match /foo=bar/
end
-
+
def test_adding_additional_route_parameters
get :list_developers, {}, :wp => { :params => { :controller => 'baz' } }
assert_links_match %r{\Wbaz/list_developers\W}
end
-
+
def test_will_paginate_with_custom_page_param
get :list_developers, { :developers_page => 2 }, :wp => { :param_name => :developers_page }
assert_response :success
-
+
entries = assigns :developers
assert entries
assert_equal 4, entries.size
@@ -141,13 +141,13 @@ def test_will_paginate_with_custom_page_param
validate_page_numbers [1,1,3,3], elements, :developers_page
end
assert_select 'span.current', entries.current_page.to_s
- end
+ end
end
def test_will_paginate_windows
get :list_developers, { :page => 6, :per_page => 1 }, :wp => { :inner_window => 1 }
assert_response :success
-
+
entries = assigns :developers
assert entries
assert_equal 1, entries.size
@@ -166,7 +166,7 @@ def test_will_paginate_windows
def test_will_paginate_eliminates_small_gaps
get :list_developers, { :page => 6, :per_page => 1 }, :wp => { :inner_window => 2 }
assert_response :success
-
+
assert_select 'div.pagination', 1, 'no main DIV' do
assert_select 'a[href]', 12 do |elements|
validate_page_numbers [5,1,2,3,4,5,7,8,9,10,11,7], elements
@@ -182,7 +182,7 @@ def test_no_pagination
assert_equal '', @response.body
end
-
+
def test_faulty_input_raises_error
assert_raise WillPaginate::InvalidPage do
get :list_developers, :page => 'foo'
@@ -196,7 +196,7 @@ def test_collection_name_can_be_guessed
get :guess_collection_name, {}, :wp => collection
end
end
-
+
def test_inferred_collection_name_raises_error_when_nil
ex = assert_raise ArgumentError do
get :guess_collection_name, {}, :wp => nil
@@ -227,12 +227,12 @@ def test_rescue_response_hook_presence
DevelopersController.rescue_responses['WillPaginate::InvalidPage']
end
end
-
+
protected
def validate_page_numbers expected, links, param_name = :page
param_pattern = /\W#{param_name}=([^&]*)/
-
+
assert_equal(expected, links.map { |e|
e['href'] =~ param_pattern
$1 ? $1.to_i : $1
@@ -264,7 +264,7 @@ def test_page_entries_info
collection = arr.paginate :page => 2, :per_page => 5
assert_equal %{Displaying entries 6 - 10 of 26 in total},
page_entries_info(collection)
-
+
collection = arr.paginate :page => 7, :per_page => 4
assert_equal %{Displaying entries 25 - 26 of 26 in total},
page_entries_info(collection)
diff --git a/vendor/rails/actionmailer/CHANGELOG b/vendor/rails/actionmailer/CHANGELOG
index 8ba3ccd..2c60d27 100644
--- a/vendor/rails/actionmailer/CHANGELOG
+++ b/vendor/rails/actionmailer/CHANGELOG
@@ -83,7 +83,7 @@
* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
-* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
+* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
@@ -229,7 +229,7 @@
* Added that deliver_* will now return the email that was sent
-* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
+* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
* Fixed quoting for all address headers, not just to #955 [Jamis Buck]
@@ -268,7 +268,7 @@
@body = "Nothing to see here."
@charset = "iso-8859-1"
end
-
+
def unencoded_subject(recipient)
@recipients = recipient
@subject = "testing unencoded subject"
@@ -277,7 +277,7 @@
@encode_subject = false
@charset = "iso-8859-1"
end
-
+
*0.6.1* (January 18th, 2005)
diff --git a/vendor/rails/actionmailer/README b/vendor/rails/actionmailer/README
index 67e8266..d3e54ec 100644
--- a/vendor/rails/actionmailer/README
+++ b/vendor/rails/actionmailer/README
@@ -24,14 +24,14 @@ are all set up this way. An example of such a method:
end
The body of the email is created by using an Action View template (regular
-ERb) that has the content of the body hash parameter available as instance variables.
+ERb) that has the content of the body hash parameter available as instance variables.
So the corresponding body template for the method above could look like this:
- Hello there,
+ Hello there,
Mr. <%= @recipient %>
-
-And if the recipient was given as "david@loudthinking.com", the email
+
+And if the recipient was given as "david@loudthinking.com", the email
generated would look like this:
Date: Sun, 12 Dec 2004 00:00:00 +0100
@@ -39,7 +39,7 @@ generated would look like this:
To: david@loudthinking.com
Subject: [Signed up] Welcome david@loudthinking.com
- Hello there,
+ Hello there,
Mr. david@loudthinking.com
@@ -55,7 +55,7 @@ ApplicationMailer, it would look like this:
== Receiving emails
To receive emails, you need to implement a public instance method called receive that takes a
-tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
+tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns
into the tmail object and calls the receive instance method.
@@ -70,7 +70,7 @@ Example:
if email.has_attachments?
for attachment in email.attachments
- page.attachments.create({
+ page.attachments.create({
:file => attachment, :description => email.subject
})
end
@@ -115,7 +115,7 @@ The latest version of Action Mailer can be found at
* http://rubyforge.org/project/showfiles.php?group_id=361
-Documentation can be found at
+Documentation can be found at
* http://actionmailer.rubyonrails.org
diff --git a/vendor/rails/actionmailer/Rakefile b/vendor/rails/actionmailer/Rakefile
index 4622871..41e5fff 100644
--- a/vendor/rails/actionmailer/Rakefile
+++ b/vendor/rails/actionmailer/Rakefile
@@ -66,7 +66,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
-
+
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
@@ -75,12 +75,12 @@ end
desc "Publish the API documentation"
-task :pgem => [:package] do
+task :pgem => [:package] do
Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
end
desc "Publish the API documentation"
-task :pdoc => [:rdoc] do
+task :pdoc => [:rdoc] do
Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/am", "doc").upload
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/base.rb b/vendor/rails/actionmailer/lib/action_mailer/base.rb
index b15c010..8c375d5 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/base.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/base.rb
@@ -11,11 +11,11 @@ module ActionMailer #:nodoc:
# = Mailer Models
#
# To use ActionMailer, you need to create a mailer model.
- #
+ #
# $ script/generate mailer Notifier
#
- # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
- # used to set variables to be used in the mail template, to change options on the mail, or
+ # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
+ # used to set variables to be used in the mail template, to change options on the mail, or
# to add attachments.
#
# Examples:
@@ -44,7 +44,7 @@ module ActionMailer #:nodoc:
# named after each key in the hash containing the value that that key points to.
#
# So, for example, body "account" => recipient would result
- # in an instance variable @account with the value of recipient being accessible in the
+ # in an instance variable @account with the value of recipient being accessible in the
# view.
#
#
@@ -53,7 +53,7 @@ module ActionMailer #:nodoc:
# Like ActionController, each mailer class has a corresponding view directory
# in which each method of the class looks for a template with its name.
# To define a template to be used with a mailing, create an .erb file with the same name as the method
- # in your mailer model. For example, in the mailer defined above, the template at
+ # in your mailer model. For example, in the mailer defined above, the template at
# app/views/notifier/signup_notification.erb would be used to generate the email.
#
# Variables defined in the model are accessible as instance variables in the view.
@@ -67,7 +67,7 @@ module ActionMailer #:nodoc:
#
# You got a new note!
# <%= truncate(note.body, 25) %>
- #
+ #
#
# = Generating URLs for mailer views
#
@@ -87,13 +87,13 @@ module ActionMailer #:nodoc:
#
# = Sending mail
#
- # Once a mailer action and template are defined, you can deliver your message or create it and save it
+ # Once a mailer action and template are defined, you can deliver your message or create it and save it
# for delivery later:
#
# Notifier.deliver_signup_notification(david) # sends the email
# mail = Notifier.create_signup_notification(david) # => a tmail object
# Notifier.deliver(mail)
- #
+ #
# You never instantiate your mailer class. Rather, your delivery instance
# methods are automatically wrapped in class methods that start with the word
# deliver_ followed by the name of the mailer method that you would
@@ -114,7 +114,7 @@ module ActionMailer #:nodoc:
# from "system@example.com"
# content_type "text/html" # Here's where the magic happens
# end
- # end
+ # end
#
#
# = Multipart email
@@ -136,17 +136,17 @@ module ActionMailer #:nodoc:
# end
# end
# end
- #
+ #
# Multipart messages can also be used implicitly because ActionMailer will automatically
# detect and use multipart templates, where each template is named after the name of the action, followed
# by the content type. Each such detected template will be added as separate part to the message.
- #
+ #
# For example, if the following templates existed:
# * signup_notification.text.plain.erb
# * signup_notification.text.html.erb
# * signup_notification.text.xml.builder
# * signup_notification.text.x-yaml.erb
- #
+ #
# Each would be rendered and added as a separate part to the message,
# with the corresponding content type. The same body hash is passed to
# each template.
@@ -172,7 +172,7 @@ module ActionMailer #:nodoc:
# a.body = generate_your_pdf_here()
# end
# end
- # end
+ # end
#
#
# = Configuration options
@@ -190,7 +190,7 @@ module ActionMailer #:nodoc:
# * :domain If you need to specify a HELO domain, you can do it here.
# * :user_name If your mail server requires authentication, set the username in this setting.
# * :password If your mail server requires authentication, set the password in this setting.
- # * :authentication If your mail server requires authentication, you need to specify the authentication type here.
+ # * :authentication If your mail server requires authentication, you need to specify the authentication type here.
# This is a symbol and one of :plain, :login, :cram_md5
#
# * sendmail_settings - Allows you to override options for the :sendmail delivery method
@@ -206,10 +206,10 @@ module ActionMailer #:nodoc:
# * deliveries - Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful
# for unit and functional testing.
#
- # * default_charset - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
+ # * default_charset - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
# pick a different charset from inside a method with @charset.
# * default_content_type - The default content type used for the main part of the message. Defaults to "text/plain". You
- # can also pick a different content type from inside a method with @content_type.
+ # can also pick a different content type from inside a method with @content_type.
# * default_mime_version - The default mime version used for the message. Defaults to "1.0". You
# can also pick a different value from inside a method with @mime_version.
# * default_implicit_parts_order - When a message is built implicitly (i.e. multiple parts are assembled from templates
@@ -229,16 +229,16 @@ class Base
cattr_accessor :template_extensions
@@template_extensions = ['erb', 'builder', 'rhtml', 'rxml']
- @@smtp_settings = {
- :address => "localhost",
- :port => 25,
- :domain => 'localhost.localdomain',
- :user_name => nil,
- :password => nil,
+ @@smtp_settings = {
+ :address => "localhost",
+ :port => 25,
+ :domain => 'localhost.localdomain',
+ :user_name => nil,
+ :password => nil,
:authentication => nil
}
cattr_accessor :smtp_settings
-
+
@@sendmail_settings = {
:location => '/usr/sbin/sendmail',
:arguments => '-i -t'
@@ -250,10 +250,10 @@ class Base
superclass_delegating_accessor :delivery_method
self.delivery_method = :smtp
-
+
@@perform_deliveries = true
cattr_accessor :perform_deliveries
-
+
@@deliveries = []
cattr_accessor :deliveries
@@ -262,7 +262,7 @@ class Base
@@default_content_type = "text/plain"
cattr_accessor :default_content_type
-
+
@@default_mime_version = "1.0"
cattr_accessor :default_mime_version
@@ -271,47 +271,47 @@ class Base
# Specify the BCC addresses for the message
adv_attr_accessor :bcc
-
+
# Define the body of the message. This is either a Hash (in which case it
# specifies the variables to pass to the template when it is rendered),
# or a string, in which case it specifies the actual text of the message.
adv_attr_accessor :body
-
+
# Specify the CC addresses for the message.
adv_attr_accessor :cc
-
+
# Specify the charset to use for the message. This defaults to the
# +default_charset+ specified for ActionMailer::Base.
adv_attr_accessor :charset
-
+
# Specify the content type for the message. This defaults to text/plain
# in most cases, but can be automatically set in some situations.
adv_attr_accessor :content_type
-
+
# Specify the from address for the message.
adv_attr_accessor :from
-
+
# Specify additional headers to be added to the message.
adv_attr_accessor :headers
-
+
# Specify the order in which parts should be sorted, based on content-type.
# This defaults to the value for the +default_implicit_parts_order+.
adv_attr_accessor :implicit_parts_order
-
+
# Defaults to "1.0", but may be explicitly given if needed.
adv_attr_accessor :mime_version
-
+
# The recipient addresses for the message, either as a string (for a single
# address) or an array (for multiple addresses).
adv_attr_accessor :recipients
-
+
# The date on which the message was sent. If not set (the default), the
# header will be set by the delivery agent.
adv_attr_accessor :sent_on
-
+
# Specify the subject of the message.
adv_attr_accessor :subject
-
+
# Specify the template name to use for current message. This is the "base"
# template name, without the extension or directory, and may be used to
# have multiple mailer methods share the same template.
@@ -327,7 +327,7 @@ def mailer_name(value = nil)
self.class.mailer_name
end
end
-
+
def mailer_name=(value)
self.class.mailer_name = value
end
@@ -400,7 +400,7 @@ def register_template_extension(extension)
# remain uninitialized (useful when you only need to invoke the "receive"
# method, for instance).
def initialize(method_name=nil, *parameters) #:nodoc:
- create!(method_name, *parameters) if method_name
+ create!(method_name, *parameters) if method_name
end
# Initialize the mailer via the given +method_name+. The body will be
@@ -569,7 +569,7 @@ def create_mail
part = (TMail::Mail === p ? p : p.to_mail(self))
m.parts << part
end
-
+
if real_content_type =~ /multipart/
ctype_attrs.delete "charset"
m.set_content_type(real_content_type, nil, ctype_attrs)
@@ -583,7 +583,7 @@ def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
- Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
+ Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
smtp.sendmail(mail.encoded, mail.from, destinations)
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/helpers.rb b/vendor/rails/actionmailer/lib/action_mailer/helpers.rb
index 7777d16..2270872 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/helpers.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/helpers.rb
@@ -22,7 +22,7 @@ class << self
module ClassMethods
# Makes all the (instance) methods in the helper module available to templates rendered through this controller.
- # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
+ # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
# available to the templates.
def add_template_helper(helper_module) #:nodoc:
master_helper_module.module_eval "include #{helper_module}"
@@ -45,7 +45,7 @@ def helper(*args, &block)
when String, Symbol
file_name = arg.to_s.underscore + '_helper'
class_name = file_name.camelize
-
+
begin
require_dependency(file_name)
rescue LoadError => load_error
@@ -87,7 +87,7 @@ def helper_attr(*attrs)
attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
end
- private
+ private
def inherited_with_helper(child)
inherited_without_helper(child)
begin
@@ -97,7 +97,7 @@ def inherited_with_helper(child)
rescue MissingSourceFile => e
raise unless e.is_missing?("helpers/#{child.name.underscore}_helper")
end
- end
+ end
end
private
diff --git a/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb b/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
index 11fd7d7..ab1cb7d 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
@@ -4,12 +4,12 @@ module MailHelper
# Uses Text::Format to take the text and format it, indented two spaces for
# each line, and wrapped at 72 columns.
def block_format(text)
- formatted = text.split(/\n\r\n/).collect { |paragraph|
+ formatted = text.split(/\n\r\n/).collect { |paragraph|
Text::Format.new(
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
).format
}.join("\n")
-
+
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
diff --git a/vendor/rails/actionmailer/lib/action_mailer/part.rb b/vendor/rails/actionmailer/lib/action_mailer/part.rb
index de1b168..cc27ce0 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/part.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/part.rb
@@ -16,24 +16,24 @@ class Part
# into the body of a subpart you can do it with the mailer's #render method
# and assign the result here.
adv_attr_accessor :body
-
+
# Specify the charset for this subpart. By default, it will be the charset
# of the containing part or mailer.
adv_attr_accessor :charset
-
+
# The content disposition of this part, typically either "inline" or
# "attachment".
adv_attr_accessor :content_disposition
-
+
# The content type of the part.
adv_attr_accessor :content_type
-
+
# The filename to use for this subpart (usually for attachments).
adv_attr_accessor :filename
-
+
# Accessor for specifying additional headers to include with this part.
adv_attr_accessor :headers
-
+
# The transfer encoding to use for this subpart, like "base64" or
# "quoted-printable".
adv_attr_accessor :transfer_encoding
@@ -80,19 +80,19 @@ def to_mail(defaults)
squish("filename" => filename).merge(ctype_attrs))
else
part.set_content_type(real_content_type, nil, ctype_attrs)
- part.set_content_disposition(content_disposition)
- end
+ part.set_content_disposition(content_disposition)
+ end
else
if String === body
@parts.unshift Part.new(:charset => charset, :body => @body, :content_type => 'text/plain')
@body = nil
end
-
+
@parts.each do |p|
prt = (TMail::Mail === p ? p : p.to_mail(defaults))
part.parts << prt
end
-
+
part.set_content_type(real_content_type, nil, ctype_attrs) if real_content_type =~ /multipart/
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/part_container.rb b/vendor/rails/actionmailer/lib/action_mailer/part_container.rb
index 3e3d6b9..a575193 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/part_container.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/part_container.rb
@@ -39,7 +39,7 @@ def attachment(params, &block)
end
private
-
+
def parse_content_type(defaults=nil)
return [defaults && defaults.content_type, {}] if content_type.blank?
ctype, *attrs = content_type.split(/;\s*/)
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/address.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/address.rb
index 224ed70..248394f 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/address.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/address.rb
@@ -157,7 +157,7 @@ def initialize( name, addrs )
end
attr_reader :name
-
+
def ==( other )
other.respond_to? :to_a and @addresses == other.to_a
end
@@ -215,7 +215,7 @@ def add( a )
end
alias push add
-
+
def delete( a )
@addresses.delete a
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/attachments.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/attachments.rb
index a8b8017..da15279 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/attachments.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/attachments.rb
@@ -23,7 +23,7 @@ def attachment?(part)
def attachments
if multipart?
- parts.collect { |part|
+ parts.collect { |part|
if part.multipart?
part.attachments
elsif attachment?(part)
@@ -32,16 +32,16 @@ def attachments
part['content-location'].body) ||
part.sub_header("content-type", "name") ||
part.sub_header("content-disposition", "filename")
-
+
next if file_name.blank? || content.blank?
-
+
attachment = Attachment.new(content)
attachment.original_filename = file_name.strip
attachment.content_type = part.content_type
attachment
end
}.flatten.compact
- end
+ end
end
end
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/config.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/config.rb
index 4b253d2..4aa8467 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/config.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/config.rb
@@ -56,7 +56,7 @@ def new_body_port( mail )
alias new_preamble_port new_body_port
alias new_part_port new_body_port
-
+
end
DEFAULT_CONFIG = Config.new(false)
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb
index cc24e97..74644a9 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb
@@ -6,7 +6,7 @@
=end
unless Object.respond_to?(:blank?) #:nodoc:
- # Check first to see if we are in a Rails environment, no need to
+ # Check first to see if we are in a Rails environment, no need to
# define these methods if we are
class Object
# An object is blank if it's nil, empty, or a whitespace string.
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/encode.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/encode.rb
index 0721a25..7fca114 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/encode.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/encode.rb
@@ -52,25 +52,25 @@ def create_dest( obj )
end
end
module_function :create_dest
-
+
def encoded( eol = "\r\n", charset = 'j', dest = nil )
accept_strategy Encoder, eol, charset, dest
end
-
+
def decoded( eol = "\n", charset = 'e', dest = nil )
# Turn the E-Mail into a string and return it with all
# encoded characters decoded. alias for to_s
accept_strategy Decoder, eol, charset, dest
end
-
+
alias to_s decoded
-
+
def accept_strategy( klass, eol, charset, dest = nil )
dest ||= ''
accept klass.new( create_dest(dest), charset, eol )
dest
end
-
+
end
@@ -121,7 +121,7 @@ def header_name( nm )
def header_body( str )
@f << decode(str)
end
-
+
def space
@f << ' '
end
@@ -131,7 +131,7 @@ def space
def lwsp( str )
@f << str
end
-
+
def meta( str )
@f << str
end
@@ -202,7 +202,7 @@ def initialize( dest = nil, encoding = nil, eol = "\r\n", limit = nil )
def preserve_quotes=( bool )
@preserve_quotes
end
-
+
def preserve_quotes
@preserve_quotes
end
@@ -378,7 +378,7 @@ def concat_A_S( types, strs )
i += 1
end
end
-
+
METHOD_ID = {
?j => :extract_J,
?e => :extract_E,
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/facade.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/facade.rb
index 1ecd64b..2b316ad 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/facade.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/facade.rb
@@ -399,7 +399,7 @@ def set_content_type( str, sub = nil, param = nil )
end
alias content_type= set_content_type
-
+
def type_param( name, default = nil )
if h = @header['content-type']
h[name] || default
@@ -470,7 +470,7 @@ def set_disposition( str, params = nil )
alias disposition= set_disposition
alias set_content_disposition set_disposition
alias content_disposition= set_disposition
-
+
def disposition_param( name, default = nil )
if h = @header['content-disposition']
h[name] || default
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/header.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/header.rb
index 41c371f..5fd6d2d 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/header.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/header.rb
@@ -4,7 +4,7 @@
=end
# RFC #822 ftp://ftp.isi.edu/in-notes/rfc822.txt
-#
+#
#
#--
# Copyright (c) 1998-2003 Minero Aoki
@@ -81,7 +81,7 @@ def initialize( body, conf, intern = false )
@illegal = false
@parsed = false
-
+
if intern
@parsed = true
parse_init
@@ -887,7 +887,7 @@ def do_accept( strategy )
strategy.kv_pair k, unquote(v)
end
end
-
+
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/interface.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/interface.rb
index 957e899..db90cee 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/interface.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/interface.rb
@@ -393,7 +393,7 @@ def set_content_type( str, sub = nil, param = nil )
end
alias content_type= set_content_type
-
+
def type_param( name, default = nil )
if h = @header['content-type']
h[name] || default
@@ -462,7 +462,7 @@ def set_disposition( str, params = nil )
alias disposition= set_disposition
alias set_content_disposition set_disposition
alias content_disposition= set_disposition
-
+
def disposition_param( name, default = nil )
if h = @header['content-disposition']
h[name] || default
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mail.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mail.rb
index d10275b..9f9115c 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mail.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mail.rb
@@ -307,7 +307,7 @@ def parse_header( f )
unixfrom = $1
when /^charset=.*/
-
+
else
raise SyntaxError, "wrong mail header: '#{line.inspect}'"
end
@@ -358,12 +358,12 @@ def quoted_body
def body=( str )
# Sets the body of the email to a new (encoded) string.
- #
+ #
# We also reparses the email if the body is ever reassigned, this is a performance hit, however when
# you assign the body, you usually want to be able to make sure that you can access the attachments etc.
- #
+ #
# Usage:
- #
+ #
# mail.body = "Hello, this is\nthe body text"
# # => "Hello, this is\nthe body"
# mail.body
@@ -393,7 +393,7 @@ def parts
parse_body
@parts
end
-
+
def each_part( &block )
parts().each(&block)
end
@@ -429,7 +429,7 @@ def parse_body_0( f )
}
end
end
-
+
def read_multipart( src )
bound = @header['content-type'].params['boundary']
is_sep = /\A--#{Regexp.quote bound}(?:--)?[ \t]*(?:\n|\r\n|\r)/
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb
index bb7a460..a17ca14 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb
@@ -149,7 +149,7 @@ def next_file_name
class UNIXMbox
-
+
def UNIXMbox.lock( fname )
begin
f = File.open(fname)
@@ -371,7 +371,7 @@ def new_port
begin
fname = "#{Time.now.to_i}.#{$$}_#{Maildir.unique_number}.#{Socket.gethostname}"
-
+
tmpfname = "#{@tmp}/#{fname}"
newfname = "#{@new}/#{fname}"
end while FileTest.exist? tmpfname
@@ -400,7 +400,7 @@ def each_new_port
def check_tmp
old = Time.now.to_i - TOO_OLD
-
+
each_filename(@tmp) do |full, fname|
if FileTest.file? full and
File.stat(full).mtime.to_i < old
@@ -427,7 +427,7 @@ def each_filename( dir )
end
end
end
-
+
end # Maildir
MaildirLoader = Maildir
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/net.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/net.rb
index 50b1dd9..f5374bb 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/net.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/net.rb
@@ -163,7 +163,7 @@ def setup_forward( mail )
m.encoding = encoding('7bit')
mail.parts.push m
end
-
+
end
@@ -188,7 +188,7 @@ def exec( mail )
end
delete_if {|n,v| v.empty? } if @delete_empty_fields
end
-
+
end
@@ -203,7 +203,7 @@ def initialize( fqdn = nil )
def exec( mail )
mail.message_id = ::TMail::new_msgid(@fqdn)
end
-
+
end
@@ -212,7 +212,7 @@ class AddDate
def exec( mail )
mail.date = Time.now
end
-
+
end
@@ -231,10 +231,10 @@ def exec( mail )
then @multipart_composer
else @singlepart_composer end.exec mail
end
-
+
end
-
+
class MimeEncodeSingle
def exec( mail )
@@ -258,7 +258,7 @@ def on_binary( body )
mail.set_content_type 'application', 'octet-stream'
mail.encoding = 'Base64'
end
-
+
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.rb
index 5deb0ff..77803a1 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.rb
@@ -401,7 +401,7 @@ def racc_reduce(toks, sim, tstack, vstack)
toks.each {|t| out.print ' ', racc_token2str(t) }
end
out.puts " --> #{racc_token2str(sim)}"
-
+
racc_print_stacks tstack, vstack
@racc_debug_out.puts
end
@@ -513,7 +513,7 @@ def parse_in( &block )
yield @first
@scanner.scan(&block)
end
-
+
def on_error( t, val, vstack )
raise SyntaxError, "parse error on token #{racc_token2str t}"
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.y b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.y
index 77a1457..36148e4 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.y
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.y
@@ -26,7 +26,7 @@ rule
| CDISPOSITION cdisp { val[1] }
| ADDRESS addr_TOP { val[1] }
| MAILBOX mbox { val[1] }
-
+
datetime : day DIGIT ATOM DIGIT hour zone
# 0 1 2 3 4 5
# date month year
@@ -34,10 +34,10 @@ rule
t = Time.gm(val[3].to_i, val[2], val[1].to_i, 0, 0, 0)
(t + val[4] - val[5]).localtime
}
-
+
day : /* none */
| ATOM ','
-
+
hour : DIGIT ':' DIGIT
{
(val[0].to_i * 60 * 60) +
@@ -49,29 +49,29 @@ rule
(val[2].to_i * 60) +
(val[4].to_i)
}
-
+
zone : ATOM
{
timezone_string_to_unixtime(val[0])
}
-
+
received : from by via with id for received_datetime
{
val
}
-
+
from : /* none */
| FROM received_domain
{
val[1]
}
-
+
by : /* none */
| BY received_domain
{
val[1]
}
-
+
received_domain
: domain
{
@@ -85,13 +85,13 @@ rule
{
join_domain(val[0])
}
-
+
via : /* none */
| VIA ATOM
{
val[1]
}
-
+
with : /* none */
{
[]
@@ -101,7 +101,7 @@ rule
val[0].push val[2]
val[0]
}
-
+
id : /* none */
| ID msgid
{
@@ -111,7 +111,7 @@ rule
{
val[1]
}
-
+
for : /* none */
| FOR received_addrspec
{
@@ -127,14 +127,14 @@ rule
{
val[0].spec
}
-
+
received_datetime
: /* none */
| ';' datetime
{
val[1]
}
-
+
addrs_TOP : addrs
| group_bare
| addrs commas group_bare
@@ -184,7 +184,7 @@ rule
AddressGroup.new(val[0], val[2])
}
| addr_phrase ':' { AddressGroup.new(val[0], []) }
-
+
addr_phrase
: local_head { val[0].join('.') }
| addr_phrase local_head { val[0] << ' ' << val[1].join('.') }
@@ -198,15 +198,15 @@ rule
{
val[1]
}
-
+
routes : at_domains ':'
-
+
at_domains: '@' domain { [ val[1].join('.') ] }
| at_domains ',' '@' domain { val[0].push val[3].join('.'); val[0] }
-
+
spec : local '@' domain { Address.new( val[0], val[2] ) }
| local { Address.new( val[0], nil ) }
-
+
local: local_head
| local_head '.' { val[0].push ''; val[0] }
@@ -220,7 +220,7 @@ rule
val[0].push val[2]
val[0]
}
-
+
domain : domword
{ val }
| domain dots domword
@@ -254,10 +254,10 @@ rule
keys : phrase { val }
| keys ',' phrase { val[0].push val[2]; val[0] }
-
+
phrase : word
| phrase word { val[0] << ' ' << val[1] }
-
+
enc : word
{
val.push nil
@@ -281,7 +281,7 @@ rule
{
[ val[0].downcase, nil, decode_params(val[1]) ]
}
-
+
params : /* none */
{
{}
@@ -306,11 +306,11 @@ rule
{
[ val[0].downcase, decode_params(val[1]) ]
}
-
+
opt_semicolon
:
| ';'
-
+
atom : ATOM
| FROM
| BY
@@ -318,7 +318,7 @@ rule
| WITH
| ID
| FOR
-
+
end
@@ -374,7 +374,7 @@ require 'tmail/utils'
yield @first
@scanner.scan(&block)
end
-
+
def on_error( t, val, vstack )
raise SyntaxError, "parse error on token #{racc_token2str t}"
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/port.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/port.rb
index 445f0e6..a676cfa 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/port.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/port.rb
@@ -184,7 +184,7 @@ def procinfostr( str, tag, true_p )
a.delete tag unless true_p
a.compact.sort.join('').squeeze
end
-
+
end
@@ -193,7 +193,7 @@ class MhPort < FilePort
include MailFlags
private
-
+
def set_status( tag, flag )
begin
tmpfile = @filename + '.tmailtmp.' + $$.to_s
@@ -239,7 +239,7 @@ def get_status( tag )
}
false
end
-
+
end
@@ -288,7 +288,7 @@ def get_status( tag )
m = MAIL_FILE.match(File.basename(@filename)) or return false
m[2] == '2' and m[3].to_s.include?(tag[0])
end
-
+
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/quoting.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/quoting.rb
index 0b2d11c..24543d4 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/quoting.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/quoting.rb
@@ -13,12 +13,12 @@ def unquoted_body(to_charset = 'utf-8')
from_charset = sub_header("content-type", "charset")
case (content_transfer_encoding || "7bit").downcase
when "quoted-printable"
- # the default charset is set to iso-8859-1 instead of 'us-ascii'.
+ # the default charset is set to iso-8859-1 instead of 'us-ascii'.
# This is needed as many mailer do not set the charset but send in ISO. This is only used if no charset is set.
if !from_charset.blank? && from_charset.downcase == 'us-ascii'
from_charset = 'iso-8859-1'
end
-
+
Unquoter.unquote_quoted_printable_and_convert_to(quoted_body,
to_charset, from_charset, true)
when "base64"
@@ -35,9 +35,9 @@ def unquoted_body(to_charset = 'utf-8')
def body(to_charset = 'utf-8', &block)
attachment_presenter = block || Proc.new { |file_name| "Attachment: #{file_name}\n" }
-
+
if multipart?
- parts.collect { |part|
+ parts.collect { |part|
header = part["content-type"]
if part.multipart?
@@ -81,13 +81,13 @@ def unquote_and_convert_to(text, to_charset, from_charset = "iso-8859-1", preser
end
end
end
-
+
def unquote_quoted_printable_and_convert_to(text, to, from, preserve_underscores=false)
text = text.gsub(/_/, " ") unless preserve_underscores
text = text.gsub(/\r\n|\r/, "\n") # normalize newlines
convert_to(text.unpack("M*").first, to, from)
end
-
+
def unquote_base64_and_convert_to(text, to, from)
convert_to(Base64.decode(text), to, from)
end
@@ -122,7 +122,7 @@ def convert_to(text, to, from)
class TC_Unquoter < Test::Unit::TestCase
def test_unquote_quoted_printable
- a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
+ a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
end
@@ -134,7 +134,7 @@ def test_unquote_base64
end
def test_unquote_without_charset
- a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
+ a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
assert_equal "[166417]_Bekr=E6ftelse_fra_Rejsefeber", b
end
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/stringio.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/stringio.rb
index 3817850..cb6786d 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/stringio.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/stringio.rb
@@ -49,7 +49,7 @@ def new( str )
end
alias open new
-
+
end
def initialize( str )
@@ -190,7 +190,7 @@ def new( str = '' )
end
alias open new
-
+
end
def initialize( str = '' )
diff --git a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/utils.rb b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/utils.rb
index 016330f..018ff04 100644
--- a/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/utils.rb
+++ b/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/utils.rb
@@ -56,7 +56,7 @@ def TMail.random_tag
module TextUtils
# Defines characters per RFC that are OK for TOKENs, ATOMs, PHRASEs and CONTROL characters.
-
+
aspecial = '()<>[]:;.\\,"'
tspecial = '()<>[];:\\,"/?='
lwsp = " \t\r\n"
@@ -73,13 +73,13 @@ def atom_safe?( str )
end
def quote_atom( str )
- # If the string supplied has ATOM unsafe characters in it, will return the string quoted
+ # If the string supplied has ATOM unsafe characters in it, will return the string quoted
# in double quotes, otherwise returns the string unmodified
(ATOM_UNSAFE === str) ? dquote(str) : str
end
def quote_phrase( str )
- # If the string supplied has PHRASE unsafe characters in it, will return the string quoted
+ # If the string supplied has PHRASE unsafe characters in it, will return the string quoted
# in double quotes, otherwise returns the string unmodified
(PHRASE_UNSAFE === str) ? dquote(str) : str
end
@@ -90,7 +90,7 @@ def token_safe?( str )
end
def quote_token( str )
- # If the string supplied has TOKEN unsafe characters in it, will return the string quoted
+ # If the string supplied has TOKEN unsafe characters in it, will return the string quoted
# in double quotes, otherwise returns the string unmodified
(TOKEN_UNSAFE === str) ? dquote(str) : str
end
@@ -111,7 +111,7 @@ def unquote( str )
# Returns unquoted string
str =~ /^"(.*?)"$/ ? $1 : str
end
-
+
def join_domain( arr )
arr.map {|i|
if /\A\[.*\]\z/ === i
@@ -212,7 +212,7 @@ def message_id?( str )
def mime_encoded?( str )
MIME_ENCODED === str
end
-
+
def decode_params( hash )
new = Hash.new
diff --git a/vendor/rails/actionmailer/test/delivery_method_test.rb b/vendor/rails/actionmailer/test/delivery_method_test.rb
index ebee235..a4bc11a 100644
--- a/vendor/rails/actionmailer/test/delivery_method_test.rb
+++ b/vendor/rails/actionmailer/test/delivery_method_test.rb
@@ -11,7 +11,7 @@ class ActionMailerBase_delivery_method_Test < Test::Unit::TestCase
def setup
set_delivery_method :smtp
end
-
+
def teardown
restore_delivery_method
end
@@ -25,11 +25,11 @@ class DefaultDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase
def setup
set_delivery_method :smtp
end
-
+
def teardown
restore_delivery_method
end
-
+
def test_should_be_the_default_smtp
assert_equal :smtp, DefaultDeliveryMethodMailer.delivery_method
end
@@ -39,7 +39,7 @@ class NonDefaultDeliveryMethodMailer_delivery_method_Test < Test::Unit::TestCase
def setup
set_delivery_method :smtp
end
-
+
def teardown
restore_delivery_method
end
diff --git a/vendor/rails/actionmailer/test/fixtures/raw_email2 b/vendor/rails/actionmailer/test/fixtures/raw_email2
index 3999fcc..9f87bb2 100644
--- a/vendor/rails/actionmailer/test/fixtures/raw_email2
+++ b/vendor/rails/actionmailer/test/fixtures/raw_email2
@@ -32,7 +32,7 @@ To: xxxxx xxxx
Subject: Fwd: Signed email causes file attachments
In-Reply-To:
Mime-Version: 1.0
-Content-Type: multipart/mixed;
+Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References:
diff --git a/vendor/rails/actionmailer/test/fixtures/raw_email3 b/vendor/rails/actionmailer/test/fixtures/raw_email3
index 771a963..3a09274 100644
--- a/vendor/rails/actionmailer/test/fixtures/raw_email3
+++ b/vendor/rails/actionmailer/test/fixtures/raw_email3
@@ -31,7 +31,7 @@ Reply-To: Test Tester
To: xxxx@xxxx.com, xxxx@xxxx.com
Subject: Another PDF
Mime-Version: 1.0
-Content-Type: multipart/mixed;
+Content-Type: multipart/mixed;
boundary="----=_Part_2192_32400445.1115745999735"
X-Virus-Scanned: amavisd-new at textdrive.com
diff --git a/vendor/rails/actionmailer/test/fixtures/raw_email8 b/vendor/rails/actionmailer/test/fixtures/raw_email8
index 2382dfd..7999636 100644
--- a/vendor/rails/actionmailer/test/fixtures/raw_email8
+++ b/vendor/rails/actionmailer/test/fixtures/raw_email8
@@ -8,7 +8,7 @@ To: xxxxx xxxx
Subject: Fwd: Signed email causes file attachments
In-Reply-To:
Mime-Version: 1.0
-Content-Type: multipart/mixed;
+Content-Type: multipart/mixed;
boundary="----=_Part_5028_7368284.1115579351471"
References:
diff --git a/vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb b/vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb
index a85d5fa..7afe1f6 100644
--- a/vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb
+++ b/vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb
@@ -1,3 +1,3 @@
-Hello there,
+Hello there,
Mr. <%= @recipient %>
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml b/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml
index 847d065..8dcf974 100644
--- a/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml
+++ b/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml
@@ -1,6 +1,6 @@
-%p Hello there,
+%p Hello there,
-%p
+%p
Mr.
= @recipient
from haml
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml b/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml
index 847d065..8dcf974 100644
--- a/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml
+++ b/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml
@@ -1,6 +1,6 @@
-%p Hello there,
+%p Hello there,
-%p
+%p
Mr.
= @recipient
from haml
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb b/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb
index a85d5fa..7afe1f6 100644
--- a/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb
+++ b/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb
@@ -1,3 +1,3 @@
-Hello there,
+Hello there,
Mr. <%= @recipient %>
\ No newline at end of file
diff --git a/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb b/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb
index 4c5806d..6e7875c 100644
--- a/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb
+++ b/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb
@@ -1,4 +1,4 @@
-Hello there,
+Hello there,
Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> <%= welcome_url %>
diff --git a/vendor/rails/actionmailer/test/mail_helper_test.rb b/vendor/rails/actionmailer/test/mail_helper_test.rb
index 70e5cb8..c09caca 100644
--- a/vendor/rails/actionmailer/test/mail_helper_test.rb
+++ b/vendor/rails/actionmailer/test/mail_helper_test.rb
@@ -27,7 +27,7 @@ def use_mail_helper(recipient)
recipients recipient
subject "using mailing helpers"
from "tester@example.com"
- self.body = { :text =>
+ self.body = { :text =>
"But soft! What light through yonder window breaks? It is the east, " +
"and Juliet is the sun. Arise, fair sun, and kill the envious moon, " +
"which is sick and pale with grief that thou, her maid, art far more " +
@@ -66,11 +66,11 @@ def setup
@recipient = 'test@localhost'
end
-
+
def teardown
restore_delivery_method
end
-
+
def test_use_helper
mail = HelperMailer.create_use_helper(@recipient)
assert_match %r{Mr. Joe Person}, mail.encoded
diff --git a/vendor/rails/actionmailer/test/mail_render_test.rb b/vendor/rails/actionmailer/test/mail_render_test.rb
index 475735e..c396351 100644
--- a/vendor/rails/actionmailer/test/mail_render_test.rb
+++ b/vendor/rails/actionmailer/test/mail_render_test.rb
@@ -20,13 +20,13 @@ def rxml_template(recipient)
subject "rendering rxml template"
from "tester@example.com"
end
-
+
def included_subtemplate(recipient)
recipients recipient
subject "Including another template in the one being rendered"
from "tester@example.com"
end
-
+
def included_old_subtemplate(recipient)
recipients recipient
subject "Including another template in the one being rendered"
@@ -83,12 +83,12 @@ def test_rxml_template
mail = RenderMailer.deliver_rxml_template(@recipient)
assert_equal "\n", mail.body.strip
end
-
+
def test_included_subtemplate
mail = RenderMailer.deliver_included_subtemplate(@recipient)
assert_equal "Hey Ho, let's go!", mail.body.strip
end
-
+
def test_deprecated_old_subtemplate
assert_raises ActionView::ActionViewError do
RenderMailer.deliver_included_old_subtemplate(@recipient)
diff --git a/vendor/rails/actionmailer/test/mail_service_test.rb b/vendor/rails/actionmailer/test/mail_service_test.rb
index eb408f9..ee91b03 100644
--- a/vendor/rails/actionmailer/test/mail_service_test.rb
+++ b/vendor/rails/actionmailer/test/mail_service_test.rb
@@ -209,7 +209,7 @@ def nested_multipart(recipient)
end
attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz"
end
-
+
def nested_multipart_with_body(recipient)
recipients recipient
subject "nested multipart with body"
@@ -311,7 +311,7 @@ def test_nested_parts
assert_nothing_raised { created = TestMailer.create_nested_multipart(@recipient)}
assert_equal 2,created.parts.size
assert_equal 2,created.parts.first.parts.size
-
+
assert_equal "multipart/mixed", created.content_type
assert_equal "multipart/alternative", created.parts.first.content_type
assert_equal "bar", created.parts.first.header['foo'].to_s
@@ -356,7 +356,7 @@ def test_signed_up
assert_not_nil ActionMailer::Base.deliveries.first
assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
-
+
def test_custom_template
expected = new_mail
expected.to = @recipient
@@ -380,18 +380,18 @@ def test_custom_templating_extension
expected.body = "Hello there, \n\nMr. #{@recipient}"
expected.from = "system@loudthinking.com"
expected.date = Time.local(2004, 12, 12)
-
+
# Stub the render method so no alternative renderers need be present.
ActionView::Base.any_instance.stubs(:render).returns("Hello there, \n\nMr. #{@recipient}")
-
+
# If the template is not registered, there should be no parts.
created = nil
assert_nothing_raised { created = TestMailer.create_custom_templating_extension(@recipient) }
assert_not_nil created
assert_equal 0, created.parts.length
-
+
ActionMailer::Base.register_template_extension('haml')
-
+
# Now that the template is registered, there should be one part. The text/plain part.
created = nil
assert_nothing_raised { created = TestMailer.create_custom_templating_extension(@recipient) }
@@ -418,7 +418,7 @@ def test_cancelled_account
assert_not_nil ActionMailer::Base.deliveries.first
assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
-
+
def test_cc_bcc
expected = new_mail
expected.to = @recipient
@@ -515,7 +515,7 @@ def test_perform_deliveries_flag
TestMailer.deliver_signed_up(@recipient)
assert_equal 1, ActionMailer::Base.deliveries.size
end
-
+
def test_doesnt_raise_errors_when_raise_delivery_errors_is_false
ActionMailer::Base.raise_delivery_errors = false
TestMailer.any_instance.expects(:perform_delivery_test).raises(Exception)
@@ -634,7 +634,7 @@ def test_extended_headers
assert_not_nil ActionMailer::Base.deliveries.first
assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
end
-
+
def test_utf8_body_is_not_quoted
@recipient = "Foo áëô îü "
expected = new_mail "utf-8"
@@ -724,7 +724,7 @@ def test_multipart_with_mime_version
mail = TestMailer.create_multipart_with_mime_version(@recipient)
assert_equal "1.1", mail.mime_version
end
-
+
def test_multipart_with_utf8_subject
mail = TestMailer.create_multipart_with_utf8_subject(@recipient)
assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
@@ -789,7 +789,7 @@ def test_implicitly_multipart_messages_with_charset
mail = TestMailer.create_implicitly_multipart_example(@recipient, 'iso-8859-1')
assert_equal "multipart/alternative", mail.header['content-type'].body
-
+
assert_equal 'iso-8859-1', mail.parts[0].sub_header("content-type", "charset")
assert_equal 'iso-8859-1', mail.parts[1].sub_header("content-type", "charset")
assert_equal 'iso-8859-1', mail.parts[2].sub_header("content-type", "charset")
@@ -816,7 +816,7 @@ def test_various_newlines_multipart
assert_equal "line #1\nline #2\nline #3\nline #4\n\n", mail.parts[0].body
assert_equal "
line #1
\n
line #2
\n
line #3
\n
line #4
\n\n", mail.parts[1].body
end
-
+
def test_headers_removed_on_smtp_delivery
ActionMailer::Base.delivery_method = :smtp
TestMailer.deliver_cc_bcc(@recipient)
diff --git a/vendor/rails/actionmailer/test/quoting_test.rb b/vendor/rails/actionmailer/test/quoting_test.rb
index 1498157..c0edceb 100644
--- a/vendor/rails/actionmailer/test/quoting_test.rb
+++ b/vendor/rails/actionmailer/test/quoting_test.rb
@@ -3,10 +3,10 @@
require 'tempfile'
class QuotingTest < Test::Unit::TestCase
-
+
# Move some tests from TMAIL here
def test_unquote_quoted_printable
- a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
+ a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
end
@@ -18,29 +18,29 @@ def test_unquote_base64
end
def test_unquote_without_charset
- a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
+ a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
assert_equal "[166417]_Bekr=E6ftelse_fra_Rejsefeber", b
- end
-
+ end
+
def test_unqoute_multiple
- a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
+ a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
assert_equal "Re: [12] #137: Inkonsistente verwendung von \"Hinzuf\303\274gen\"", b
end
-
+
def test_unqoute_in_the_middle
- a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
+ a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
assert_equal "Re: Photos Brosch\303\274re Rand", b
end
-
+
def test_unqoute_iso
- a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
+ a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
b = TMail::Unquoter.unquote_and_convert_to(a, 'iso-8859-1')
assert_equal "Brosch\374re Rand", b
end
-
+
def test_quote_multibyte_chars
original = "\303\246 \303\270 and \303\245"
@@ -56,8 +56,8 @@ def test_quote_multibyte_chars
unquoted = TMail::Unquoter.unquote_and_convert_to(result, nil)
assert_equal unquoted, original
end
-
-
+
+
# test an email that has been created using \r\n newlines, instead of
# \n newlines.
def test_email_quoted_with_0d0a
@@ -69,19 +69,19 @@ def test_email_with_partially_quoted_subject
mail = TMail::Mail.parse(IO.read("#{File.dirname(__FILE__)}/fixtures/raw_email_with_partially_quoted_subject"))
assert_equal "Re: Test: \"\346\274\242\345\255\227\" mid \"\346\274\242\345\255\227\" tail", mail.subject
end
-
+
def test_decode
encoded, decoded = expected_base64_strings
assert_equal decoded, TMail::Base64.decode(encoded)
end
-
+
def test_encode
encoded, decoded = expected_base64_strings
assert_equal encoded.length, TMail::Base64.encode(decoded).length
end
-
+
private
-
+
# This whole thing *could* be much simpler, but I don't think Tempfile,
# popen and others exist on all platforms (like Windows).
def execute_in_sandbox(code)
@@ -103,7 +103,7 @@ def execute_in_sandbox(code)
File.delete(test_name) rescue nil
File.delete(res_name) rescue nil
end
-
+
def expected_base64_strings
[ File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_encoded_string"), File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_decoded_string") ]
end
diff --git a/vendor/rails/actionmailer/test/test_helper_test.rb b/vendor/rails/actionmailer/test/test_helper_test.rb
index eb17e3e..f16e04e 100644
--- a/vendor/rails/actionmailer/test/test_helper_test.rb
+++ b/vendor/rails/actionmailer/test/test_helper_test.rb
@@ -31,7 +31,7 @@ def test_determine_default_mailer_raises_correct_error
self.class.determine_default_mailer("NotAMailerTest")
end
end
-
+
def test_charset_is_utf_8
assert_equal "utf-8", charset
end
@@ -47,14 +47,14 @@ def test_assert_emails
end
end
end
-
+
def test_repeated_assert_emails_calls
assert_nothing_raised do
assert_emails 1 do
TestHelperMailer.deliver_test
end
end
-
+
assert_nothing_raised do
assert_emails 2 do
TestHelperMailer.deliver_test
@@ -62,20 +62,20 @@ def test_repeated_assert_emails_calls
end
end
end
-
+
def test_assert_emails_with_no_block
assert_nothing_raised do
TestHelperMailer.deliver_test
assert_emails 1
end
-
+
assert_nothing_raised do
TestHelperMailer.deliver_test
TestHelperMailer.deliver_test
assert_emails 3
end
end
-
+
def test_assert_no_emails
assert_nothing_raised do
assert_no_emails do
@@ -83,17 +83,17 @@ def test_assert_no_emails
end
end
end
-
+
def test_assert_emails_too_few_sent
error = assert_raises Test::Unit::AssertionFailedError do
assert_emails 2 do
TestHelperMailer.deliver_test
end
end
-
+
assert_match /2 .* but 1/, error.message
end
-
+
def test_assert_emails_too_many_sent
error = assert_raises Test::Unit::AssertionFailedError do
assert_emails 1 do
@@ -101,17 +101,17 @@ def test_assert_emails_too_many_sent
TestHelperMailer.deliver_test
end
end
-
+
assert_match /1 .* but 2/, error.message
end
-
+
def test_assert_no_emails_failure
error = assert_raises Test::Unit::AssertionFailedError do
assert_no_emails do
TestHelperMailer.deliver_test
end
end
-
+
assert_match /0 .* but 1/, error.message
end
end
diff --git a/vendor/rails/actionmailer/test/url_test.rb b/vendor/rails/actionmailer/test/url_test.rb
index 5647869..7ca4924 100644
--- a/vendor/rails/actionmailer/test/url_test.rb
+++ b/vendor/rails/actionmailer/test/url_test.rb
@@ -1,9 +1,9 @@
require "#{File.dirname(__FILE__)}/abstract_unit"
class TestMailer < ActionMailer::Base
-
+
default_url_options[:host] = 'www.basecamphq.com'
-
+
def signed_up_with_url(recipient)
@recipients = recipient
@subject = "[Signed up] Welcome #{recipient}"
@@ -52,8 +52,8 @@ def teardown
end
def test_signed_up_with_url
- ActionController::Routing::Routes.draw do |map|
- map.connect ':controller/:action/:id'
+ ActionController::Routing::Routes.draw do |map|
+ map.connect ':controller/:action/:id'
map.welcome 'welcome', :controller=>"foo", :action=>"bar"
end
diff --git a/vendor/rails/actionpack/CHANGELOG b/vendor/rails/actionpack/CHANGELOG
index d8a1cc7..8e1e253 100644
--- a/vendor/rails/actionpack/CHANGELOG
+++ b/vendor/rails/actionpack/CHANGELOG
@@ -173,7 +173,7 @@
* ActionController::Routing::DynamicSegment#interpolation_chunk should call #to_s on all values before calling URI.escape. [Rick]
-* Only accept session ids from cookies, prevents session fixation attacks. [bradediger]
+* Only accept session ids from cookies, prevents session fixation attacks. [bradediger]
*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.12.2 - 1.13.3]
@@ -232,7 +232,7 @@
def index
@posts = Post.find(:all)
-
+
respond_to do |format|
format.html # => renders index.html.erb and uses "text/html" as the content type
format.iphone # => renders index.iphone.erb and uses "text/html" as the content type
@@ -326,7 +326,7 @@
After filters will *no longer* be run if an around_filter fails to yield, users relying on
this behaviour are advised to put the code in question after a yield statement in an around filter.
-
+
* Allow you to delete cookies with options. Closes #3685 [Josh Peek, Chris Wanstrath]
@@ -426,13 +426,13 @@
* Update to Prototype 1.5.1. [Sam Stephenson]
-* Allow routes to be decalred under namespaces [Tobias Luetke]:
-
+* Allow routes to be decalred under namespaces [Tobias Luetke]:
+
map.namespace :admin do |admin|
- admin.root :controller => "products"
+ admin.root :controller => "products"
admin.feed 'feed.xml', :controller => 'products', :action => 'feed', :format => 'xml'
end
-
+
* Update to script.aculo.us 1.7.1_beta3. [Thomas Fuchs]
* observe_form always sends the serialized form. #5271 [manfred, normelton@gmail.com]
@@ -444,7 +444,7 @@
* Added url_for usage on render :location, which allows for record identification [DHH]. Example:
render :xml => person, :status => :created, :location => person
-
+
...expands the location to person_url(person).
* Introduce the request.body stream. Lazy-read to parse parameters rather than always setting RAW_POST_DATA. Reduces the memory footprint of large binary PUT requests. [Jeremy Kemper]
@@ -472,21 +472,21 @@
<% form_for(@post) do |f| %>
...
<% end %>
-
+
This will expand to be the same as:
-
+
<% form_for :post, @post, :url => post_path(@post), :html => { :method => :put, :class => "edit_post", :id => "edit_post_45" } do |f| %>
...
<% end %>
-
+
And for new records:
-
+
<% form_for(Post.new) do |f| %>
...
<% end %>
-
+
This will expand to be the same as:
-
+
<% form_for :post, @post, :url => posts_path, :html => { :class => "new_post", :id => "new_post" } do |f| %>
...
<% end %>
@@ -498,7 +498,7 @@
redirect_to(post) # => redirect_to(posts_url(post)) => Location: http://example.com/posts/1
link_to(post.title, post) # => link_to(post.title, posts_url(post)) => Hello world
- Any method that calls url_for on its parameters will automatically benefit from this.
+ Any method that calls url_for on its parameters will automatically benefit from this.
* Removed deprecated parameters_for_method_reference concept (legacy from before named routes) [DHH]
@@ -542,14 +542,14 @@
* Added map.namespace to deal with the common situation of admin sections and the like [DHH]
Before:
-
+
map.resources :products, :path_prefix => "admin", :controller => "admin/products", :collection => { :inventory => :get }, :member => { :duplicate => :post }
map.resources :tags, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_tags"
map.resources :images, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_images"
map.resources :variants, :name_prefix => 'admin_product_', :path_prefix => "admin/products/:product_id", :controller => "admin/product_variants"
After:
-
+
map.namespace(:admin) do |admin|
admin.resources :products,
:collection => { :inventory => :get },
@@ -565,28 +565,28 @@
emails.resources :comments, :name_prefix => "email_"
emails.resources :attachments, :name_prefix => "email_"
end
-
+
After:
map.resources :emails do |emails|
emails.resources :comments
emails.resources :attachments
end
-
+
This does mean that if you intended to have comments_url go to /emails/5/comments, then you'll have to set :name_prefix to nil explicitly.
* Added :has_many and :has_one for declaring plural and singular resources beneath the current [DHH]
Before:
-
+
map.resources :notes do |notes|
notes.resources :comments
notes.resources :attachments
notes.resource :author
end
-
+
After:
-
+
map.resources :notes, :has_many => [ :comments, :attachments ], :has_one => :author
* Added that render :xml will try to call to_xml if it can [DHH]. Makes these work:
@@ -614,9 +614,9 @@
* Default xml template goes from #{action_name}.rxml => #{action_name}.xml.builder.
* Default rjs template goes from #{action_name}.rjs => #{action_name}.js.rjs.
-
+
You can still specify your old templates:
-
+
respond_to do |format|
format.xml do
render :action => "#{action_name}.rxml"
@@ -644,8 +644,8 @@
* Allow configuration of the default action cache path for #caches_action calls. [Rick Olson]
class ListsController < ApplicationController
- caches_action :index, :cache_path => Proc.new { |controller|
- controller.params[:user_id] ?
+ caches_action :index, :cache_path => Proc.new { |controller|
+ controller.params[:user_id] ?
controller.send(:user_lists_url, c.params[:user_id]) :
controller.send(:lists_url) }
end
@@ -718,7 +718,7 @@ Roos]
-
+
stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
@@ -874,7 +874,7 @@ superclass' view_paths. [Rick]
* Add singleton resources. [Rick Olson]
map.resource :account
-
+
GET /account
GET /account;edit
UPDATE /account
@@ -913,7 +913,7 @@ superclass' view_paths. [Rick]
* Added the option for extension aliases to mime type registration [DHH]. Example (already in the default routes):
Mime::Type.register "text/html", :html, %w( application/xhtml+xml ), %w( xhtml )
-
+
...will respond on both .html and .xhtml.
* @response.redirect_url works with 201 Created responses: just return headers['Location'] rather than checking the response status. [Jeremy Kemper]
@@ -982,7 +982,7 @@ superclass' view_paths. [Rick]
<% content_tag :div, :class => "strong" %>
Hello world!
<% end %>
-
+
Will output:
Hello world!
@@ -1041,7 +1041,7 @@ superclass' view_paths. [Rick]
Gives:
-
+
Which is needed for dealing with the IE6 DOM when it's not yet fully loaded.
* Fixed that rescue template path shouldn't be hardcoded, then it's easier to hook in your own #6295 [mnaberez]
@@ -1098,9 +1098,9 @@ superclass' view_paths. [Rick]
* Added proper getters and setters for content type and charset [DHH]. Example of what we used to do:
response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
-
+
...now:
-
+
response.content_type = Mime::ATOM
response.charset = "utf-8"
@@ -1143,7 +1143,7 @@ superclass' view_paths. [Rick]
* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [DHH]. So what used to require a nil, like this:
link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
-
+
...can be written like this:
link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
@@ -1161,7 +1161,7 @@ superclass' view_paths. [Rick]
* Fixed that AssetTagHelper#image_tag and others using compute_public_path should not modify the incoming source argument (closes #5102) [eule@space.ch]
-* Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [DHH]
+* Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [DHH]
* Fixed FormOptionsHelper#select to respect :selected value #5813
@@ -1358,7 +1358,7 @@ superclass' view_paths. [Rick]
class WeblogController < ActionController::Base
def index
@posts = Post.find :all
-
+
respond_to do |format|
format.html
format.xml { render :xml => @posts.to_xml }
@@ -1366,26 +1366,26 @@ superclass' view_paths. [Rick]
end
end
end
-
+
# returns HTML when requested by a browser, since the browser
# has the HTML mimetype at the top of its priority list
Accept: text/html
- GET /weblog
-
- # returns the XML
+ GET /weblog
+
+ # returns the XML
Accept: application/xml
- GET /weblog
+ GET /weblog
- # returns the HTML
+ # returns the HTML
Accept: application/xml
GET /weblog.html
# returns the XML
Accept: text/html
GET /weblog.xml
-
+
All this relies on the fact that you have a route that includes .:format.
-
+
* Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH]
* Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [DHH]
@@ -1421,12 +1421,12 @@ superclass' view_paths. [Rick]
* Fixes bad rendering of JavaScriptMacrosHelper rdoc (closes #4910) [Frederick Ros]
* Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]
-
+
error_messages_for :account, :user, :subscription, :object_name => :account
* Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there. Closes #4079. [Rick Olson]
-* Documentation for AbstractRequest. Closes #4895. [kevin.clark@gmail.com]
+* Documentation for AbstractRequest. Closes #4895. [kevin.clark@gmail.com]
* Refactor various InstanceTag instance method to class methods. Closes #4800. [skaes@web.de]
@@ -1459,8 +1459,8 @@ superclass' view_paths. [Rick]
* Modify routing so that you can say :require => { :method => :post } for a route, and the route will never be selected unless the request method is POST. Only works for route recognition, not for route generation. [Jamis Buck]
* Added :add_headers option to verify which merges a hash of name/value pairs into the response's headers hash if the prerequisites cannot be satisfied. [Sam Stephenson]
- ex. verify :only => :speak, :method => :post,
- :render => { :status => 405, :text => "Must be post" },
+ ex. verify :only => :speak, :method => :post,
+ :render => { :status => 405, :text => "Must be post" },
:add_headers => { "Allow" => "POST" }
* Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled #1897 [jeremye@bsa.ca.gov]
@@ -1626,7 +1626,7 @@ superclass' view_paths. [Rick]
<% content_tag :div, :class => "strong" %>
Hello world!
<% end %>
-
+
Will output:
Hello world!
@@ -1679,7 +1679,7 @@ superclass' view_paths. [Rick]
Gives:
-
+
Which is needed for dealing with the IE6 DOM when it's not yet fully loaded.
* Fixed that rescue template path shouldn't be hardcoded, then it's easier to hook in your own #6295 [mnaberez]
@@ -1734,9 +1734,9 @@ superclass' view_paths. [Rick]
* Added proper getters and setters for content type and charset [DHH]. Example of what we used to do:
response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
-
+
...now:
-
+
response.content_type = Mime::ATOM
response.charset = "utf-8"
@@ -1771,7 +1771,7 @@ superclass' view_paths. [Rick]
* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [DHH]. So what used to require a nil, like this:
link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
-
+
...can be written like this:
link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
@@ -1785,7 +1785,7 @@ superclass' view_paths. [Rick]
* Fixed that AssetTagHelper#image_tag and others using compute_public_path should not modify the incoming source argument (closes #5102) [eule@space.ch]
-* Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [DHH]
+* Deprecated the auto-appending of .png to AssetTagHelper#image_tag calls that doesn't have an extension [DHH]
* Fixed FormOptionsHelper#select to respect :selected value #5813
@@ -1951,7 +1951,7 @@ superclass' view_paths. [Rick]
class WeblogController < ActionController::Base
def index
@posts = Post.find :all
-
+
respond_to do |format|
format.html
format.xml { render :xml => @posts.to_xml }
@@ -1959,26 +1959,26 @@ superclass' view_paths. [Rick]
end
end
end
-
+
# returns HTML when requested by a browser, since the browser
# has the HTML mimetype at the top of its priority list
Accept: text/html
- GET /weblog
-
- # returns the XML
+ GET /weblog
+
+ # returns the XML
Accept: application/xml
- GET /weblog
+ GET /weblog
- # returns the HTML
+ # returns the HTML
Accept: application/xml
GET /weblog.html
# returns the XML
Accept: text/html
GET /weblog.xml
-
+
All this relies on the fact that you have a route that includes .:format.
-
+
* Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH]
* Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [DHH]
@@ -2000,7 +2000,7 @@ superclass' view_paths. [Rick]
* Use #flush between switching from #write to #syswrite. Closes #4907. [Blair Zajac ]
* Allow error_messages_for to report errors for multiple objects, as well as support for customizing the name of the object in the error summary header. Closes #4186. [andrew@redlinesoftware.com, Marcel Molina Jr.]
-
+
error_messages_for :account, :user, :subscription, :object_name => :account
* Fix assert_redirected_to tests according to real-world usage. Also, don't fail if you add an extra :controller option: [Rick]
@@ -2022,8 +2022,8 @@ superclass' view_paths. [Rick]
* Modify routing so that you can say :require => { :method => :post } for a route, and the route will never be selected unless the request method is POST. Only works for route recognition, not for route generation. [Jamis Buck]
* Added :add_headers option to verify which merges a hash of name/value pairs into the response's headers hash if the prerequisites cannot be satisfied. [Sam Stephenson]
- ex. verify :only => :speak, :method => :post,
- :render => { :status => 405, :text => "Must be post" },
+ ex. verify :only => :speak, :method => :post,
+ :render => { :status => 405, :text => "Must be post" },
:add_headers => { "Allow" => "POST" }
@@ -2088,7 +2088,7 @@ superclass' view_paths. [Rick]
* Added automated timestamping to AssetTagHelper methods for stylesheets, javascripts, and images when Action Controller is run under Rails [DHH]. Example:
image_tag("rails.png") # => ''
-
+
...to avoid frequent stats (not a problem for most people), you can set RAILS_ASSET_ID in the ENV to avoid stats:
ENV["RAILS_ASSET_ID"] = "2345"
@@ -2108,9 +2108,9 @@ superclass' view_paths. [Rick]
* Change #form_for and #fields_for so that the second argument is not required [Dave Thomas]
<% form_for :post, @post, :url => { :action => 'create' } do |f| -%>
-
+
becomes...
-
+
<% form_for :post, :url => { :action => 'create' } do |f| -%>
* Update to script.aculo.us 1.6 [Thomas Fuchs]
@@ -2128,11 +2128,11 @@ superclass' view_paths. [Rick]
* Added nicer message for assert_redirected_to (closes #4294) [court3nay]
assert_redirected_to :action => 'other_host', :only_path => false
-
+
when it was expecting...
-
+
redirected_to :action => 'other_host', :only_path => true, :host => 'other.test.host'
-
+
gives the error message...
response is not a redirection to all of the options supplied (redirection is <{:only_path=>false, :host=>"other.test.host", :action=>"other_host"}>), difference: <{:only_path=>"true", :host=>"other.test.host"}>
@@ -2179,11 +2179,11 @@ superclass' view_paths. [Rick]
* CHANGED DEFAULT: The default content type for .rxml is now application/xml instead of type/xml, see http://www.xml.com/pub/a/2004/07/21/dive.html for reason [DHH]
* Added option to render action/template/file of a specific extension (and here by template type). This means you can have multiple templates with the same name but a different extension [DHH]. Example:
-
+
class WeblogController < ActionController::Base
def index
@posts = Post.find :all
-
+
respond_to do |type|
type.html # using defaults, which will render weblog/index.rhtml
type.xml { render :action => "index.rxml" }
@@ -2197,7 +2197,7 @@ superclass' view_paths. [Rick]
class WeblogController < ActionController::Base
def create
@post = Post.create(params[:post])
-
+
respond_to do |type|
type.js { render } # renders create.rjs
type.html { redirect_to :action => "index" }
@@ -2223,16 +2223,16 @@ superclass' view_paths. [Rick]
* Added plugin support for parameter parsers, which allows for better support for REST web services. By default, posts submitted with the application/xml content type is handled by creating a XmlSimple hash with the same name as the root element of the submitted xml. More handlers can easily be registered like this:
# Assign a new param parser to a new content type
- ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data|
- node = REXML::Document.new(post)
+ ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data|
+ node = REXML::Document.new(post)
{ node.root.name => node.root }
end
# Assign the default XmlSimple to a new content type
ActionController::Base.param_parsers['application/backpack+xml'] = :xml_simple
-
+
Default YAML web services were retired, ActionController::Base.param_parsers carries an example which shows how to get this functionality back. As part of this new plugin support, request.[formatted_post?, xml_post?, yaml_post? and post_format] were all deprecated in favor of request.content_type [Tobias Luetke]
-
+
* Fixed Effect.Appear in effects.js to work with floats in Safari #3524, #3813, #3044 [Thomas Fuchs]
* Fixed that default image extension was not appended when using a full URL with AssetTagHelper#image_tag #4032, #3728 [rubyonrails@beautifulpixel.com]
@@ -2270,7 +2270,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
page['blank_slate'] # => $('blank_slate');
page['blank_slate'].show # => $('blank_slate').show();
page['blank_slate'].show('first').up # => $('blank_slate').show('first').up();
-
+
page.select('p') # => $$('p');
page.select('p.welcome b').first # => $$('p.welcome b').first();
page.select('p.welcome b').first.hide # => $$('p.welcome b').first().hide();
@@ -2408,7 +2408,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Add session ID to default logging, but remove the verbose description of every step [DHH]
* Add the following RJS methods: [Sam Stephenson]
-
+
* alert - Displays an alert() dialog
* redirect_to - Changes window.location.href to simulate a browser redirect
* call - Calls a JavaScript function
@@ -2490,13 +2490,13 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
page.visual_effect :highlight, 'list'
page.hide 'status-indicator', 'cancel-link'
end
-
+
generates the following JavaScript:
-
+
new Insertion.Bottom("list", "
Last item
");
new Effect.Highlight("list");
["status-indicator", "cancel-link"].each(Element.hide);
-
+
* Refactored JavaScriptHelper into PrototypeHelper and ScriptaculousHelper [Sam Stephenson]
* Update to latest script.aculo.us version (as of [3031])
@@ -2519,12 +2519,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
<% form_for :person, person, :url => { :action => "update" } do |person_form| %>
First name: <%= person_form.text_field :first_name %>
Last name : <%= person_form.text_field :last_name %>
-
+
<% fields_for :permission => person.permission do |permission_fields| %>
Admin? : <%= permission_fields.check_box :admin %>
<% end %>
<% end %>
-
+
* options_for_select allows any objects which respond_to? :first and :last rather than restricting to Array and Range. #2824 [Jacob Robbins , Jeremy Kemper]
* The auto_link text helper accepts an optional block to format the link text for each url and email address. Example: auto_link(post.body) { |text| truncate(text, 10) } [Jeremy Kemper]
@@ -2555,11 +2555,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
class ApplicationController < ActionController::Base
before_filter :authenticate
end
-
+
class WeblogController < ApplicationController
# will run the :authenticate filter
end
-
+
class SignupController < ActionController::Base
# will not run the :authenticate filter
skip_before_filter :authenticate
@@ -2705,7 +2705,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added easy assignment of fragment cache store through use of symbols for included stores (old way still works too)
Before:
- ActionController::Base.fragment_cache_store =
+ ActionController::Base.fragment_cache_store =
ActionController::Base::Caching::Fragments::FileStore.new("/path/to/cache/directory")
After:
@@ -2868,7 +2868,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added incremental and local autocompleting and loads of documentation to controls.js [Ivan Krstic]
* Extended the auto_complete_field helper to accept tokens option
* Changed object extension mechanism to favor Object.extend to make script.aculo.us easily adaptable to support 3rd party libs like IE7.js [David Zülke]
-
+
* Fixed that named routes didn't use the default values for action and possible other parameters #1534 [Nicholas Seckar]
* Fixed JavascriptHelper#visual_effect to use camelize such that :blind_up will work #1639 [pelletierm@eastmedia.net]
@@ -2924,13 +2924,13 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added support for graceful error handling of Ajax calls #1217 [Jamis Buck/Thomas Fuchs]. Example:
link_to_remote(
- "test",
- :url => { :action => "faulty" },
+ "test",
+ :url => { :action => "faulty" },
:update => { :success => "good", :failure => "bad" },
403 => "alert('Forbidden- got ya!')",
- 404 => "alert('Nothing there...?')",
+ 404 => "alert('Nothing there...?')",
:failure => "alert('Unkown error ' + request.status)")
-
+
* Attempt to explicitly flush the output at the end of CgiProcess#out
* Fixed assert_redirected_to to handle absolute controller paths properly #1472 [Rick Olson/Nicholas Seckar]
@@ -2941,7 +2941,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Fixed prototype to consider all fields it doesn't know as text (such as Safari's search) just like the browser in its serialization #1497 [Sean Treadway]
-* Improved performance of Routes generation by a factor of 5 #1434 [Nicholas Seckar]
+* Improved performance of Routes generation by a factor of 5 #1434 [Nicholas Seckar]
* Added named routes (NEEDS BETTER DESCRIPTION) #1434 [Nicholas Seckar]
@@ -2972,8 +2972,8 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Correct distance_of_time_in_words for integer arguments and make the second arg optional, treating the first arg as a duration in seconds. #1458 [madrobby ]
-* Fixed query parser to deal gracefully with equal signs inside keys and values #1345 [gorou].
- Example: /?sig=abcdef=:foobar=&x=y will pass now.
+* Fixed query parser to deal gracefully with equal signs inside keys and values #1345 [gorou].
+ Example: /?sig=abcdef=:foobar=&x=y will pass now.
* Added Cuba to country list #1351 [todd]
@@ -2993,7 +2993,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Ensure that helpers are only available to the controllers where they are defined and their subclasses. #1394 [kdole@tamu.edu]
-* render("foo/bar") works with a layout again
+* render("foo/bar") works with a layout again
* Fixed double-singularization on scaffolded pagination call (Address would be turned into Addres) #1216, #1404 [nilsga]
@@ -3041,7 +3041,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
| render_text "hello world!" | render :text => "hello world!" |
| render_partial_collection "person", @people, nil, :a => 1 | render :partial => "person", :collection => @people, |
| | :locals => { :a => 1 } |
- +---------------------------------------------------------------+-------------------------------------------------------+
+ +---------------------------------------------------------------+-------------------------------------------------------+
* Deprecated redirect_to_path and redirect_to_url in favor of letting redirect_to do the right thing when passed either a path or url.
@@ -3069,7 +3069,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
Content-Type: application/xml
HelloWorld
-
+
...is the same as:
Content-Type: application/x-yaml
@@ -3078,11 +3078,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
content: HelloWorld
...is the same as:
-
+
item[content]=HelloWorld
-
+
Which in the end turns into { "item" => { "content" => "HelloWorld" } }. This makes it a lot easier to publish REST web services on top of your regular actions (as they won't care).
-
+
Example Curl call:
curl -H 'Content-Type: application/xml' -d 'KillMeMore' http://www.example.com/service
@@ -3126,11 +3126,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Removed dumping of template assigns on the rescue page as it would very easily include a ton of data making page loads take seconds (and the information was rarely helpful) #1222
* Added BenchmarkHelper that can measure the execution time of a block in a template and reports the result to the log. Example:
-
+
<% benchmark "Notes section" do %>
<%= expensive_notes_operation %>
<% end %>
-
+
Will add something like "Notes section (0.345234)" to the log.
* Added ActionController::Caching::Sweeper as an improved an easier to use sweeper. The new sweepers work on a single-step approach instead of two-steps like the old ones. Before
@@ -3138,7 +3138,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
def after_save(record)
@list = record.is_a?(List) ? record : record.list
end
-
+
def filter(controller)
controller.expire_page(:controller => "lists", :action => %w( show public feed ), :id => @list.id)
controller.expire_action(:controller => "lists", :action => "all")
@@ -3155,7 +3155,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
end
The new sweepers can also observe on the actions themselves by implementing methods according to (before|after)_$controller_$action. Example of a callback that'll be called after PagesController#update_title has been performed:
-
+
def after_pages_update_title
expire_fragment(%r{pages/#{controller.assigns["page"].id}/.*})
end
@@ -3194,16 +3194,16 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added a wide range of new Javascript effects:
* Effect.Puff zooms the element out and makes it smoothly transparent at the same time, giving a "puff" illusion #996 [thomas@fesch.at]
- After the animation is completed, the display property will be set to none.
+ After the animation is completed, the display property will be set to none.
This effect will work on relative and absolute positioned elements.
-
+
* Effect.Appear as the opposite of Effect.Fade #990 [thomas@fesch.at]
You should return elements with style="display:none;" or a like class for this to work best and have no chance of flicker.
-
+
* Effect.Squish for scaling down an element and making it disappear at the end #972 [thomas@fesch.at]
-
+
* Effect.Scale for smoothly scaling images or text up and down #972 [thomas@fesch.at]
-
+
* Effect.Fade which smoothly turns opacity from 100 to 0 and then hides the element #960 [thomas@fesch.at]
* Added Request#xml_http_request? (and an alias xhr?) to that'll return true when the request came from one of the Javascript helper methods (Ajax). This can be used to give one behavior for modern browsers supporting Ajax, another to old browsers #1127 [Sam Stephenson]
@@ -3211,11 +3211,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Changed render_partial to take local assigns as the second parameter instead of an explicit object and then the assigns. So the API changes from:
<%= render_partial "account", person, "rules" => regulations.rules %>
-
+
...to:
-
+
<%= render_partial "account", :account => person, :rules => regulations.rules %>
-
+
The old API will still work, though, and render_partial "account" will still assume :account => @account.
* Added support for web servers that use PATH_INFO instead of REQUEST_URI like IIS #1014 [BradG/Nicholas Seckar]
@@ -3356,7 +3356,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
flash.now[:message] = 'Save failed, review'
render_action 'edit'
end
- end
+ end
end
* Added to_param call for parameters when composing an url using url_for from something else than strings #812 [Sam Stephenson]. Example:
@@ -3394,7 +3394,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
A request for /categories/top-level-cat, would give @params[:path_info] with "top-level-cat".
A request for /categories/top-level-cat/level-1-cat, would give @params[:path_info] with "top-level-cat/level-1-cat" and so forth.
-
+
The @params[:path_info] return is really an array, but where to_s has been overwritten to do join("/").
* Fixed options_for_select on selected line issue #624 [Florian Weber]
@@ -3515,11 +3515,11 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
def test_create_post
post :create, "post" => { "title" => "Exciting!" }
assert_redirected_to :action => "show"
-
+
follow_redirect
assert_rendered_file "post/show"
end
-
+
Limitation: Only works for redirects to other actions within the same controller.
* Fixed double requiring of models with the same name as the controller
@@ -3544,9 +3544,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
<%= text_field "student[]", "last_name" %>
<%= text_field "student[]", "grade", :size => "5" %>
<% end %>
-
+
...would produce, for say David Black with id 123 and a grace of C+:
-
+
@@ -3576,7 +3576,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
class WeblogController
before_filter { |c| c.send(:redirect_to_url("http://www.farfaraway.com")}) }
-
+
def hello
render_text "I will never be called"
end
@@ -3589,7 +3589,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
redirect_to :action => "elsewhere"
render_action "overthere"
end
-
+
Only the redirect happens. The rendering call is simply ignored.
@@ -3599,12 +3599,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added assert_cookie_equal to assert the contents of a named cookie
-* Fixed bug in page caching that prevented it from working at all
+* Fixed bug in page caching that prevented it from working at all
*1.3.0* (January 17th, 2005)
-* Added an extensive caching module that offers three levels of granularity (page, action, fragment) and a variety of stores.
+* Added an extensive caching module that offers three levels of granularity (page, action, fragment) and a variety of stores.
Read more in ActionController::Caching.
* Added the option of passing a block to ActiveRecordHelper#form in order to add more to the auto-generated form #469 [dom@sisna.com]
@@ -3643,9 +3643,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Fixed three issues with retrying breakpoints #417 [Florian Gross]
- 1. Don't screw up pages that use multiple values for the same parameter (?foo=bar&foo=qux was converted to ?foo=barqux)
- 2. Don't screw up all forms when you click the "Retry with Breakpoint" link multiple times instead of reloading
- (This caused the parameters to be added multiple times for GET forms leading to trouble.)
+ 1. Don't screw up pages that use multiple values for the same parameter (?foo=bar&foo=qux was converted to ?foo=barqux)
+ 2. Don't screw up all forms when you click the "Retry with Breakpoint" link multiple times instead of reloading
+ (This caused the parameters to be added multiple times for GET forms leading to trouble.)
3. Don't add ?BP-RETRY=1 multiple times
* Added that all renders and redirects now return false, so they can be used as the last line in before_filters to stop execution.
@@ -3657,7 +3657,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
return false
end
end
-
+
After:
def authenticate
redirect_to(:controller => "account", :action => "login") unless @session[:authenticated]
@@ -3668,7 +3668,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
class JournalController < ActionController::Base
# only require authentication if the current action is edit or delete
before_filter :authorize, :only_on => [ :edit, :delete ]
-
+
private
def authorize
# redirect to login unless authenticated
@@ -3712,7 +3712,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added more informative exception when using helper :some_helper and the helper requires another file that fails, you'll get an
error message tells you what file actually failed to load, rather than falling back on assuming it was the helper file itself #346 [dblack]
-* Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
+* Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
validation where the value would normally be "100".
* Added Request#port_string to get something like ":8080" back on 8080 and "" on 80 (or 443 with https).
@@ -3759,15 +3759,15 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
scaffold :<%= singular_name %>
<% end %>
helper :post
-
+
...produces this on post as singular_name:
class SomeController < ApplicationController
-
+
scaffold :post
-
+
helper :post
-
+
...where as:
class SomeController < ApplicationController
@@ -3775,18 +3775,18 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
scaffold :<%= singular_name %>
<% end -%>
helper :post
-
+
...produces:
class SomeController < ApplicationController
scaffold :post
helper :post
-
+
[This undocumented gem for ERb was uncovered by bitsweat]
* Fixed CgiRequest so that it'll now accept session options with Symbols as keys (as the documentation points out) [Suggested by Andreas]
-* Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
+* Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
local_assigns hash that overrides it. As a result, render_collection_of_partials can still be written in terms of render_partial
and partials that make use of a counter can be called without problems from both render_collection_of_partials as well as
render_partial #295 [marcel]
@@ -3801,12 +3801,12 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
link:classes/ActionController/Base.html#M000021. It's also possible to pass a string instead of an options hash to
get a link tag that just points without consideration. The html_options works jointly for the image and ahref tag by
letting the following special values enter the options on the image and the rest goes to the ahref:
-
+
::alt: If no alt text is given, the file name part of the +src+ is used (capitalized and without the extension)
::size: Supplied as "XxY", so "30x45" becomes width="30" and height="45"
::align: Sets the alignment, no special features
-
- The +src+ can be supplied as a...
+
+ The +src+ can be supplied as a...
* full path, like "/my_images/image.gif"
* file name, like "rss.gif", that gets expanded to "/images/rss.gif"
* file name without extension, like "logo", that gets expanded to "/images/logo.png"
@@ -3821,10 +3821,10 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
# Calls Controller#miletone with a GET request
process :milestone
-
+
# Calls Controller#miletone with a POST request that has parameters
post :milestone, { "name" => "David" }
-
+
# Calls Controller#milestone with a HEAD request that has both parameters and session data
head :milestone, { "id" => 1 }, { "user_id" => 23 }
@@ -3834,7 +3834,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Added indifference to whether @headers["Content-Type"], @headers["Content-type"], or @headers["content-type"] is used.
-* Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
+* Added TestSession#session_id that returns an empty string to make it easier to functional test applications that doesn't use
cookie-based sessions #275 [jcf]
* Fixed that cached template loading would still check the file system to see if the file existed #258 [Andreas Schwarz]
@@ -3849,9 +3849,9 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
cookies["user_name"] = "david" # => Will set a simple session cookie
cookies["login"] = { "value" => "XJ-122", "expires" => Time.now + 360} # => Will set a cookie that expires in 1 hour
-
+
Examples for reading:
-
+
cookies["user_name"] # => "david"
cookies.size # => 2
@@ -3886,14 +3886,14 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
class MsgController < ApplicationController
helper :msg
end
-
+
...you can just do:
-
+
class MsgController < ApplicationController
end
* Added dependencies_on(layer) to query the dependencies of a controller. Examples:
-
+
MsgController.dependencies_on(:model) # => [ :post, :comment, :attachment ]
MsgController.dependencies_on(:service) # => [ :notification_service ]
MsgController.dependencies_on(:observer) # => [ :comment_observer ]
@@ -3948,7 +3948,7 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
class WeblogController < ActionController::Base
include WeblogHelper
end
-
+
After:
module WeblogHelper
@@ -3984,10 +3984,10 @@ Default YAML web services were retired, ActionController::Base.param_parsers car
* Changed scaffolding of forms to use