crest_in_place 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/.rspec +1 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +36 -0
- data/Gemfile +9 -0
- data/README.md +440 -0
- data/Rakefile +8 -0
- data/crest_in_place-2.1.0.gem +0 -0
- data/crest_in_place.gemspec +28 -0
- data/lib/assets/javascripts/best_in_place.js +740 -0
- data/lib/assets/javascripts/best_in_place.purr.js +10 -0
- data/lib/assets/javascripts/jquery.purr.js +135 -0
- data/lib/crest_in_place.rb +12 -0
- data/lib/crest_in_place/check_version.rb +8 -0
- data/lib/crest_in_place/controller_extensions.rb +28 -0
- data/lib/crest_in_place/display_methods.rb +44 -0
- data/lib/crest_in_place/engine.rb +8 -0
- data/lib/crest_in_place/helper.rb +132 -0
- data/lib/crest_in_place/railtie.rb +7 -0
- data/lib/crest_in_place/test_helpers.rb +42 -0
- data/lib/crest_in_place/utils.rb +21 -0
- data/lib/crest_in_place/version.rb +3 -0
- data/spec/helpers/best_in_place_spec.rb +429 -0
- data/spec/integration/double_init_spec.rb +34 -0
- data/spec/integration/js_spec.rb +1041 -0
- data/spec/integration/live_spec.rb +40 -0
- data/spec/integration/text_area_spec.rb +40 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/retry_on_timeout.rb +10 -0
- data/test_app/Gemfile +16 -0
- data/test_app/README +256 -0
- data/test_app/Rakefile +7 -0
- data/test_app/app/assets/images/no.png +0 -0
- data/test_app/app/assets/images/red_pen.png +0 -0
- data/test_app/app/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/test_app/app/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/test_app/app/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/test_app/app/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/test_app/app/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/test_app/app/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test_app/app/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/test_app/app/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/test_app/app/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/test_app/app/assets/images/ui-icons_222222_256x240.png +0 -0
- data/test_app/app/assets/images/ui-icons_228ef1_256x240.png +0 -0
- data/test_app/app/assets/images/ui-icons_ef8c08_256x240.png +0 -0
- data/test_app/app/assets/images/ui-icons_ffd27a_256x240.png +0 -0
- data/test_app/app/assets/images/ui-icons_ffffff_256x240.png +0 -0
- data/test_app/app/assets/images/yes.png +0 -0
- data/test_app/app/assets/javascripts/application.js +35 -0
- data/test_app/app/assets/stylesheets/.gitkeep +0 -0
- data/test_app/app/assets/stylesheets/jquery-ui-1.8.16.custom.css.erb +357 -0
- data/test_app/app/assets/stylesheets/scaffold.css +60 -0
- data/test_app/app/assets/stylesheets/style.css.erb +87 -0
- data/test_app/app/controllers/admin/users_controller.rb +14 -0
- data/test_app/app/controllers/application_controller.rb +3 -0
- data/test_app/app/controllers/cuca/cars_controller.rb +16 -0
- data/test_app/app/controllers/users_controller.rb +99 -0
- data/test_app/app/helpers/application_helper.rb +2 -0
- data/test_app/app/helpers/users_helper.rb +29 -0
- data/test_app/app/models/cuca/car.rb +5 -0
- data/test_app/app/models/user.rb +27 -0
- data/test_app/app/views/admin/users/show.html.erb +20 -0
- data/test_app/app/views/cuca/cars/show.html.erb +13 -0
- data/test_app/app/views/layouts/application.html.erb +14 -0
- data/test_app/app/views/users/_form.html.erb +51 -0
- data/test_app/app/views/users/double_init.html.erb +72 -0
- data/test_app/app/views/users/edit.html.erb +5 -0
- data/test_app/app/views/users/email_field.html.erb +1 -0
- data/test_app/app/views/users/index.html.erb +25 -0
- data/test_app/app/views/users/new.html.erb +5 -0
- data/test_app/app/views/users/show.html.erb +141 -0
- data/test_app/app/views/users/show_ajax.html.erb +12 -0
- data/test_app/config.ru +4 -0
- data/test_app/config/application.rb +51 -0
- data/test_app/config/boot.rb +13 -0
- data/test_app/config/database.yml +22 -0
- data/test_app/config/environment.rb +5 -0
- data/test_app/config/environments/development.rb +25 -0
- data/test_app/config/environments/production.rb +49 -0
- data/test_app/config/environments/test.rb +35 -0
- data/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test_app/config/initializers/countries.rb +1 -0
- data/test_app/config/initializers/default_date_format.rb +2 -0
- data/test_app/config/initializers/inflections.rb +10 -0
- data/test_app/config/initializers/mime_types.rb +5 -0
- data/test_app/config/initializers/secret_token.rb +7 -0
- data/test_app/config/initializers/session_store.rb +8 -0
- data/test_app/config/locales/en.yml +5 -0
- data/test_app/config/routes.rb +20 -0
- data/test_app/db/migrate/20101206205922_create_users.rb +18 -0
- data/test_app/db/migrate/20101212170114_add_receive_email_to_user.rb +9 -0
- data/test_app/db/migrate/20110115204441_add_description_to_user.rb +9 -0
- data/test_app/db/migrate/20111210084202_add_favorite_color_to_users.rb +5 -0
- data/test_app/db/migrate/20111210084251_add_favorite_books_to_users.rb +5 -0
- data/test_app/db/migrate/20111217215935_add_birth_date_to_users.rb +5 -0
- data/test_app/db/migrate/20111224181356_add_money_to_user.rb +5 -0
- data/test_app/db/migrate/20120513003308_create_cars.rb +11 -0
- data/test_app/db/migrate/20120607172609_add_favorite_movie_to_users.rb +5 -0
- data/test_app/db/migrate/20120616170454_add_money_proc_to_users.rb +6 -0
- data/test_app/db/migrate/20120620165212_add_height_to_user.rb +5 -0
- data/test_app/db/migrate/20130213224102_add_favorite_locale_to_users.rb +5 -0
- data/test_app/db/schema.rb +41 -0
- data/test_app/db/seeds.rb +19 -0
- data/test_app/doc/README_FOR_APP +2 -0
- data/test_app/lib/tasks/.gitkeep +0 -0
- data/test_app/lib/tasks/cron.rake +7 -0
- data/test_app/public/404.html +26 -0
- data/test_app/public/422.html +26 -0
- data/test_app/public/500.html +26 -0
- data/test_app/public/favicon.ico +0 -0
- data/test_app/public/robots.txt +5 -0
- data/test_app/script/rails +6 -0
- data/test_app/test/fixtures/users.yml +17 -0
- data/test_app/test/functional/users_controller_test.rb +49 -0
- data/test_app/test/performance/browsing_test.rb +9 -0
- data/test_app/test/test_helper.rb +13 -0
- data/test_app/test/unit/helpers/users_helper_test.rb +4 -0
- data/test_app/test/unit/user_test.rb +8 -0
- data/test_app/vendor/plugins/.gitkeep +0 -0
- metadata +256 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render :template => 'users/show' %>
|
2
|
+
<script>
|
3
|
+
$(document).ready(function () {
|
4
|
+
$('#email').html('');
|
5
|
+
setTimeout( function () { //give time to the other document.ready callbacks to be executed
|
6
|
+
$.get("/users/<%= params[:id]%>/email_field", function(data, status) {
|
7
|
+
$('#email').html(data);
|
8
|
+
});
|
9
|
+
},
|
10
|
+
500);
|
11
|
+
});
|
12
|
+
</script>
|
data/test_app/config.ru
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
if defined?(Bundler)
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
7
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
10
|
+
end
|
11
|
+
|
12
|
+
module BipApp
|
13
|
+
class Application < Rails::Application
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
17
|
+
|
18
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
19
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
20
|
+
|
21
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
22
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
23
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
24
|
+
|
25
|
+
# Activate observers that should always be running.
|
26
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
27
|
+
|
28
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
29
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
30
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
31
|
+
|
32
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
33
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
|
+
# config.i18n.default_locale = :de
|
35
|
+
|
36
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
37
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
38
|
+
|
39
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
40
|
+
config.encoding = "utf-8"
|
41
|
+
|
42
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
43
|
+
config.filter_parameters += [:password]
|
44
|
+
|
45
|
+
# Enable the asset pipeline
|
46
|
+
config.assets.enabled = true
|
47
|
+
|
48
|
+
# Version of your assets, change this if you want to expire all your assets
|
49
|
+
config.assets.version = '1.0'
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Set up gems listed in the Gemfile.
|
4
|
+
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
5
|
+
begin
|
6
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
rescue Bundler::GemNotFound => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Try running `bundle install`."
|
12
|
+
exit!
|
13
|
+
end if File.exist?(gemfile)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,25 @@
|
|
1
|
+
BipApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
BipApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
BipApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1 @@
|
|
1
|
+
COUNTRIES = { 1 => "Spain", 2 => "Italy", 3 => "Germany", 4 => "France" }
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
BipApp::Application.config.secret_token = '757d6525986af9c0cb75690db38ba36fd6c1b6f5badb7f586db2da390e87805099de9f365e4e9ebcbba7e2f5cada3f011d620af4a3610b0b96bb01c10175eb33'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
BipApp::Application.config.session_store :cookie_store, :key => '_bip_app_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rake db:sessions:create")
|
8
|
+
# BipApp::Application.config.session_store :active_record_store
|
@@ -0,0 +1,20 @@
|
|
1
|
+
BipApp::Application.routes.draw do
|
2
|
+
resources :users do
|
3
|
+
member do
|
4
|
+
put :test_respond_with
|
5
|
+
get :double_init
|
6
|
+
get :show_ajax
|
7
|
+
get :email_field
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :cuca do
|
12
|
+
resources :cars
|
13
|
+
end
|
14
|
+
|
15
|
+
namespace :admin do
|
16
|
+
resources :users
|
17
|
+
end
|
18
|
+
|
19
|
+
root :to => "users#index"
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :last_name
|
6
|
+
t.string :address
|
7
|
+
t.string :email, :null => false
|
8
|
+
t.string :zip
|
9
|
+
t.string :country
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
drop_table :users
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20130213224102) do
|
15
|
+
|
16
|
+
create_table "cars", :force => true do |t|
|
17
|
+
t.string "model"
|
18
|
+
end
|
19
|
+
|
20
|
+
create_table "users", :force => true do |t|
|
21
|
+
t.string "name"
|
22
|
+
t.string "last_name"
|
23
|
+
t.string "address"
|
24
|
+
t.string "email", :null => false
|
25
|
+
t.string "zip"
|
26
|
+
t.string "country"
|
27
|
+
t.datetime "created_at", :null => false
|
28
|
+
t.datetime "updated_at", :null => false
|
29
|
+
t.boolean "receive_email"
|
30
|
+
t.text "description"
|
31
|
+
t.string "favorite_color"
|
32
|
+
t.text "favorite_books"
|
33
|
+
t.datetime "birth_date"
|
34
|
+
t.float "money"
|
35
|
+
t.float "money_proc"
|
36
|
+
t.string "height"
|
37
|
+
t.string "favorite_movie"
|
38
|
+
t.string "favorite_locale"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|