commontator 0.1.46

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.
Files changed (156) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +35 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/images/commontator/downvote.png +0 -0
  5. data/app/assets/images/commontator/downvote_hover.png +0 -0
  6. data/app/assets/images/commontator/upvote.png +0 -0
  7. data/app/assets/images/commontator/upvote_hover.png +0 -0
  8. data/app/assets/stylesheets/commontator/application.css +13 -0
  9. data/app/assets/stylesheets/commontator/application.css~ +88 -0
  10. data/app/assets/stylesheets/commontator/comments.css +86 -0
  11. data/app/assets/stylesheets/commontator/comments.css~ +90 -0
  12. data/app/assets/stylesheets/commontator/threads.css +13 -0
  13. data/app/assets/stylesheets/commontator/threads.css~ +13 -0
  14. data/app/controllers/commontator/application_controller.rb +18 -0
  15. data/app/controllers/commontator/application_controller.rb~ +16 -0
  16. data/app/controllers/commontator/comments_controller.rb +143 -0
  17. data/app/controllers/commontator/comments_controller.rb~ +143 -0
  18. data/app/controllers/commontator/subscriptions_controller.rb +42 -0
  19. data/app/controllers/commontator/subscriptions_controller.rb~ +40 -0
  20. data/app/controllers/commontator/threads_controller.rb +42 -0
  21. data/app/controllers/commontator/threads_controller.rb~ +43 -0
  22. data/app/helpers/commontator/application_helper.rb +11 -0
  23. data/app/helpers/commontator/application_helper.rb~ +11 -0
  24. data/app/helpers/commontator/comments_helper.rb +47 -0
  25. data/app/helpers/commontator/comments_helper.rb~ +58 -0
  26. data/app/helpers/commontator/commontable_helper.rb~ +9 -0
  27. data/app/helpers/commontator/commontator_helper.rb +8 -0
  28. data/app/helpers/commontator/commontator_helper.rb~ +8 -0
  29. data/app/helpers/commontator/subscriptions_helper.rb +8 -0
  30. data/app/helpers/commontator/subscriptions_helper.rb~ +8 -0
  31. data/app/helpers/commontator/threads_helper.rb +21 -0
  32. data/app/helpers/commontator/threads_helper.rb~ +32 -0
  33. data/app/mailers/commontator/subscription_mailer.rb~ +38 -0
  34. data/app/mailers/commontator/subscriptions_mailer.rb +51 -0
  35. data/app/mailers/commontator/subscriptions_mailer.rb~ +51 -0
  36. data/app/models/commontator/comment.rb +84 -0
  37. data/app/models/commontator/comment.rb~ +84 -0
  38. data/app/models/commontator/subscription.rb +21 -0
  39. data/app/models/commontator/subscription.rb~ +21 -0
  40. data/app/models/commontator/thread.rb +138 -0
  41. data/app/models/commontator/thread.rb~ +141 -0
  42. data/app/views/commontator/comments/_actions.html.erb +32 -0
  43. data/app/views/commontator/comments/_actions.html.erb~ +33 -0
  44. data/app/views/commontator/comments/_body.html.erb +7 -0
  45. data/app/views/commontator/comments/_body.html.erb~ +8 -0
  46. data/app/views/commontator/comments/_form.html.erb +20 -0
  47. data/app/views/commontator/comments/_form.html.erb~ +21 -0
  48. data/app/views/commontator/comments/_show.html.erb +41 -0
  49. data/app/views/commontator/comments/_show.html.erb~ +45 -0
  50. data/app/views/commontator/comments/_votes.html.erb +60 -0
  51. data/app/views/commontator/comments/_votes.html.erb~ +62 -0
  52. data/app/views/commontator/comments/create.js.erb +15 -0
  53. data/app/views/commontator/comments/create.js.erb~ +15 -0
  54. data/app/views/commontator/comments/delete.js.erb +15 -0
  55. data/app/views/commontator/comments/delete.js.erb~ +15 -0
  56. data/app/views/commontator/comments/destroy.js.erb~ +1 -0
  57. data/app/views/commontator/comments/edit.html.erb +6 -0
  58. data/app/views/commontator/comments/edit.html.erb~ +6 -0
  59. data/app/views/commontator/comments/edit.js.erb +5 -0
  60. data/app/views/commontator/comments/edit.js.erb~ +5 -0
  61. data/app/views/commontator/comments/new.html.erb +8 -0
  62. data/app/views/commontator/comments/new.html.erb~ +8 -0
  63. data/app/views/commontator/comments/new.js.erb +12 -0
  64. data/app/views/commontator/comments/new.js.erb~ +12 -0
  65. data/app/views/commontator/comments/update.js.erb +7 -0
  66. data/app/views/commontator/comments/update.js.erb~ +7 -0
  67. data/app/views/commontator/comments/vote.js.erb +5 -0
  68. data/app/views/commontator/comments/vote.js.erb~ +5 -0
  69. data/app/views/commontator/commontator/_thread.html.erb +14 -0
  70. data/app/views/commontator/commontator/_thread.html.erb~ +15 -0
  71. data/app/views/commontator/subscriptions/_subscription_link.html.erb +12 -0
  72. data/app/views/commontator/subscriptions/_subscription_link.html.erb~ +12 -0
  73. data/app/views/commontator/subscriptions/create.js.erb +5 -0
  74. data/app/views/commontator/subscriptions/create.js.erb~ +3 -0
  75. data/app/views/commontator/subscriptions/destroy.js.erb +5 -0
  76. data/app/views/commontator/subscriptions/destroy.js.erb~ +3 -0
  77. data/app/views/commontator/subscriptions/index.html.erb +16 -0
  78. data/app/views/commontator/subscriptions/index.html.erb~ +16 -0
  79. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb +14 -0
  80. data/app/views/commontator/subscriptions_mailer/comment_created_email.html.erb~ +14 -0
  81. data/app/views/commontator/threads/_show.html.erb +26 -0
  82. data/app/views/commontator/threads/_show.html.erb~ +26 -0
  83. data/app/views/commontator/threads/show.html.erb +3 -0
  84. data/app/views/commontator/threads/show.js.erb +6 -0
  85. data/app/views/layouts/commontator/application.html.erb +14 -0
  86. data/config/initializers/commontator.rb +7 -0
  87. data/config/routes.rb +24 -0
  88. data/config/routes.rb~ +22 -0
  89. data/db/migrate/0_install_commontator.rb +40 -0
  90. data/db/migrate/0_install_commontator.rb~ +40 -0
  91. data/lib/commontator.rb +66 -0
  92. data/lib/commontator.rb~ +66 -0
  93. data/lib/commontator/acts_as_commontable.rb +39 -0
  94. data/lib/commontator/acts_as_commontable.rb~ +42 -0
  95. data/lib/commontator/acts_as_commontator.rb +28 -0
  96. data/lib/commontator/acts_as_commontator.rb~ +37 -0
  97. data/lib/commontator/commontable_config.rb +13 -0
  98. data/lib/commontator/commontator_config.rb +13 -0
  99. data/lib/commontator/engine.rb +5 -0
  100. data/lib/commontator/routes.rb~ +37 -0
  101. data/lib/commontator/version.rb +3 -0
  102. data/lib/commontator/version.rb~ +3 -0
  103. data/test/commontator_test.rb +7 -0
  104. data/test/dummy/README.rdoc +261 -0
  105. data/test/dummy/Rakefile +7 -0
  106. data/test/dummy/app/assets/javascripts/application.js +15 -0
  107. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  108. data/test/dummy/app/controllers/application_controller.rb +3 -0
  109. data/test/dummy/app/helpers/application_helper.rb +2 -0
  110. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  111. data/test/dummy/config.ru +4 -0
  112. data/test/dummy/config/application.rb +59 -0
  113. data/test/dummy/config/boot.rb +10 -0
  114. data/test/dummy/config/database.yml +25 -0
  115. data/test/dummy/config/environment.rb +5 -0
  116. data/test/dummy/config/environments/development.rb +37 -0
  117. data/test/dummy/config/environments/production.rb +67 -0
  118. data/test/dummy/config/environments/test.rb +37 -0
  119. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  120. data/test/dummy/config/initializers/inflections.rb +15 -0
  121. data/test/dummy/config/initializers/mime_types.rb +5 -0
  122. data/test/dummy/config/initializers/secret_token.rb +7 -0
  123. data/test/dummy/config/initializers/session_store.rb +8 -0
  124. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  125. data/test/dummy/config/locales/en.yml +5 -0
  126. data/test/dummy/config/routes.rb +4 -0
  127. data/test/dummy/db/development.sqlite3 +0 -0
  128. data/test/dummy/db/schema.rb +16 -0
  129. data/test/dummy/db/test.sqlite3 +0 -0
  130. data/test/dummy/log/development.log +204 -0
  131. data/test/dummy/public/404.html +26 -0
  132. data/test/dummy/public/422.html +26 -0
  133. data/test/dummy/public/500.html +25 -0
  134. data/test/dummy/public/favicon.ico +0 -0
  135. data/test/dummy/script/rails +6 -0
  136. data/test/functional/comment_thread_subscriptions_controller_test.rb~ +125 -0
  137. data/test/functional/comments_controller_test.rb +181 -0
  138. data/test/functional/comments_controller_test.rb~ +184 -0
  139. data/test/functional/subscriptions_controller_test.rb +122 -0
  140. data/test/functional/subscriptions_controller_test.rb~ +122 -0
  141. data/test/integration/navigation_test.rb +10 -0
  142. data/test/test_helper.rb +15 -0
  143. data/test/unit/comment_test.rb +35 -0
  144. data/test/unit/comment_test.rb~ +38 -0
  145. data/test/unit/comment_thread_subscription_test.rb~ +18 -0
  146. data/test/unit/comment_thread_test.rb~ +60 -0
  147. data/test/unit/helpers/comment_thread_subscriptions_helper_test.rb~ +7 -0
  148. data/test/unit/helpers/comments_helper_test.rb +4 -0
  149. data/test/unit/helpers/comments_helper_test.rb~ +7 -0
  150. data/test/unit/helpers/subscriptions_helper_test.rb +4 -0
  151. data/test/unit/helpers/subscriptions_helper_test.rb~ +4 -0
  152. data/test/unit/subscription_test.rb +15 -0
  153. data/test/unit/subscription_test.rb~ +15 -0
  154. data/test/unit/thread_test.rb +57 -0
  155. data/test/unit/thread_test.rb~ +57 -0
  156. metadata +301 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Common Tator
2
+
3
+ A Rails engine for comments
4
+ This is not ready for use yet. We recommend you do not use this gem until it is done.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'commontator'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install commontator
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
31
+
32
+ ## License
33
+
34
+ This engine is distributed under the terms of the MIT license.
35
+ See the MIT-LICENSE file for details.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Commontator'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,88 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+
15
+ .comment {
16
+ font-size: 12px;
17
+ font-weight: normal;
18
+ font-style: normal;
19
+ margin-top: 15px;
20
+ margin-bottom: 15px;
21
+ border-left: 1px solid;
22
+ border-top: 1px solid;
23
+ padding: 8px;
24
+ padding-left: 15px;
25
+ border-color: #ddd;
26
+ color: #000;
27
+ background-color: #fff;
28
+ clear:both;
29
+ }
30
+
31
+ .comment_actions {
32
+ float:right;
33
+ }
34
+
35
+ .comment_actions a {
36
+ display:inline;
37
+ }
38
+
39
+ .comment_body_div {
40
+ float: left;
41
+ }
42
+
43
+ .comment_body {
44
+ clear:both;
45
+ margin:3px;
46
+ padding-left:8px;
47
+ padding-bottom:6px;
48
+ padding-top: 8px;
49
+ float: left;
50
+ }
51
+
52
+ .comment_body pre { /* When showing comments, allow <pre> to wrap */
53
+ white-space: pre-wrap; /* css-3 */
54
+ white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
55
+ white-space: -pre-wrap; /* Opera 4-6 */
56
+ white-space: -o-pre-wrap; /* Opera 7 */
57
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
58
+ }
59
+
60
+ .comment_profile_picture {
61
+ float:left;
62
+ padding-top: 8px;
63
+ height:auto;
64
+ }
65
+
66
+ .comment_timestamp {
67
+ color: #777;
68
+ }
69
+
70
+ .comment_votes {
71
+ float:right;
72
+ }
73
+
74
+ .new_comment_div textarea {
75
+ width: 100%;
76
+ }
77
+
78
+ .thread_new_comment {
79
+ display:none;
80
+ }
81
+
82
+ .thread_new_comment_body {
83
+ width: 100%;
84
+ }
85
+
86
+ .thread_new_comment_link {
87
+ float:left;
88
+ }
@@ -0,0 +1,86 @@
1
+ .comment {
2
+ font-size: 12px;
3
+ font-weight: normal;
4
+ font-style: normal;
5
+
6
+ border-top: 1px solid;
7
+ border-left: 1px solid;
8
+
9
+ margin-top: 15px;
10
+ margin-bottom: 15px;
11
+
12
+ padding-top: 8px;
13
+ padding-left: 15px;
14
+
15
+ color: #000;
16
+ border-color: #ddd;
17
+ background-color: #fff;
18
+ }
19
+
20
+ .comment_actions {
21
+ float: right;
22
+ }
23
+
24
+ .comment_body p {
25
+ margin: 0px;
26
+
27
+ overflow: hidden;
28
+ }
29
+
30
+ .comment_body {
31
+ margin-left: 55px;
32
+ margin-top: -60px;
33
+ margin-right: 45px;
34
+
35
+ padding: 8px;
36
+ }
37
+
38
+ .comment_profile_picture img {
39
+ margin-top: 5px;
40
+ }
41
+
42
+ .comment_timestamp {
43
+ color: #777;
44
+ }
45
+
46
+ .comment_votes {
47
+ float: right;
48
+ }
49
+
50
+ .comment_votes input,
51
+ .comment_votes img {
52
+ border: none;
53
+ background-color: transparent;
54
+ padding: 0px;
55
+ margin: 5px;
56
+ }
57
+
58
+ .comment_upvote {
59
+ display: table;
60
+ }
61
+
62
+ .comment_upvote form {
63
+ display: table-cell;
64
+ }
65
+
66
+ .comment_downvote {
67
+ display: table;
68
+ }
69
+
70
+ .comment_downvote form {
71
+ display: table-cell;
72
+ }
73
+
74
+ .comment_upvote_count {
75
+ display: table-cell;
76
+ vertical-align: middle;
77
+
78
+ padding-top: 1px;
79
+ }
80
+
81
+ .comment_downvote_count {
82
+ display: table-cell;
83
+ vertical-align: middle;
84
+
85
+ padding-bottom: 7px;
86
+ }
@@ -0,0 +1,90 @@
1
+ .comment {
2
+ font-size: 12px;
3
+ font-weight: normal;
4
+ font-style: normal;
5
+
6
+ border-top: 1px solid;
7
+ border-left: 1px solid;
8
+
9
+ margin-top: 15px;
10
+ margin-bottom: 15px;
11
+
12
+ padding-top: 8px;
13
+ padding-left: 15px;
14
+
15
+ color: #000;
16
+ border-color: #ddd;
17
+ background-color: #fff;
18
+ }
19
+
20
+ .comment_actions {
21
+ float: right;
22
+ }
23
+
24
+ .comment_body p {
25
+ margin: 0px;
26
+
27
+ overflow: hidden;
28
+ }
29
+
30
+ .comment_body {
31
+ margin-left: 55px;
32
+ margin-top: -60px;
33
+ margin-right: 45px;
34
+
35
+ padding: 8px;
36
+ }
37
+
38
+ .comment_profile_picture img {
39
+ margin-top: 5px;
40
+ }
41
+
42
+ .comment_timestamp {
43
+ color: #777;
44
+ }
45
+
46
+ .comment_votes {
47
+ float: right;
48
+ }
49
+
50
+ .comment_votes input,
51
+ .comment_votes img {
52
+ border: none;
53
+ background-color: transparent;
54
+ padding: 0px;
55
+ margin: 5px;
56
+ }
57
+
58
+ .comment_upvote {
59
+ display: table;
60
+ }
61
+
62
+ .comment_upvote form {
63
+ display: table-cell;
64
+ }
65
+
66
+ .comment_downvote {
67
+ display: table;
68
+ }
69
+
70
+ .comment_downvote form {
71
+ display: table-cell;
72
+ }
73
+
74
+ .comment_upvote_count {
75
+ display: table-cell;
76
+ vertical-align: middle;
77
+
78
+ padding-top: 1px;
79
+ }
80
+
81
+ .comment_downvote_count {
82
+ display: table-cell;
83
+ vertical-align: middle;
84
+
85
+ padding-bottom: 7px;
86
+ }
87
+
88
+ .thread_new_comment textarea {
89
+ width: 100%;
90
+ }
@@ -0,0 +1,13 @@
1
+ .thread_header {
2
+ font-size: 16px;
3
+ font-weight: bold;
4
+ font-style: normal;
5
+ }
6
+
7
+ .thread_new_comment {
8
+ display: none;
9
+ }
10
+
11
+ .thread_new_comment textarea {
12
+ width: 100%;
13
+ }
@@ -0,0 +1,13 @@
1
+ .thread_header {
2
+ font-size: 16px;
3
+ font-weight: normal;
4
+ font-style: normal;
5
+ }
6
+
7
+ .thread_new_comment {
8
+ display: none;
9
+ }
10
+
11
+ .thread_new_comment textarea {
12
+ width: 100%;
13
+ }
@@ -0,0 +1,18 @@
1
+ module Commontator
2
+ class ApplicationController < ActionController::Base
3
+ before_filter :get_commontator
4
+
5
+ protected
6
+
7
+ def get_commontator
8
+ @commontator = send Commontator.current_user_method
9
+ raise SecurityTransgression unless (@commontator.nil? || @commontator.is_commontator)
10
+ end
11
+
12
+ def get_thread
13
+ @thread = params[:thread_id].blank? ? \
14
+ Commontator::Thread.find(params[:id]) : \
15
+ Commontator::Thread.find(params[:thread_id])
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module Commontator
2
+ class ApplicationController < ActionController::Base
3
+ before_filter :get_commontator
4
+
5
+ protected
6
+
7
+ def get_commontator
8
+ @commontator = send Commontator.current_user_method
9
+ raise SecurityTransgression unless (@commontator.nil? || @commontator.is_commontator)
10
+ end
11
+
12
+ def get_thread
13
+ @thread = params[:thread_id].blank? ? Commontator::Thread.find(params[:thread_id]) : Commontator::Thread.find(params[:id])
14
+ end
15
+ end
16
+ end