best_in_place 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/test_app/Gemfile CHANGED
@@ -1,31 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '3.0.0'
4
-
5
- # Bundle edge Rails instead:
6
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
3
+ gem 'rails', '~> 3.0.0'
7
4
 
8
5
  gem 'sqlite3-ruby', :require => 'sqlite3'
9
6
 
10
7
  gem 'best_in_place', :path => ".."
11
- # Use unicorn as the web server
12
- # gem 'unicorn'
13
-
14
- # Deploy with Capistrano
15
- # gem 'capistrano'
16
-
17
- # To use debugger
18
- # gem 'ruby-debug'
19
-
20
- # Bundle the extra gems:
21
- # gem 'bj'
22
- # gem 'nokogiri'
23
- # gem 'sqlite3-ruby', :require => 'sqlite3'
24
- # gem 'aws-s3', :require => 'aws/s3'
25
-
26
- # Bundle gems for the local environment. Make sure to
27
- # put test-only gems in this group so their generators
28
- # and rake tasks are available in development mode:
29
- # group :development, :test do
30
- # gem 'webrat'
31
- # end
@@ -1,80 +1,87 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- best_in_place (0.1.8)
4
+ best_in_place (0.1.9)
5
5
  rails (~> 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
10
  abstract (1.0.0)
11
- actionmailer (3.0.0)
12
- actionpack (= 3.0.0)
13
- mail (~> 2.2.5)
14
- actionpack (3.0.0)
15
- activemodel (= 3.0.0)
16
- activesupport (= 3.0.0)
11
+ actionmailer (3.0.10)
12
+ actionpack (= 3.0.10)
13
+ mail (~> 2.2.19)
14
+ actionpack (3.0.10)
15
+ activemodel (= 3.0.10)
16
+ activesupport (= 3.0.10)
17
17
  builder (~> 2.1.2)
18
18
  erubis (~> 2.6.6)
19
- i18n (~> 0.4.1)
19
+ i18n (~> 0.5.0)
20
20
  rack (~> 1.2.1)
21
- rack-mount (~> 0.6.12)
22
- rack-test (~> 0.5.4)
21
+ rack-mount (~> 0.6.14)
22
+ rack-test (~> 0.5.7)
23
23
  tzinfo (~> 0.3.23)
24
- activemodel (3.0.0)
25
- activesupport (= 3.0.0)
24
+ activemodel (3.0.10)
25
+ activesupport (= 3.0.10)
26
26
  builder (~> 2.1.2)
27
- i18n (~> 0.4.1)
28
- activerecord (3.0.0)
29
- activemodel (= 3.0.0)
30
- activesupport (= 3.0.0)
31
- arel (~> 1.0.0)
27
+ i18n (~> 0.5.0)
28
+ activerecord (3.0.10)
29
+ activemodel (= 3.0.10)
30
+ activesupport (= 3.0.10)
31
+ arel (~> 2.0.10)
32
32
  tzinfo (~> 0.3.23)
33
- activeresource (3.0.0)
34
- activemodel (= 3.0.0)
35
- activesupport (= 3.0.0)
36
- activesupport (3.0.0)
37
- arel (1.0.1)
38
- activesupport (~> 3.0.0)
33
+ activeresource (3.0.10)
34
+ activemodel (= 3.0.10)
35
+ activesupport (= 3.0.10)
36
+ activesupport (3.0.10)
37
+ arel (2.0.10)
39
38
  builder (2.1.2)
40
39
  erubis (2.6.6)
41
40
  abstract (>= 1.0.0)
42
- i18n (0.4.2)
43
- mail (2.2.7)
41
+ i18n (0.5.0)
42
+ json (1.6.1)
43
+ mail (2.2.19)
44
44
  activesupport (>= 2.3.6)
45
- mime-types
46
- treetop (>= 1.4.5)
45
+ i18n (>= 0.4.0)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
47
48
  mime-types (1.16)
48
- polyglot (0.3.1)
49
- rack (1.2.1)
50
- rack-mount (0.6.13)
49
+ polyglot (0.3.2)
50
+ rack (1.2.4)
51
+ rack-mount (0.6.14)
51
52
  rack (>= 1.0.0)
52
- rack-test (0.5.6)
53
+ rack-test (0.5.7)
53
54
  rack (>= 1.0)
54
- rails (3.0.0)
55
- actionmailer (= 3.0.0)
56
- actionpack (= 3.0.0)
57
- activerecord (= 3.0.0)
58
- activeresource (= 3.0.0)
59
- activesupport (= 3.0.0)
60
- bundler (~> 1.0.0)
61
- railties (= 3.0.0)
62
- railties (3.0.0)
63
- actionpack (= 3.0.0)
64
- activesupport (= 3.0.0)
65
- rake (>= 0.8.4)
66
- thor (~> 0.14.0)
67
- rake (0.8.7)
68
- sqlite3-ruby (1.3.1)
69
- thor (0.14.3)
70
- treetop (1.4.8)
55
+ rails (3.0.10)
56
+ actionmailer (= 3.0.10)
57
+ actionpack (= 3.0.10)
58
+ activerecord (= 3.0.10)
59
+ activeresource (= 3.0.10)
60
+ activesupport (= 3.0.10)
61
+ bundler (~> 1.0)
62
+ railties (= 3.0.10)
63
+ railties (3.0.10)
64
+ actionpack (= 3.0.10)
65
+ activesupport (= 3.0.10)
66
+ rake (>= 0.8.7)
67
+ rdoc (~> 3.4)
68
+ thor (~> 0.14.4)
69
+ rake (0.9.2)
70
+ rdoc (3.11)
71
+ json (~> 1.4)
72
+ sqlite3 (1.3.4)
73
+ sqlite3-ruby (1.3.3)
74
+ sqlite3 (>= 1.3.3)
75
+ thor (0.14.6)
76
+ treetop (1.4.10)
77
+ polyglot
71
78
  polyglot (>= 0.3.1)
72
- tzinfo (0.3.23)
79
+ tzinfo (0.3.30)
73
80
 
74
81
  PLATFORMS
75
82
  ruby
76
83
 
77
84
  DEPENDENCIES
78
85
  best_in_place!
79
- rails (= 3.0.0)
86
+ rails (~> 3.0.0)
80
87
  sqlite3-ruby
@@ -1,4 +1,6 @@
1
1
  class UsersController < ApplicationController
2
+ respond_to :html, :json
3
+
2
4
  # GET /users
3
5
  # GET /users.xml
4
6
  def index
@@ -14,7 +16,7 @@ class UsersController < ApplicationController
14
16
  # GET /users/1.xml
15
17
  def show
16
18
  @user = User.find(params[:id])
17
- @countries = COUNTRIES.map
19
+ @countries = COUNTRIES.to_a
18
20
 
19
21
  respond_to do |format|
20
22
  format.html # show.html.erb
@@ -22,6 +24,11 @@ class UsersController < ApplicationController
22
24
  end
23
25
  end
24
26
 
27
+ def double_init
28
+ @user = User.find(params[:id])
29
+ @countries = COUNTRIES.to_a
30
+ end
31
+
25
32
  # GET /users/new
26
33
  # GET /users/new.xml
27
34
  def new
@@ -81,4 +88,11 @@ class UsersController < ApplicationController
81
88
  format.xml { head :ok }
82
89
  end
83
90
  end
91
+
92
+ def test_respond_with
93
+ @user = User.find(params[:id])
94
+
95
+ @user.update_attributes(params[:user])
96
+ respond_with(@user)
97
+ end
84
98
  end
@@ -0,0 +1,65 @@
1
+ <p>This is a page that initializes best in place two times with testing purposes</p>
2
+ <div id="user_account">
3
+ <h1>User details</h1>
4
+ <%= link_to "Go back to USERS", users_path %>
5
+ <p style="margin-left:48em">Click to edit</p>
6
+ <table>
7
+ <tr>
8
+ <td>Name <a id="editme" href="#">(edit me)</a></td>
9
+ <td id="name">
10
+ <%= best_in_place @user, :name, :type => :input, :activator => "#editme" %>
11
+ </td>
12
+ </tr>
13
+ <tr>
14
+ <td>Last Name</td>
15
+ <td id="last_name">
16
+ <%= best_in_place @user, :last_name, :nil => "Nothing to show", :path => test_respond_with_user_path(@user) %>
17
+ </td>
18
+ </tr>
19
+ <tr>
20
+ <td>Email</td>
21
+ <td id="email">
22
+ <%= best_in_place @user, :email %>
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <td>Address</td>
27
+ <td id="address">
28
+ <%= best_in_place @user, :address %>
29
+ </td>
30
+ </tr>
31
+ <tr>
32
+ <td>ZIP</td>
33
+ <td id="zip">
34
+ <%= best_in_place @user, :zip %>
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <td>Country</td>
39
+ <td id="country">
40
+ <%= best_in_place @user, :country, :type => :select, :collection => @countries %>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td>Receive newsletter?</td>
45
+ <td id="receive_email">
46
+ <%= best_in_place @user, :receive_email, :type => :checkbox, :collection => ["No thanks", "Yes of course"] %>
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td>User description</td>
51
+ <td id="description">
52
+ <%= best_in_place @user, :description, :type => :textarea, :sanitize => false %>
53
+ </td>
54
+ </table>
55
+ <br />
56
+ <hr />
57
+
58
+ </div>
59
+
60
+ <%= javascript_tag do %>
61
+ $(document).ready(function() {
62
+ /* Activating Best In Place */
63
+ jQuery(".best_in_place").best_in_place();
64
+ });
65
+ <% end %>
@@ -6,49 +6,49 @@
6
6
  <table>
7
7
  <tr>
8
8
  <td>Name <a id="editme" href="#">(edit me)</a></td>
9
- <td>
9
+ <td id="name">
10
10
  <%= best_in_place @user, :name, :type => :input, :activator => "#editme" %>
11
11
  </td>
12
12
  </tr>
13
13
  <tr>
14
14
  <td>Last Name</td>
15
- <td>
16
- <%= best_in_place @user, :last_name %>
15
+ <td id="last_name">
16
+ <%= best_in_place @user, :last_name, :nil => "Nothing to show", :path => test_respond_with_user_path(@user) %>
17
17
  </td>
18
18
  </tr>
19
19
  <tr>
20
20
  <td>Email</td>
21
- <td>
22
- <%= best_in_place @user, :email %>
21
+ <td id="email">
22
+ <%= best_in_place @user, :email %>
23
23
  </td>
24
24
  </tr>
25
25
  <tr>
26
26
  <td>Address</td>
27
- <td>
28
- <%= best_in_place @user, :address %>
27
+ <td id="address">
28
+ <%= best_in_place @user, :address %>
29
29
  </td>
30
30
  </tr>
31
31
  <tr>
32
32
  <td>ZIP</td>
33
- <td>
34
- <%= best_in_place @user, :zip %>
33
+ <td id="zip">
34
+ <%= best_in_place @user, :zip %>
35
35
  </td>
36
36
  </tr>
37
37
  <tr>
38
38
  <td>Country</td>
39
- <td>
40
- <%= best_in_place @user, :country, {:type => :select, :collection => @countries} %>
39
+ <td id="country">
40
+ <%= best_in_place @user, :country, :type => :select, :collection => @countries %>
41
41
  </td>
42
42
  </tr>
43
43
  <tr>
44
44
  <td>Receive newsletter?</td>
45
- <td>
46
- <%= best_in_place @user, :receive_email, {:type => :checkbox, :collection => ["No thanks", "Yes of course"]} %>
45
+ <td id="receive_email">
46
+ <%= best_in_place @user, :receive_email, :type => :checkbox, :collection => ["No thanks", "Yes of course"] %>
47
47
  </td>
48
48
  </tr>
49
49
  <tr>
50
50
  <td>User description</td>
51
- <td>
51
+ <td id="description">
52
52
  <%= best_in_place @user, :description, :type => :textarea, :sanitize => false %>
53
53
  </td>
54
54
  </table>
@@ -64,4 +64,4 @@
64
64
  </ul>
65
65
  <p>More information on <a href="http://github.com/bernat/best_in_place">github</a> or <a href="http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/">bernatfarrero.com</a>.</p>
66
66
 
67
- </div>
67
+ </div>
@@ -11,7 +11,6 @@ BipApp::Application.configure do
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
15
14
  config.action_controller.perform_caching = false
16
15
 
17
16
  # Don't care if the mailer can't send
@@ -1 +1 @@
1
- COUNTRIES = { 1, "Spain", 2, "Italy", 3, "Germany", 4, "France" }
1
+ COUNTRIES = { 1 => "Spain", 2 => "Italy", 3 => "Germany", 4 => "France" }
@@ -1,60 +1,10 @@
1
1
  BipApp::Application.routes.draw do
2
- resources :users
2
+ resources :users do
3
+ member do
4
+ put :test_respond_with
5
+ get :double_init
6
+ end
7
+ end
3
8
 
4
- # The priority is based upon order of creation:
5
- # first created -> highest priority.
6
-
7
- # Sample of regular route:
8
- # match 'products/:id' => 'catalog#view'
9
- # Keep in mind you can assign values other than :controller and :action
10
-
11
- # Sample of named route:
12
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13
- # This route can be invoked with purchase_url(:id => product.id)
14
-
15
- # Sample resource route (maps HTTP verbs to controller actions automatically):
16
- # resources :products
17
-
18
- # Sample resource route with options:
19
- # resources :products do
20
- # member do
21
- # get 'short'
22
- # post 'toggle'
23
- # end
24
- #
25
- # collection do
26
- # get 'sold'
27
- # end
28
- # end
29
-
30
- # Sample resource route with sub-resources:
31
- # resources :products do
32
- # resources :comments, :sales
33
- # resource :seller
34
- # end
35
-
36
- # Sample resource route with more complex sub-resources
37
- # resources :products do
38
- # resources :comments
39
- # resources :sales do
40
- # get 'recent', :on => :collection
41
- # end
42
- # end
43
-
44
- # Sample resource route within a namespace:
45
- # namespace :admin do
46
- # # Directs /admin/products/* to Admin::ProductsController
47
- # # (app/controllers/admin/products_controller.rb)
48
- # resources :products
49
- # end
50
-
51
- # You can have the root of your site routed with "root"
52
- # just remember to delete public/index.html.
53
9
  root :to => "users#index"
54
-
55
- # See how all your routes lay out with "rake routes"
56
-
57
- # This is a legacy wild controller route that's not recommended for RESTful applications.
58
- # Note: This route will make all actions in every controller accessible via GET requests.
59
- # match ':controller(/:action(/:id(.:format)))'
60
10
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  # This file is auto-generated from the current state of the database. Instead
2
3
  # of editing this file, please use the migrations feature of Active Record to
3
4
  # incrementally modify your database, and then regenerate this schema definition.
data/test_app/db/seeds.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  # This file should contain all the record creation needed to seed the database with its default values.
2
3
  # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
4
  #
@@ -9,7 +9,7 @@ $(document).ready(function() {
9
9
  function inspect(obj, maxLevels, level)
10
10
  {
11
11
  var str = '', type, msg;
12
- 1
12
+
13
13
  // Start Input Validations
14
14
  // Don't touch, we start iterating at level zero
15
15
  if(level == null) level = 0;
@@ -61,4 +61,4 @@ function inspect(obj, maxLevels, level)
61
61
  container.purr({isSticky:true});
62
62
 
63
63
  return str;
64
- }
64
+ }