edit_mode 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 991ce0ccecb0a6a2e1fe3c4b89beafd161aefd55
4
- data.tar.gz: af088d26b02ae13dcdbcdf9c9177b85cbb01a69f
3
+ metadata.gz: e991c6ba65550a2509c7893bbfd55d7a44851ecc
4
+ data.tar.gz: 0add910a65b79645005eded01a224d3dc893a604
5
5
  SHA512:
6
- metadata.gz: 46b5159359661938f826158c56a974fe3c679367ddf15810b99073b37ab71011a65fe12a0957a976f76c61ed33924f68453ec0db6646f290a9652a6aec3707c4
7
- data.tar.gz: d252d3d2e97f74953de2c0a54d6df9aa3dd8dac6a19812483a326b770a1594967928ad43de85293d629f056ae215b8500bdae0d9d3827cefb1ca93aaf95e0a15
6
+ metadata.gz: 631103c22235104b9eb1a383ab6f5d6e597b7c46127ad15396646aeceab7a45ec92aa3603e14cd1dea2c05efec4116237cede0bf9500bbfb79c5e66d83f53326
7
+ data.tar.gz: f74c522bca1d7074ac97b4e8f9b86fbf0755cd4454ee5da68d09fe42aa5a7f0d9f50e11957bfd4d6f479938d95fa5dcf776efef3bfaf2bcbc600d222a85ebbd3
data/Gemfile CHANGED
@@ -31,5 +31,7 @@ gem 'jquery-rails', '>=2.2.0'
31
31
  gem 'jquery-ui-rails'
32
32
 
33
33
  gem 'coffee-rails'
34
- gem 'sqlite3'
35
- gem 'launchy'
34
+ gem 'sqlite3', '>= 1.3.10'
35
+ gem 'launchy'
36
+
37
+ gem 'eventmachine', '>= 1.0.7'
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- edit_mode (1.0.1)
12
+ edit_mode (1.0.2)
13
13
  jquery-rails
14
14
  jquery-turbolinks
15
15
  rails (>= 3.2)
@@ -65,7 +65,7 @@ GEM
65
65
  coffee-script-source (1.6.3)
66
66
  diff-lcs (1.1.3)
67
67
  erubis (2.7.0)
68
- eventmachine (1.0.3)
68
+ eventmachine (1.0.7)
69
69
  execjs (2.0.2)
70
70
  faye-websocket (0.4.7)
71
71
  eventmachine (>= 0.12.0)
@@ -161,7 +161,7 @@ GEM
161
161
  multi_json (~> 1.0)
162
162
  rack (~> 1.0)
163
163
  tilt (~> 1.1, != 1.3.0)
164
- sqlite3 (1.3.8)
164
+ sqlite3 (1.3.10)
165
165
  therubyracer (0.12.0)
166
166
  libv8 (~> 3.16.14.0)
167
167
  ref
@@ -170,7 +170,7 @@ GEM
170
170
  treetop (1.4.15)
171
171
  polyglot
172
172
  polyglot (>= 0.3.1)
173
- turbolinks (2.5.2)
173
+ turbolinks (2.5.3)
174
174
  coffee-rails
175
175
  tzinfo (0.3.38)
176
176
  websocket (1.0.7)
@@ -185,6 +185,7 @@ DEPENDENCIES
185
185
  capybara (= 1.1.2)
186
186
  coffee-rails
187
187
  edit_mode!
188
+ eventmachine (>= 1.0.7)
188
189
  execjs
189
190
  guard (= 1.0.1)
190
191
  guard-rspec (= 0.5.5)
@@ -200,5 +201,5 @@ DEPENDENCIES
200
201
  rspec-mocks
201
202
  rspec-rails (= 2.10.0)
202
203
  sass-rails
203
- sqlite3
204
+ sqlite3 (>= 1.3.10)
204
205
  therubyracer
@@ -3,6 +3,7 @@ ready = ->
3
3
  jQuery.fn.apply_best_in_place = ->
4
4
  this.best_in_place()
5
5
  .addClass( "editable ")
6
+ .unbind("edit")
6
7
  .bind( "edit", (e) ->
7
8
  $( this ).data( 'bestInPlaceEditor' ).activate()
8
9
  $( this ).find( "*" ).unbind( 'blur' )
@@ -12,10 +13,12 @@ ready = ->
12
13
  .bind( 'keyup', keyUpHandler )
13
14
  e.stopPropagation()
14
15
  )
16
+ .unbind("cancel")
15
17
  .bind( "cancel", (e) ->
16
18
  $( this ).data( 'bestInPlaceEditor' ).abort()
17
19
  e.stopPropagation()
18
20
  )
21
+ .unbind("save")
19
22
  .bind( "save", (e) ->
20
23
  $( this ).data( 'bestInPlaceEditor' ).update()
21
24
  e.stopPropagation()
@@ -1,54 +1,50 @@
1
1
 
2
- ready = ->
2
+ # The <span class="edit_mode_group"></span> elements receive 'edit', 'save' and 'cancel' events,
3
+ # when the user clicks the corresponding buttons '.edit_button', '.save_button' or '.cancel_button'.
4
+ # The edit_mode_group has to pass these events down to the contained .editable elements.
3
5
 
4
- # The <span class="edit_mode_group"></span> elements receive 'edit', 'save' and 'cancel' events,
5
- # when the user clicks the corresponding buttons '.edit_button', '.save_button' or '.cancel_button'.
6
- # The edit_mode_group has to pass these events down to the contained .editable elements.
6
+ $( document ).on( "edit", ".edit_mode_group", (e) ->
7
7
 
8
- $( document ).on( "edit", ".edit_mode_group", (e) ->
8
+ unless $( this ).hasClass( "currently_in_edit_mode" )
9
+ $( this ).addClass( "currently_in_edit_mode" )
9
10
 
10
- unless $( this ).hasClass( "currently_in_edit_mode" )
11
- $( this ).addClass( "currently_in_edit_mode" )
11
+ $( $( this ).find( ".editable" ).get().reverse() ).each ->
12
+ $( this ).trigger( "edit" )
12
13
 
13
- $( $( this ).find( ".editable" ).get().reverse() ).each ->
14
- $( this ).trigger( "edit" )
14
+ )
15
15
 
16
- )
16
+ $( document ).on( "save", ".edit_mode_group", ->
17
17
 
18
- $( document ).on( "save", ".edit_mode_group", ->
18
+ if $( this ).hasClass( "currently_in_edit_mode" )
19
+ $( this ).removeClass( "currently_in_edit_mode" )
19
20
 
20
- if $( this ).hasClass( "currently_in_edit_mode" )
21
- $( this ).removeClass( "currently_in_edit_mode" )
21
+ edit_mode_group = $( this )
22
+ button_effect( $( this ).find( ".save_button" ), ->
23
+ edit_mode_group.find( ".editable" ).trigger( "save" )
24
+ )
22
25
 
23
- edit_mode_group = $( this )
24
- button_effect( $( this ).find( ".save_button" ), ->
25
- edit_mode_group.find( ".editable" ).trigger( "save" )
26
- )
27
-
28
- )
26
+ )
29
27
 
30
- $( document ).on( "cancel", ".edit_mode_group", ->
28
+ $( document ).on( "cancel", ".edit_mode_group", ->
31
29
 
32
- if $( this ).hasClass( "currently_in_edit_mode" )
33
- $( this ).removeClass( "currently_in_edit_mode" )
30
+ if $( this ).hasClass( "currently_in_edit_mode" )
31
+ $( this ).removeClass( "currently_in_edit_mode" )
34
32
 
35
- edit_mode_group = $( this )
36
- cancel_button = $( this ).find( ".cancel_button" )
37
-
38
- # if there is a cancel button, animate it and then cancel all elements.
39
- if cancel_button.size() > 0
40
- button_effect( cancel_button, ->
41
- edit_mode_group.find( ".editable" ).trigger( "cancel" )
42
- )
43
-
44
- # if no cancel button exists, just trigger each element's cancel event.
45
- else
33
+ edit_mode_group = $( this )
34
+ cancel_button = $( this ).find( ".cancel_button" )
35
+
36
+ # if there is a cancel button, animate it and then cancel all elements.
37
+ if cancel_button.size() > 0
38
+ button_effect( cancel_button, ->
46
39
  edit_mode_group.find( ".editable" ).trigger( "cancel" )
40
+ )
41
+
42
+ # if no cancel button exists, just trigger each element's cancel event.
43
+ else
44
+ edit_mode_group.find( ".editable" ).trigger( "cancel" )
47
45
 
48
- )
49
-
50
- button_effect = ( button, callback ) ->
51
- button.effect( "pulsate", { times: 2 }, "fast", callback )
46
+ )
52
47
 
48
+ button_effect = ( button, callback ) ->
49
+ button.effect( "pulsate", { times: 2 }, "fast", callback )
53
50
 
54
- $(document).ready(ready)
@@ -1,31 +1,29 @@
1
1
 
2
- ready = ->
3
2
 
4
- # The <span class="edit_mode_group"></span> elements should be modal when in edit mode.
5
- # That means that everything else should be greyed out.
6
- # If the user clicks on the shaded (grey) area outside, the edit_mode_group is saved.
3
+ # The <span class="edit_mode_group"></span> elements should be modal when in edit mode.
4
+ # That means that everything else should be greyed out.
5
+ # If the user clicks on the shaded (grey) area outside, the edit_mode_group is saved.
7
6
 
8
- $( document ).on( "edit", ".edit_mode_group", ->
9
- if $( document ).find( ".edit-mode-modal" ).size() == 0
10
- #unless $( this ).hasClass( "edit-mode-modal" )
11
- modal_edit_mode_group = $( this )
12
- $( this ).addClass( "edit-mode-modal" )
13
- $( "body" ).append( "<div class='edit-mode-modal-bg'></div>" )
14
- $( "div.edit-mode-modal-bg" ).hide().fadeIn().click( ->
15
- modal_edit_mode_group.trigger( "save" )
16
- )
17
- )
7
+ $( document ).on( "edit", ".edit_mode_group", ->
8
+ if $( document ).find( ".edit-mode-modal" ).size() == 0
9
+ #unless $( this ).hasClass( "edit-mode-modal" )
10
+ modal_edit_mode_group = $( this )
11
+ $( this ).addClass( "edit-mode-modal" )
12
+ $( "body" ).append( "<div class='edit-mode-modal-bg'></div>" )
13
+ $( "div.edit-mode-modal-bg" ).hide().fadeIn().click( ->
14
+ modal_edit_mode_group.trigger( "save" )
15
+ )
16
+ )
18
17
 
19
- $( document ).on( "save cancel", ".edit_mode_group", ->
20
- if $( this ).hasClass( "edit-mode-modal" )
21
- unless $( this ).hasClass( "animating" )
22
- $( this ).addClass( "animating" )
23
- setTimeout( ->
24
- $( "div.edit-mode-modal-bg" ).fadeOut( ->
25
- $( this ).remove()
26
- $( ".edit-mode-modal" ).removeClass( "edit-mode-modal animating" )
27
- )
28
- , 300 )
29
- )
18
+ $( document ).on( "save cancel", ".edit_mode_group", ->
19
+ if $( this ).hasClass( "edit-mode-modal" )
20
+ unless $( this ).hasClass( "animating" )
21
+ $( this ).addClass( "animating" )
22
+ setTimeout( ->
23
+ $( "div.edit-mode-modal-bg" ).fadeOut( ->
24
+ $( this ).remove()
25
+ $( ".edit-mode-modal" ).removeClass( "edit-mode-modal animating" )
26
+ )
27
+ , 300 )
28
+ )
30
29
 
31
- $(document).ready(ready)
@@ -11,15 +11,15 @@ ready = ->
11
11
  this.find( ".edit_button" ).addClass( "do_not_show_in_edit_mode editable" )
12
12
 
13
13
  # The buttons trigger the correspondig events of the surrounding edit_mode_group.
14
- this.on( "click", ".edit_button", (e) ->
14
+ this.off("click", ".edit_button").on("click", ".edit_button", (e) ->
15
15
  $( this ).closest( ".edit_mode_group" ).trigger( "edit" )
16
16
  e.preventDefault()
17
17
  )
18
- this.on( "click", ".save_button", (e) ->
18
+ this.off("click", ".save_button").on("click", ".save_button", (e) ->
19
19
  $( this ).closest( ".edit_mode_group" ).trigger( "save" )
20
20
  e.preventDefault()
21
21
  )
22
- this.on( "click", ".cancel_button", (e) ->
22
+ this.off("click", ".cancel_button").on("click", ".cancel_button", (e) ->
23
23
  $( this ).closest( ".edit_mode_group" ).trigger( "cancel" )
24
24
  e.preventDefault()
25
25
  )
@@ -1,3 +1,3 @@
1
1
  module EditMode
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edit_mode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Fiedlschuster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  version: '0'
237
237
  requirements: []
238
238
  rubyforge_project:
239
- rubygems_version: 2.2.2
239
+ rubygems_version: 2.4.5
240
240
  signing_key:
241
241
  specification_version: 4
242
242
  summary: Toggle an edit mode on a show view. Think of it as a grouped in-place editing.