radiant-polls-extension 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGELOG +27 -0
  2. data/HELP.textile +71 -0
  3. data/LICENSE +21 -0
  4. data/README.textile +112 -0
  5. data/Rakefile +129 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/admin/polls_controller.rb +25 -0
  8. data/app/controllers/poll_response_controller.rb +35 -0
  9. data/app/models/option.rb +22 -0
  10. data/app/models/poll.rb +67 -0
  11. data/app/views/admin/polls/_form.html.haml +67 -0
  12. data/app/views/admin/polls/_option.html.haml +9 -0
  13. data/app/views/admin/polls/edit.html.haml +5 -0
  14. data/app/views/admin/polls/index.html.haml +72 -0
  15. data/app/views/admin/polls/new.html.haml +5 -0
  16. data/app/views/admin/polls/remove.html.haml +17 -0
  17. data/config/locales/en.yml +25 -0
  18. data/config/locales/en_available_tags.yml +187 -0
  19. data/config/routes.rb +6 -0
  20. data/db/migrate/001_create_polls.rb +12 -0
  21. data/db/migrate/002_create_options.rb +14 -0
  22. data/db/migrate/003_add_start_date_to_polls.rb +9 -0
  23. data/lib/poll_process.rb +23 -0
  24. data/lib/poll_tags.rb +408 -0
  25. data/lib/tasks/polls_extension_tasks.rake +56 -0
  26. data/polls_extension.rb +51 -0
  27. data/public/images/admin/new-poll.png +0 -0
  28. data/public/images/admin/poll.png +0 -0
  29. data/public/images/admin/recycle.png +0 -0
  30. data/public/images/admin/reset.png +0 -0
  31. data/public/javascripts/admin/date_selector.js +177 -0
  32. data/public/javascripts/admin/polls.js +47 -0
  33. data/public/javascripts/poll_check.js +52 -0
  34. data/public/stylesheets/admin/polls.css +93 -0
  35. data/public/stylesheets/polls.css +9 -0
  36. data/radiant-polls-extension.gemspec +83 -0
  37. data/spec/controllers/admin/polls_controller_spec.rb +16 -0
  38. data/spec/controllers/poll_response_controller_spec.rb +149 -0
  39. data/spec/integration/page_caching_spec.rb +76 -0
  40. data/spec/lib/poll_tags_spec.rb +415 -0
  41. data/spec/models/poll_spec.rb +50 -0
  42. data/spec/spec.opts +6 -0
  43. data/spec/spec_helper.rb +42 -0
  44. metadata +141 -0
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ describe Poll do
4
+ before(:each) do
5
+ @poll = Poll.new(:title => 'Poll',
6
+ :start_date => Date.today,
7
+ :options => [ Option.new(:title => 'One'),
8
+ Option.new(:title => 'Two') ])
9
+ end
10
+
11
+ it 'should be valid' do
12
+ @poll.should be_valid
13
+ end
14
+
15
+ context 'validations' do
16
+
17
+ it 'should require a title' do
18
+ @poll.title = nil
19
+ @poll.should_not be_valid
20
+ @poll.errors.on(:title) == I18n.t('activerecord.errors.messages.blank')
21
+ end
22
+
23
+ it 'should not require a start date' do
24
+ @poll.start_date = nil
25
+ @poll.should be_valid
26
+ end
27
+
28
+ it 'should not accept a duplicate title' do
29
+ @poll.save
30
+ poll = Poll.new(:title => 'Poll',
31
+ :start_date => Date.today + 1.week,
32
+ :options => [ Option.new(:title => 'True'),
33
+ Option.new(:title => 'False') ])
34
+ poll.should_not be_valid
35
+ poll.errors.on(:title) == I18n.t('activerecord.errors.messages.taken')
36
+ end
37
+
38
+ it 'should not accept a duplicate start date' do
39
+ @poll.save
40
+ poll = Poll.new(:title => 'New Poll',
41
+ :start_date => Date.today,
42
+ :options => [ Option.new(:title => 'True'),
43
+ Option.new(:title => 'False') ])
44
+ poll.should_not be_valid
45
+ poll.errors.on(:start_time) == I18n.t('activerecord.errors.messages.taken')
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
@@ -0,0 +1,42 @@
1
+ unless defined? RADIANT_ROOT
2
+ ENV["RAILS_ENV"] = "test"
3
+ case
4
+ when ENV["RADIANT_ENV_FILE"]
5
+ require ENV["RADIANT_ENV_FILE"]
6
+ when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
7
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
8
+ else
9
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
10
+ end
11
+ end
12
+ require "#{RADIANT_ROOT}/spec/spec_helper"
13
+
14
+ Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
15
+ # Include any datasets from loaded extensions
16
+ Radiant::Extension.descendants.each do |extension|
17
+ if File.directory?(extension.root + "/spec/datasets")
18
+ Dataset::Resolver.default << (extension.root + "/spec/datasets")
19
+ end
20
+ end
21
+
22
+ if File.directory?(File.dirname(__FILE__) + "/matchers")
23
+ Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
24
+ end
25
+
26
+ Spec::Runner.configure do |config|
27
+ # config.use_transactional_fixtures = true
28
+ # config.use_instantiated_fixtures = false
29
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures'
30
+
31
+ # You can declare fixtures for each behaviour like this:
32
+ # describe "...." do
33
+ # fixtures :table_a, :table_b
34
+ #
35
+ # Alternatively, if you prefer to declare them only once, you can
36
+ # do so here, like so ...
37
+ #
38
+ # config.global_fixtures = :table_a, :table_b
39
+ #
40
+ # If you declare global fixtures, be aware that they will be declared
41
+ # for all of your examples, even those that don't use them.
42
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiant-polls-extension
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Chase James
14
+ - David Cato
15
+ - Andrew vonderLuft
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2013-02-27 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 1
32
+ - 1
33
+ - 3
34
+ version: 1.1.3
35
+ type: :runtime
36
+ name: radiant
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 2
50
+ version: 1.0.2
51
+ type: :runtime
52
+ name: radiant-cache_by_page-extension
53
+ version_requirements: *id002
54
+ description: Enables polls on pages. Uses cookies instead of sessions
55
+ email: avonderluft@avlux.net
56
+ executables: []
57
+
58
+ extensions: []
59
+
60
+ extra_rdoc_files:
61
+ - LICENSE
62
+ - README.textile
63
+ files:
64
+ - CHANGELOG
65
+ - HELP.textile
66
+ - LICENSE
67
+ - README.textile
68
+ - Rakefile
69
+ - VERSION
70
+ - app/controllers/admin/polls_controller.rb
71
+ - app/controllers/poll_response_controller.rb
72
+ - app/models/option.rb
73
+ - app/models/poll.rb
74
+ - app/views/admin/polls/_form.html.haml
75
+ - app/views/admin/polls/_option.html.haml
76
+ - app/views/admin/polls/edit.html.haml
77
+ - app/views/admin/polls/index.html.haml
78
+ - app/views/admin/polls/new.html.haml
79
+ - app/views/admin/polls/remove.html.haml
80
+ - config/locales/en.yml
81
+ - config/locales/en_available_tags.yml
82
+ - config/routes.rb
83
+ - db/migrate/001_create_polls.rb
84
+ - db/migrate/002_create_options.rb
85
+ - db/migrate/003_add_start_date_to_polls.rb
86
+ - lib/poll_process.rb
87
+ - lib/poll_tags.rb
88
+ - lib/tasks/polls_extension_tasks.rake
89
+ - polls_extension.rb
90
+ - public/images/admin/new-poll.png
91
+ - public/images/admin/poll.png
92
+ - public/images/admin/recycle.png
93
+ - public/images/admin/reset.png
94
+ - public/javascripts/admin/date_selector.js
95
+ - public/javascripts/admin/polls.js
96
+ - public/javascripts/poll_check.js
97
+ - public/stylesheets/admin/polls.css
98
+ - public/stylesheets/polls.css
99
+ - radiant-polls-extension.gemspec
100
+ - spec/controllers/admin/polls_controller_spec.rb
101
+ - spec/controllers/poll_response_controller_spec.rb
102
+ - spec/integration/page_caching_spec.rb
103
+ - spec/lib/poll_tags_spec.rb
104
+ - spec/models/poll_spec.rb
105
+ - spec/spec.opts
106
+ - spec/spec_helper.rb
107
+ homepage: https://github.com/avonderluft/radiant-polls-extension
108
+ licenses: []
109
+
110
+ post_install_message:
111
+ rdoc_options: []
112
+
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ requirements: []
134
+
135
+ rubyforge_project:
136
+ rubygems_version: 1.8.24
137
+ signing_key:
138
+ specification_version: 3
139
+ summary: Polls Extension for Radiant CMS
140
+ test_files: []
141
+