garlicjs-rails 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/garlicjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/garlic.js +8 -3
- metadata +4 -4
data/README.md
CHANGED
@@ -82,7 +82,7 @@
|
|
82
82
|
this.$element = $( element );
|
83
83
|
this.options = this.getOptions( options );
|
84
84
|
this.storage = storage;
|
85
|
-
this.path = this.getPath();
|
85
|
+
this.path = this.options.getPath( this.$element ) || this.getPath();
|
86
86
|
this.parentForm = this.$element.closest( 'form' );
|
87
87
|
this.$element.addClass('garlic-auto-save');
|
88
88
|
this.expiresFlag = !this.options.expires ? false : ( this.$element.data( 'expires' ) ? this.path : this.getPath( this.parentForm ) ) + '_flag' ;
|
@@ -276,6 +276,10 @@
|
|
276
276
|
elem = this.$element;
|
277
277
|
}
|
278
278
|
|
279
|
+
if ( this.options.getPath( elem ) ) {
|
280
|
+
return this.options.getPath( elem );
|
281
|
+
}
|
282
|
+
|
279
283
|
// Requires one element.
|
280
284
|
if ( elem.length != 1 ) {
|
281
285
|
return false;
|
@@ -404,9 +408,10 @@
|
|
404
408
|
, garlicPriority: true // If form have default data, garlic persisted data will be shown first
|
405
409
|
, template: '<span class="garlic-swap"></span>' // Template used to swap between values if conflict detected
|
406
410
|
, message: 'This is your saved data. Click here to see default one' // Default message for swapping data / state
|
407
|
-
, onConflictDetected: function ( item, storedVal ) { return true; }
|
411
|
+
, onConflictDetected: function ( $item, storedVal ) { return true; } // This function will be triggered if a conflict is detected on an item. Return true if you want Garlic behavior, return false if you want to override it
|
408
412
|
}
|
409
|
-
,
|
413
|
+
, getPath: function ( $item ) {} // Set your own key-storing strategy per field
|
414
|
+
, onRetrieve: function ( $item, storedVal ) {} // This function will be triggered each time Garlic find an retrieve a local stored data for a field
|
410
415
|
}
|
411
416
|
|
412
417
|
/* GARLIC DATA-API
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garlicjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -58,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: '0'
|
59
59
|
segments:
|
60
60
|
- 0
|
61
|
-
hash: -
|
61
|
+
hash: -1326770196954254873
|
62
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
version: '0'
|
68
68
|
segments:
|
69
69
|
- 0
|
70
|
-
hash: -
|
70
|
+
hash: -1326770196954254873
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
73
|
rubygems_version: 1.8.24
|