e9_polls 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/poll.rb +5 -0
- data/app/views/e9_polls/polls/_form.html.haml +5 -0
- data/app/views/e9_polls/polls/_poll.html.haml +4 -1
- data/lib/e9_polls/version.rb +1 -1
- data/lib/generators/e9_polls/templates/javascript.js +7 -7
- data/lib/generators/e9_polls/templates/stylesheet.css +2 -1
- metadata +2 -2
data/app/models/poll.rb
CHANGED
@@ -9,6 +9,11 @@
|
|
9
9
|
= f.label :template, nil, :class => :req
|
10
10
|
= f.text_field :template
|
11
11
|
|
12
|
+
= f.fields_for f.object.options do |ff|
|
13
|
+
.field
|
14
|
+
= ff.label :header, nil
|
15
|
+
= ff.text_field :header
|
16
|
+
|
12
17
|
%fieldset.poll-answers.nested-associations
|
13
18
|
%legend= f.label(:poll_answers)
|
14
19
|
.fields
|
@@ -1,7 +1,10 @@
|
|
1
1
|
.e9-poll{:"data-votes" => poll.votes}
|
2
|
+
- if poll.options.header.present?
|
3
|
+
.poll-header
|
4
|
+
= poll.options.header
|
5
|
+
|
2
6
|
.poll-question
|
3
7
|
= poll.question
|
4
|
-
|
5
8
|
.poll-answers
|
6
9
|
- if poll_answered?(poll)
|
7
10
|
= render(:partial => 'e9_polls/polls/results_inner', :locals => { :poll => poll })
|
data/lib/e9_polls/version.rb
CHANGED
@@ -4,25 +4,25 @@
|
|
4
4
|
width: '35%',
|
5
5
|
height: '50%',
|
6
6
|
onComplete: function() {
|
7
|
-
$('#cboxLoadedContent div.poll-question')
|
8
|
-
|
9
|
-
|
10
|
-
});
|
7
|
+
$('#cboxLoadedContent div.poll-question').replaceWith(function(i, content) {
|
8
|
+
return "<h1>" + content + "</h1>";
|
9
|
+
});
|
11
10
|
}
|
12
11
|
});
|
13
12
|
|
14
|
-
$('.renderable.poll form').live('
|
13
|
+
$('.renderable.poll form #poll_submit').live('click', function(e) {
|
15
14
|
e.preventDefault();
|
16
|
-
|
15
|
+
|
16
|
+
var el = $(this).closest('form');
|
17
17
|
|
18
18
|
// return if no selection
|
19
19
|
if (!$("input[@name='poll[vote]']:checked").val()) return;
|
20
20
|
|
21
21
|
$.ajax({
|
22
22
|
url: el.attr('action'),
|
23
|
-
data: el.serializeArray(),
|
24
23
|
dataType: 'json',
|
25
24
|
type: 'POST',
|
25
|
+
data: el.serializeArray(),
|
26
26
|
success: function(data, status, xhr) {
|
27
27
|
el.closest('.renderable.poll').html(data.html);
|
28
28
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
.e9-poll { }
|
2
|
-
.poll-question { font-size: large;
|
2
|
+
.poll-header, .poll-question { font-size: large; padding: 0 1.2em; }
|
3
|
+
.poll-header { font-weight: bold; }
|
3
4
|
.poll-answers { padding: 0 1.2em; margin-bottom: 1em; }
|
4
5
|
.poll-answer-bar { height: 15px; display: block; }
|
5
6
|
.poll-answer-bar-outer { display: block; background-color: #eee; }
|
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.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Travis Cox
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-28 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|