Permalink
Browse files

for Rails 3.0.7, conform to app generated by template

  • Loading branch information...
fortuity committed May 24, 2011
1 parent 5a7389c commit 00d2ddcea5a086f4a445865b15e179f6b6063f85
Showing with 103 additions and 79 deletions.
  1. +4 −3 .gitignore
  2. +11 −10 Gemfile
  3. +43 −45 Gemfile.lock
  4. +1 −0 config/application.rb
  5. +10 −13 config/mongoid.yml
  6. +34 −8 public/javascripts/rails.js
View
@@ -2,10 +2,10 @@
# Ignore these files when commiting to a git repository
#
# The original version of this file is found here:
-# https://github.com/fortuity/rails3-gitignore/raw/master/gitignore.txt
+# https://github.com/RailsApps/rails3-application-templates/raw/master/files/gitignore.txt
#
# Corrections? Improvements? Create a GitHub issue:
-# https://github.com/fortuity/rails3-gitignore/issues
+# http://github.com/RailsApps/rails3-application-templates/issues
#----------------------------------------------------------------------------
# bundler state
@@ -61,4 +61,5 @@ tmp/*
# vim artifacts
**.swp
-
+# keep OmniAuth service provider secrets out of the Git repo
+config/initializers/omniauth.rb
View
21 Gemfile
@@ -1,12 +1,13 @@
source 'http://rubygems.org'
gem 'rails', '3.0.7'
-gem "rspec-rails", ">= 2.5.0", :group => [:development, :test]
-gem "database_cleaner", ">= 0.6.7", :group => :test
-gem "mongoid-rspec", ">= 1.4.2", :group => :test
-gem "factory_girl_rails", ">= 1.1.beta1", :group => :test
-gem "cucumber-rails", ">= 0.4.1", :group => :test
-gem "capybara", ">= 0.4.1.2", :group => :test
-gem "launchy", ">= 0.4.0", :group => :test
-gem "bson_ext", ">= 1.3.0"
-gem "mongoid", ">= 2.0.1"
-gem "omniauth", ">= 0.2.4"
+gem "rake", "0.8.7"
+gem "rspec-rails", "2.5.0", :group => [:development, :test]
+gem "database_cleaner", "0.6.7", :group => :test
+gem "mongoid-rspec", "1.4.2", :group => :test
+gem "factory_girl_rails", "1.1.beta1", :group => :test
+gem "cucumber-rails", "0.4.1", :group => :test
+gem "capybara", "0.4.1.2", :group => :test
+gem "launchy", "0.4.0", :group => :test
+gem "bson_ext", "1.3.1"
+gem "mongoid", "2.0.2"
+gem "omniauth", "0.2.6"
View
@@ -29,9 +29,9 @@ GEM
activesupport (= 3.0.7)
activesupport (3.0.7)
addressable (2.2.4)
- arel (2.0.9)
- bson (1.3.0)
- bson_ext (1.3.0)
+ arel (2.0.10)
+ bson (1.3.1)
+ bson_ext (1.3.1)
builder (2.1.2)
capybara (0.4.1.2)
celerity (>= 0.7.9)
@@ -43,13 +43,13 @@ GEM
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3)
celerity (0.8.9)
- childprocess (0.1.8)
+ childprocess (0.1.9)
ffi (~> 1.0.6)
configuration (1.2.0)
- cucumber (0.10.2)
+ cucumber (0.10.3)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (>= 2.3.5)
+ gherkin (>= 2.3.8)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (0.4.1)
@@ -69,9 +69,8 @@ GEM
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
- ffi (1.0.7)
- rake (>= 0.8.7)
- gherkin (2.3.7)
+ ffi (1.0.9)
+ gherkin (2.3.9)
json (>= 1.4.6)
i18n (0.5.0)
json (1.5.1)
@@ -85,61 +84,60 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- mongo (1.3.0)
- bson (>= 1.3.0)
- mongoid (2.0.1)
+ mongo (1.3.1)
+ bson (>= 1.3.1)
+ mongoid (2.0.2)
activemodel (~> 3.0)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
- will_paginate (~> 3.0.pre)
mongoid-rspec (1.4.2)
mongoid (~> 2.0)
rspec (~> 2)
- multi_json (1.0.1)
+ multi_json (1.0.3)
multi_xml (0.2.2)
- multipart-post (1.1.0)
+ multipart-post (1.1.2)
net-ldap (0.2.2)
nokogiri (1.4.4)
- oa-basic (0.2.5)
- oa-core (= 0.2.5)
+ oa-basic (0.2.6)
+ oa-core (= 0.2.6)
rest-client (~> 1.6.0)
- oa-core (0.2.5)
- oa-enterprise (0.2.5)
+ oa-core (0.2.6)
+ oa-enterprise (0.2.6)
addressable (= 2.2.4)
net-ldap (~> 0.2.2)
nokogiri (~> 1.4.2)
- oa-core (= 0.2.5)
+ oa-core (= 0.2.6)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.1.1)
- oa-more (0.2.5)
+ oa-more (0.2.6)
multi_json (~> 1.0.0)
- oa-core (= 0.2.5)
+ oa-core (= 0.2.6)
rest-client (~> 1.6.0)
- oa-oauth (0.2.5)
+ oa-oauth (0.2.6)
faraday (~> 0.6.1)
multi_json (~> 1.0.0)
multi_xml (~> 0.2.2)
- oa-core (= 0.2.5)
+ oa-core (= 0.2.6)
oauth (~> 0.4.0)
oauth2 (~> 0.4.1)
- oa-openid (0.2.5)
- oa-core (= 0.2.5)
+ oa-openid (0.2.6)
+ oa-core (= 0.2.6)
rack-openid (~> 1.3.1)
ruby-openid-apps-discovery (~> 1.2.0)
oauth (0.4.4)
oauth2 (0.4.1)
faraday (~> 0.6.1)
multi_json (>= 0.0.5)
- omniauth (0.2.5)
- oa-basic (= 0.2.5)
- oa-core (= 0.2.5)
- oa-enterprise (= 0.2.5)
- oa-more (= 0.2.5)
- oa-oauth (= 0.2.5)
- oa-openid (= 0.2.5)
+ omniauth (0.2.6)
+ oa-basic (= 0.2.6)
+ oa-core (= 0.2.6)
+ oa-enterprise (= 0.2.6)
+ oa-more (= 0.2.6)
+ oa-oauth (= 0.2.6)
+ oa-openid (= 0.2.6)
polyglot (0.3.1)
pyu-ruby-sasl (0.0.3.2)
- rack (1.2.2)
+ rack (1.2.3)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-openid (1.3.1)
@@ -191,22 +189,22 @@ GEM
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.27)
- will_paginate (3.0.pre2)
xpath (0.1.4)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
- bson_ext (>= 1.3.0)
- capybara (>= 0.4.1.2)
- cucumber-rails (>= 0.4.1)
- database_cleaner (>= 0.6.7)
- factory_girl_rails (>= 1.1.beta1)
- launchy (>= 0.4.0)
- mongoid (>= 2.0.1)
- mongoid-rspec (>= 1.4.2)
- omniauth (>= 0.2.4)
+ bson_ext (= 1.3.1)
+ capybara (= 0.4.1.2)
+ cucumber-rails (= 0.4.1)
+ database_cleaner (= 0.6.7)
+ factory_girl_rails (= 1.1.beta1)
+ launchy (= 0.4.0)
+ mongoid (= 2.0.2)
+ mongoid-rspec (= 1.4.2)
+ omniauth (= 0.2.6)
rails (= 3.0.7)
- rspec-rails (>= 2.5.0)
+ rake (= 0.8.7)
+ rspec-rails (= 2.5.0)
View
@@ -14,6 +14,7 @@
module Rails3MongoidOmniauth
class Application < Rails::Application
+ # don't generate RSpec tests for views and helpers
config.generators do |g|
g.view_specs false
g.helper_specs false
View
@@ -1,23 +1,20 @@
-defaults: &defaults
- host: localhost
- # slaves:
- # - host: slave1.local
- # port: 27018
- # - host: slave2.local
- # port: 27019
-
development:
- <<: *defaults
- database: rails3_mongoid_omniauth_development
+ host: localhost
+ database: testapp_development
test:
- <<: *defaults
- database: rails3_mongoid_omniauth_test
+ host: localhost
+ database: testapp_test
# set these environment variables on your prod server
production:
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
username: <%= ENV['MONGOID_USERNAME'] %>
password: <%= ENV['MONGOID_PASSWORD'] %>
- database: <%= ENV['MONGOID_DATABASE'] %>
+ database: <%= ENV['MONGOID_DATABASE'] %>
+ # slaves:
+ # - host: slave1.local
+ # port: 27018
+ # - host: slave2.local
+ # port: 27019
@@ -82,6 +82,16 @@
return event.result !== false;
},
+ // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
+ confirm: function(message) {
+ return confirm(message);
+ },
+
+ // Default ajax function, may be overridden with custom function in $.rails.ajax
+ ajax: function(options) {
+ return $.ajax(options);
+ },
+
// Submits "remote" forms and links with ajax
handleRemote: function(element) {
var method, url, data,
@@ -102,10 +112,10 @@
} else {
method = element.data('method');
url = element.attr('href');
- data = null;
- }
+ data = element.data('params') || null;
+ }
- $.ajax({
+ rails.ajax({
url: url, type: method || 'GET', data: data, dataType: dataType,
// stopping the "ajax:beforeSend" event will cancel the ajax request
beforeSend: function(xhr, settings) {
@@ -171,11 +181,26 @@
});
},
- // If message provided in 'data-confirm' attribute, fires `confirm` event and returns result of confirm dialog.
- // Attaching a handler to the element's `confirm` event that returns false cancels the confirm dialog.
+ /* For 'data-confirm' attribute:
+ - Fires `confirm` event
+ - Shows the confirmation dialog
+ - Fires the `confirm:complete` event
+
+ Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
+ Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
+ Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
+ return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
+ */
allowAction: function(element) {
- var message = element.data('confirm');
- return !message || (rails.fire(element, 'confirm') && confirm(message));
+ var message = element.data('confirm'),
+ answer = false, callback;
+ if (!message) { return true; }
+
+ if (rails.fire(element, 'confirm')) {
+ answer = rails.confirm(message);
+ callback = rails.fire(element, 'confirm:complete', [answer]);
+ }
+ return answer && callback;
},
// Helper function which checks for blank inputs in a form that match the specified CSS selector
@@ -199,6 +224,7 @@
// Helper function, needed to provide consistent behavior in IE
stopEverything: function(e) {
+ $(e.target).trigger('ujs:everythingStopped');
e.stopImmediatePropagation();
return false;
},
@@ -246,7 +272,7 @@
// skip other logic when required values are missing or file upload is present
if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
- return !remote;
+ return rails.stopEverything(e);
}
if (remote) {

0 comments on commit 00d2ddc

Please sign in to comment.