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 CHANGED
@@ -1,5 +1,10 @@
1
1
  class Poll < ::Renderable
2
2
  include E9Polls::Model
3
+ include E9Rails::ActiveRecord::InheritableOptions
4
+
5
+ self.options_parameters = [
6
+ :header_text
7
+ ]
3
8
 
4
9
  has_many :poll_answers
5
10
 
@@ -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 })
@@ -1,3 +1,3 @@
1
1
  module E9Polls
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
@@ -4,25 +4,25 @@
4
4
  width: '35%',
5
5
  height: '50%',
6
6
  onComplete: function() {
7
- $('#cboxLoadedContent div.poll-question')
8
- .replaceWith(function(i, content) {
9
- return "<h1>" + content + "</h1>";
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('submit', function(e) {
13
+ $('.renderable.poll form #poll_submit').live('click', function(e) {
15
14
  e.preventDefault();
16
- var el = $(this);
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; font-weight: bold; padding: 0 1.2em; }
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.4
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-05-02 00:00:00 -04:00
13
+ date: 2011-07-28 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16