edit_mode 1.0.3 → 1.0.4

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: b8c8da9af88f71e7c611d676721fdc74bccd79b0
4
- data.tar.gz: c890638b27883a0afd1d16d7b86d2ca3f71e5a4a
3
+ metadata.gz: f7f81a093fd36e4bae5eb58771304b06a4f71110
4
+ data.tar.gz: 5859513add131f4424f3cc4f0dad37737a552f15
5
5
  SHA512:
6
- metadata.gz: d32d9e17d1bae533428cde75ba6ffb10e3895faf5cede22bf2142a3fa18abc582f79253c7754ac062897b850b607f7cb21b4151b1dec67cca2b4da7c348799ad
7
- data.tar.gz: 9a574ca2380631d544283ad97d22323e2288fc30fc126f959a4c88e4eac9947742d57afcca9e7346dcdcad248e0487a18cc891aa0b475c37fc016df2b0fc987f
6
+ metadata.gz: e768f992eff2cc2aa237bc3f5933dba8db660ec0f42dc2a0934ea2429b94e759d63a8ed0b6345c8eb4e8bfdaf129d73a395191730542c5f923e727f53203057e
7
+ data.tar.gz: ee82b068817b59deca80072e97a2f35870c0adc204f8a9e76af34c3e3df2a2a26afe4633d58723ac8398014265de2711b3ed8cb2f50a8eb7e609050913a624d8
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- edit_mode (1.0.3)
12
+ edit_mode (1.0.4)
13
13
  jquery-rails
14
14
  jquery-turbolinks
15
15
  rails (>= 3.2)
@@ -207,4 +207,4 @@ DEPENDENCIES
207
207
  therubyracer
208
208
 
209
209
  BUNDLED WITH
210
- 1.15.2
210
+ 1.15.4
@@ -1,4 +1,17 @@
1
- ready = ->
1
+ old_value = (best_in_place)->
2
+ if best_in_place.data('bip-original-content')?
3
+ best_in_place.data('bip-original-content')
4
+ else
5
+ null
6
+
7
+ new_value = (best_in_place)->
8
+ v = best_in_place.find('input').val() if best_in_place.find('input').length > 0
9
+ v = best_in_place.find('textarea').text() if best_in_place.find('textarea').length > 0
10
+ v = best_in_place.find('select').find(":selected").text() if best_in_place.find('select').length > 0
11
+ v = null if v == ""
12
+ return v
13
+
14
+ $(document).ready ->
2
15
 
3
16
  jQuery.fn.apply_best_in_place = ->
4
17
  this.best_in_place()
@@ -20,7 +33,10 @@ ready = ->
20
33
  )
21
34
  .unbind("save")
22
35
  .bind( "save", (e) ->
23
- $( this ).data( 'bestInPlaceEditor' ).update()
36
+ if String(old_value($(this))) != String(new_value($(this)))
37
+ $(this).data('bestInPlaceEditor').update()
38
+ else
39
+ $(this).data('bestInPlaceEditor').abort()
24
40
  e.stopPropagation()
25
41
  )
26
42
  return this
@@ -34,4 +50,3 @@ ready = ->
34
50
  unless $( event.target ).is( "textarea" )
35
51
  $( this ).closest( ".edit_mode_group" ).trigger( "save" )
36
52
 
37
- $(document).ready(ready)
@@ -1,3 +1,3 @@
1
1
  module EditMode
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
data/test_app/README.md CHANGED
@@ -1 +1 @@
1
- ../README.md
1
+ test_app/../README.md
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Fiedlschuster
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-24 00:00:00.000000000 Z
11
+ date: 2017-09-01 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.5.1
239
+ rubygems_version: 2.6.12
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.