merge + fix tiny bugs

This commit is contained in:
dinedine 2010-08-02 13:45:50 +02:00
commit d973868a06
19 changed files with 161 additions and 145 deletions

13
Gemfile
View File

@ -1,12 +1,11 @@
# Edit this Gemfile to bundle your application's dependencies.
source 'http://gemcutter.org'
source 'http://gems.github.com'
source 'http://rubygems.org'
gem 'rails', '3.0.0.beta4'
gem 'rails', '3.0.0.rc'
gem 'liquid', '2.0.0'
gem 'bson_ext', '>= 1.0.1'
gem 'mongoid', '2.0.0.beta.14'
gem 'mongoid', '2.0.0.beta.15'
gem 'mongoid_acts_as_tree', '0.1.5'
gem 'mongo_session_store', '2.0.0.pre'
gem 'warden'
@ -15,8 +14,8 @@ gem 'haml', '3.0.13'
gem 'rmagick', '2.12.2'
gem 'aws'
gem 'mimetype-fu', :require => 'mimetype_fu'
gem 'formtastic-rails3'
gem 'carrierwave-rails3', :require => 'carrierwave'
gem 'formtastic-rails3', '1.0.0.beta3', :require => 'formtastic'
gem 'carrierwave', '0.5.0.beta2'
gem 'actionmailer-with-request', :require => 'actionmailer_with_request'
gem 'heroku'
gem 'httparty', '0.6.1'
@ -30,7 +29,7 @@ group :development do
gem 'mongrel'
gem 'cgi_multipart_eof_fix'
gem 'fastthread'
gem 'mongrel_experimental'
# gem 'mongrel_experimental'
end
group :test, :development do

View File

@ -5,53 +5,42 @@ GIT
mocha (0.9.8.20090918115329)
rake
GIT
remote: http://github.com/justinfrench/formtastic.git
revision: e7e29b6
branch: rails3
specs:
formtastic (1.0.0.beta2)
actionpack (>= 2.3.0)
activesupport (>= 2.3.0)
i18n (>= 0.4.0)
GEM
remote: http://gemcutter.org/
remote: http://gems.github.com/
remote: http://rubygems.org/
specs:
RedCloth (4.2.3)
abstract (1.0.0)
actionmailer (3.0.0.beta4)
actionpack (= 3.0.0.beta4)
mail (~> 2.2.3)
actionmailer (3.0.0.rc)
actionpack (= 3.0.0.rc)
mail (~> 2.2.5)
actionmailer-with-request (0.1.1)
actionpack (3.0.0.beta4)
activemodel (= 3.0.0.beta4)
activesupport (= 3.0.0.beta4)
actionpack (3.0.0.rc)
activemodel (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
builder (~> 2.1.2)
erubis (~> 2.6.5)
erubis (~> 2.6.6)
i18n (~> 0.4.1)
rack (~> 1.1.0)
rack-mount (~> 0.6.3)
rack (~> 1.2.1)
rack-mount (~> 0.6.9)
rack-test (~> 0.5.4)
tzinfo (~> 0.3.16)
activemodel (3.0.0.beta4)
activesupport (= 3.0.0.beta4)
tzinfo (~> 0.3.22)
activemodel (3.0.0.rc)
activesupport (= 3.0.0.rc)
builder (~> 2.1.2)
i18n (~> 0.4.1)
activerecord (3.0.0.beta4)
activemodel (= 3.0.0.beta4)
activesupport (= 3.0.0.beta4)
activerecord (3.0.0.rc)
activemodel (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
arel (~> 0.4.0)
tzinfo (~> 0.3.16)
activeresource (3.0.0.beta4)
activemodel (= 3.0.0.beta4)
activesupport (= 3.0.0.beta4)
activesupport (3.0.0.beta4)
tzinfo (~> 0.3.22)
activeresource (3.0.0.rc)
activemodel (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
activesupport (3.0.0.rc)
arel (0.4.0)
activesupport (>= 3.0.0.beta)
autotest (4.3.2)
aws (2.3.13)
aws (2.3.20)
http_connection
uuidtools
xml-simple
@ -69,7 +58,8 @@ GEM
capybara-envjs (0.1.6)
capybara (>= 0.3.9)
envjs (>= 0.3.7)
carrierwave-rails3 (0.4.5)
carrierwave (0.5.0.beta2)
activesupport (>= 3.0.0.beta4)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.1)
configuration (1.1.0)
@ -100,6 +90,9 @@ GEM
fastthread (1.0.7)
ffi (0.6.3)
rake (>= 0.8.7)
formtastic-rails3 (1.0.0.beta3)
actionpack (>= 3.0.0beta3)
activesupport (>= 3.0.0beta3)
gem_plugin (0.2.3)
gemcutter (0.6.1)
gherkin (2.1.5)
@ -107,7 +100,7 @@ GEM
git (1.2.5)
haml (3.0.13)
has_scope (0.5.0)
heroku (1.9.11)
heroku (1.9.13)
json_pure (>= 1.2.0, < 1.5.0)
launchy (~> 0.3.2)
rest-client (~> 1.4.0)
@ -136,59 +129,57 @@ GEM
treetop (>= 1.4.5)
mime-types (1.16)
mimetype-fu (0.1.2)
mongo (1.0.5)
mongo (1.0.6)
bson (>= 1.0.4)
mongo_session_store (2.0.0.pre)
actionpack (~> 3.0)
mongoid (2.0.0.beta11)
activemodel (~> 3.0.0.beta)
bson (~> 1.0.4)
mongo (~> 1.0.5)
tzinfo (~> 0.3.22)
mongoid (2.0.0.beta.15)
activemodel (= 3.0.0.rc)
bson (= 1.0.4)
mongo (= 1.0.6)
tzinfo (= 0.3.22)
will_paginate (~> 3.0.pre)
mongoid_acts_as_tree (0.1.5)
bson (>= 0.20.1)
mongoid (<= 2.0.0)
mongrel (1.1)
mongrel (1.1.5)
cgi_multipart_eof_fix (>= 2.4)
daemons (>= 1.0.3)
fastthread (>= 1.0.1)
gem_plugin (>= 0.2.3)
mongrel_experimental (1.1)
mongrel (= 1.1)
nokogiri (1.4.2)
nokogiri (1.4.3.1)
polyglot (0.3.1)
rack (1.1.0)
rack (1.2.1)
rack-mount (0.6.9)
rack (>= 1.0.0)
rack-test (0.5.4)
rack (>= 1.0)
rails (3.0.0.beta4)
actionmailer (= 3.0.0.beta4)
actionpack (= 3.0.0.beta4)
activerecord (= 3.0.0.beta4)
activeresource (= 3.0.0.beta4)
activesupport (= 3.0.0.beta4)
bundler (>= 0.9.26)
railties (= 3.0.0.beta4)
railties (3.0.0.beta4)
actionpack (= 3.0.0.beta4)
activesupport (= 3.0.0.beta4)
rails (3.0.0.rc)
actionmailer (= 3.0.0.rc)
actionpack (= 3.0.0.rc)
activerecord (= 3.0.0.rc)
activeresource (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
bundler (>= 1.0.0.rc.1)
railties (= 3.0.0.rc)
railties (3.0.0.rc)
actionpack (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
rake (>= 0.8.3)
thor (~> 0.13.6)
thor (~> 0.14.0)
rake (0.8.7)
responders (0.6.1)
responders (0.6.2)
rest-client (1.4.2)
mime-types (>= 1.16)
rmagick (2.12.2)
rspec (2.0.0.beta.18)
rspec-core (= 2.0.0.beta.18)
rspec-expectations (= 2.0.0.beta.18)
rspec-mocks (= 2.0.0.beta.18)
rspec-core (2.0.0.beta.18)
rspec-expectations (2.0.0.beta.18)
rspec (2.0.0.beta.19)
rspec-core (= 2.0.0.beta.19)
rspec-expectations (= 2.0.0.beta.19)
rspec-mocks (= 2.0.0.beta.19)
rspec-core (2.0.0.beta.19)
rspec-expectations (2.0.0.beta.19)
diff-lcs (>= 1.1.2)
rspec-mocks (2.0.0.beta.18)
rspec-mocks (2.0.0.beta.19)
rspec-rails (2.0.0.beta.18)
rspec (>= 2.0.0.beta.14)
webrat (>= 0.7.0)
@ -200,14 +191,14 @@ GEM
rubyforge (2.0.4)
json_pure (>= 1.1.7)
rubyzip (0.9.4)
selenium-webdriver (0.0.26)
selenium-webdriver (0.0.27)
ffi (>= 0.6.1)
json_pure
rubyzip
spork (0.8.4)
stackdeck (0.2.0)
term-ansicolor (1.0.5)
thor (0.13.8)
thor (0.14.0)
treetop (1.4.8)
polyglot (>= 0.3.1)
trollop (1.16.2)
@ -219,7 +210,7 @@ GEM
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
will_paginate (3.0.pre)
will_paginate (3.0.pre2)
xml-simple (1.0.12)
PLATFORMS
@ -233,7 +224,7 @@ DEPENDENCIES
bson_ext (>= 1.0.1)
capybara
capybara-envjs (>= 0.1.5)
carrierwave-rails3
carrierwave (= 0.5.0.beta2)
cgi_multipart_eof_fix
cucumber
cucumber-rails
@ -241,7 +232,7 @@ DEPENDENCIES
devise (= 1.1.rc2)
factory_girl_rails
fastthread
formtastic!
formtastic-rails3 (= 1.0.0.beta3)
haml (= 3.0.13)
heroku
httparty (= 0.6.1)
@ -252,11 +243,10 @@ DEPENDENCIES
mimetype-fu
mocha!
mongo_session_store (= 2.0.0.pre)
mongoid (= 2.0.0.beta.14)
mongoid (= 2.0.0.beta.15)
mongoid_acts_as_tree (= 0.1.5)
mongrel
mongrel_experimental
rails (= 3.0.0.beta4)
rails (= 3.0.0.rc)
rmagick (= 2.12.2)
rspec-rails (= 2.0.0.beta.18)
ruby-debug

View File

@ -1,11 +1,12 @@
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from Exception, :with => :render_error
# rescue_from Exception, :with => :render_error
protected
private
def render_error
def render_error(exception)
ActionDispatch::ShowExceptions.new(self).send(:log_error, exception) # TODO: find a better way to access log_error
render :template => "/admin/errors/500", :layout => 'admin/box', :status => 500
end
end

View File

@ -25,7 +25,7 @@ class Membership
if @email.blank?
self.errors.add_on_blank(:email)
:error
elsif self.account.nil?
elsif self.account.blank?
:create_account
elsif self.site.memberships.find_all { |m| m.account_id == self.account_id }.size > 1
self.errors.add(:base, 'Already created')

View File

@ -1,6 +1,6 @@
- content_for :head do
= javascript_include_tag 'admin/plugins/fancybox', 'admin/custom_fields'
= stylesheet_link_tag 'admin/plugins/fancybox', 'admin/box'
= stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes'
= f.inputs :name => :information do
= f.input :name

View File

@ -1,4 +1,4 @@
.box-wrapper
.fancybox-wrapper
#edit-custom-field
%h2!= t('.title')

View File

@ -1,8 +1,2 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
default: features --format pretty --color --tags ~@wip
wip: features --tags @wip

View File

@ -10,13 +10,15 @@ Locomotive::Application.configure do
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = false
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
# config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# MockSmtp settings

View File

@ -9,6 +9,15 @@ Locomotive::Application.configure do
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
@ -30,4 +39,10 @@ Locomotive::Application.configure do
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
end

View File

@ -14,6 +14,9 @@ Locomotive::Application.configure do
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
@ -26,6 +29,9 @@ Locomotive::Application.configure do
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
CarrierWave.configure do |config|

View File

@ -1,5 +1,5 @@
require 'formtastic'
Formtastic::SemanticFormHelper.builder = MiscFormBuilder
require 'locomotive/misc_form_builder'
Formtastic::SemanticFormHelper.builder = Locomotive::MiscFormBuilder
Formtastic::SemanticFormBuilder.i18n_lookups_by_default = true

View File

@ -35,7 +35,7 @@ en:
errors:
"500":
title: Application Error
notice: "Sorry, "
notice: "We're sorry, but something went wrong"
link: "&rarr; Back to the application"
"404":
title: Page not found

View File

@ -1,6 +1,7 @@
BOARD:
- refactor slugify method (use parameterize + create a module)
- [content types] the "display column" selector should not include file types
BACKLOG:

View File

@ -9,6 +9,9 @@ require 'locomotive/custom_fields'
require 'locomotive/httparty'
require 'locomotive/inherited_resources'
require 'locomotive/admin_responder'
require 'locomotive/routing'
require 'locomotive/regexps'
require 'locomotive/render'
require 'mongo_session_store/mongoid'

View File

@ -1,4 +1,5 @@
require 'heroku'
require 'locomotive/heroku/custom_domain'
module Locomotive
module Heroku

View File

@ -0,0 +1,47 @@
module Locomotive
class MiscFormBuilder < Formtastic::SemanticFormBuilder
@@all_fields_required_by_default = false
def foldable_inputs(*args, &block)
opts = args.extract_options!
unfolded = !(opts[:class] || '').index('off').nil? || @object.new_record? || !@object.errors.empty?
opts[:class] = (opts[:class] || '') + " inputs foldable #{'folded' unless unfolded}"
args.push(opts)
self.inputs(*args, &block)
end
def custom_input(name, options = {}, &block)
default_options = { :css => '', :with_label => true, :label => nil }
options = default_options.merge(options)
html = options[:with_label] ? self.label(options[:label] || name) : ''
html += template.capture(&block) || ''
html += inline_hints_for(name, options) || ''
html += self.errors_on(name) || ''
template.content_tag(:li, template.find_and_preserve(html), :class => "#{options[:css]} #{'error' unless @object.errors[name].empty?}")
end
def inline_errors_on(method, options = nil)
if render_inline_errors?
errors = @object.errors[method.to_sym]
template.content_tag(:span, [*errors].to_sentence.untaint, :class => 'inline-errors') if errors.present?
else
nil
end
end
def normalize_model_name(name)
if name =~ /(.+)\/(.+)/
[$1, $2]
else
super
end
end
end
end

View File

@ -0,0 +1,2 @@
require 'locomotive/routing/default_constraint'
require 'locomotive/routing/site_dispatcher'

View File

@ -1,45 +0,0 @@
class MiscFormBuilder < Formtastic::SemanticFormBuilder
@@all_fields_required_by_default = false
def foldable_inputs(*args, &block)
opts = args.extract_options!
unfolded = !(opts[:class] || '').index('off').nil? || @object.new_record? || !@object.errors.empty?
opts[:class] = (opts[:class] || '') + " inputs foldable #{'folded' unless unfolded}"
args.push(opts)
self.inputs(*args, &block)
end
def custom_input(name, options = {}, &block)
default_options = { :css => '', :with_label => true, :label => nil }
options = default_options.merge(options)
html = options[:with_label] ? self.label(options[:label] || name) : ''
html += template.capture(&block) || ''
html += inline_hints_for(name, options) || ''
html += self.errors_on(name) || ''
template.content_tag(:li, template.find_and_preserve(html), :class => "#{options[:css]} #{'error' unless @object.errors[name].empty?}")
end
def inline_errors_on(method, options = nil)
if render_inline_errors?
errors = @object.errors[method.to_sym]
template.content_tag(:span, [*errors].to_sentence.untaint, :class => 'inline-errors') if errors.present?
else
nil
end
end
def normalize_model_name(name)
if name =~ /(.+)\/(.+)/
[$1, $2]
else
super
end
end
end

View File

@ -2,7 +2,7 @@
/* ___ common ___ */
.box-wrapper { display: none; }
.fancybox-wrapper { display: none; }
#fancybox-inner h2 {
border-bottom:1px dotted #BBBBBD;