e9_polls 1.0.1 → 1.0.2
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/lib/e9_polls/version.rb +1 -1
- data/lib/e9_polls.rb +1 -0
- metadata +1 -2
- data/e9_polls.js +0 -44
data/lib/e9_polls/version.rb
CHANGED
data/lib/e9_polls.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: e9_polls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Travis Cox
|
@@ -82,7 +82,6 @@ files:
|
|
82
82
|
- config/locales/en.yml
|
83
83
|
- config/routes.rb
|
84
84
|
- e9_polls.gemspec
|
85
|
-
- e9_polls.js
|
86
85
|
- lib/e9_polls.rb
|
87
86
|
- lib/e9_polls/global_helper.rb
|
88
87
|
- lib/e9_polls/model.rb
|
data/e9_polls.js
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
;jQuery(function($) {
|
2
|
-
var selector_prefix = 'body.controller-e9-polls-polls',
|
3
|
-
$selector = $(selector_prefix);
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Adds a new nested assocation. Depends on the nested association
|
7
|
-
* js templates being loaded.
|
8
|
-
*/
|
9
|
-
$('a.add-nested-association').click(function(e) {
|
10
|
-
e.preventDefault();
|
11
|
-
|
12
|
-
var $this = $(this),
|
13
|
-
$parent = $this.closest('.nested-associations'),
|
14
|
-
obj,
|
15
|
-
template,
|
16
|
-
index;
|
17
|
-
|
18
|
-
try {
|
19
|
-
obj = TEMPLATES[this.getAttribute('data-association')];
|
20
|
-
} catch(e) { return }
|
21
|
-
|
22
|
-
template = obj.template.replace(new RegExp(obj.index++, 'g'), obj.index);
|
23
|
-
|
24
|
-
$(template).appendTo($parent);
|
25
|
-
});
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Effectively destroys an added nested association, removing the container
|
29
|
-
* the association is not persisted, or hiding it and setting the _destroy
|
30
|
-
* parameter for the association if it is.
|
31
|
-
*/
|
32
|
-
$('a.destroy-nested-association').live('click', function(e) {
|
33
|
-
e.preventDefault();
|
34
|
-
|
35
|
-
var $parent = $(this).closest('.nested-association').hide(),
|
36
|
-
$destro = $parent.find('input[id$=__destroy]');
|
37
|
-
|
38
|
-
if ($destro.length) {
|
39
|
-
$destro.val('1');
|
40
|
-
} else {
|
41
|
-
$parent.remove();
|
42
|
-
}
|
43
|
-
});
|
44
|
-
});
|