mongoid-forums 0.0.1
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +35 -0
- data/app/assets/javascripts/mongoid_forums/admin/base.js +2 -0
- data/app/assets/javascripts/mongoid_forums/admin/categories.js +2 -0
- data/app/assets/javascripts/mongoid_forums/admin/forums.js +2 -0
- data/app/assets/javascripts/mongoid_forums/application.js +13 -0
- data/app/assets/javascripts/mongoid_forums/forums.js +2 -0
- data/app/assets/javascripts/mongoid_forums/posts.js +2 -0
- data/app/assets/javascripts/mongoid_forums/topics.js +2 -0
- data/app/assets/stylesheets/mongoid_forums/admin/base.css +4 -0
- data/app/assets/stylesheets/mongoid_forums/admin/categories.css +4 -0
- data/app/assets/stylesheets/mongoid_forums/admin/forums.css +4 -0
- data/app/assets/stylesheets/mongoid_forums/application.css +15 -0
- data/app/assets/stylesheets/mongoid_forums/forums.css +4 -0
- data/app/assets/stylesheets/mongoid_forums/posts.css +4 -0
- data/app/assets/stylesheets/mongoid_forums/topics.css +4 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/mongoid_forums/admin/base_controller.rb +11 -0
- data/app/controllers/mongoid_forums/admin/categories_controller.rb +36 -0
- data/app/controllers/mongoid_forums/admin/forums_controller.rb +36 -0
- data/app/controllers/mongoid_forums/application_controller.rb +45 -0
- data/app/controllers/mongoid_forums/forums_controller.rb +57 -0
- data/app/controllers/mongoid_forums/posts_controller.rb +75 -0
- data/app/controllers/mongoid_forums/redirect_controller.rb +33 -0
- data/app/controllers/mongoid_forums/topics_controller.rb +84 -0
- data/app/helpers/mongoid_forums/admin/base_helper.rb +4 -0
- data/app/helpers/mongoid_forums/admin/categories_helper.rb +4 -0
- data/app/helpers/mongoid_forums/admin/forums_helper.rb +4 -0
- data/app/helpers/mongoid_forums/application_helper.rb +20 -0
- data/app/helpers/mongoid_forums/formatting_helper.rb +28 -0
- data/app/helpers/mongoid_forums/forums_helper.rb +15 -0
- data/app/helpers/mongoid_forums/posts_helper.rb +4 -0
- data/app/helpers/mongoid_forums/topics_helper.rb +4 -0
- data/app/models/mongoid_forums/alert.rb +80 -0
- data/app/models/mongoid_forums/category.rb +13 -0
- data/app/models/mongoid_forums/concerns/subscribable.rb +76 -0
- data/app/models/mongoid_forums/concerns/viewable.rb +60 -0
- data/app/models/mongoid_forums/forum.rb +42 -0
- data/app/models/mongoid_forums/permission.rb +95 -0
- data/app/models/mongoid_forums/post.rb +37 -0
- data/app/models/mongoid_forums/rank.rb +9 -0
- data/app/models/mongoid_forums/subscription.rb +66 -0
- data/app/models/mongoid_forums/topic.rb +45 -0
- data/app/models/mongoid_forums/view.rb +30 -0
- data/app/views/layouts/mongoid_forums/application.haml +21 -0
- data/app/views/mongoid_forums/admin/base/index.haml +4 -0
- data/app/views/mongoid_forums/admin/categories/edit.html.erb +2 -0
- data/app/views/mongoid_forums/admin/categories/new.haml +3 -0
- data/app/views/mongoid_forums/admin/forums/edit.html.erb +2 -0
- data/app/views/mongoid_forums/admin/forums/new.haml +4 -0
- data/app/views/mongoid_forums/forums/index.haml +43 -0
- data/app/views/mongoid_forums/forums/new.haml +15 -0
- data/app/views/mongoid_forums/forums/show.haml +43 -0
- data/app/views/mongoid_forums/posts/_form.haml +4 -0
- data/app/views/mongoid_forums/posts/_post.haml +20 -0
- data/app/views/mongoid_forums/posts/_quoted.haml +9 -0
- data/app/views/mongoid_forums/posts/edit.haml +17 -0
- data/app/views/mongoid_forums/posts/new.haml +17 -0
- data/app/views/mongoid_forums/topics/_topic.haml +2 -0
- data/app/views/mongoid_forums/topics/my_posts.haml +6 -0
- data/app/views/mongoid_forums/topics/my_subscriptions.haml +5 -0
- data/app/views/mongoid_forums/topics/my_topics.haml +6 -0
- data/app/views/mongoid_forums/topics/show.haml +12 -0
- data/config/routes.rb +40 -0
- data/lib/generators/mongoid_forums/install/templates/initializer.rb +5 -0
- data/lib/generators/mongoid_forums/install_generator.rb +101 -0
- data/lib/generators/mongoid_forums/views_generator.rb +27 -0
- data/lib/mongoid_forums/engine.rb +15 -0
- data/lib/mongoid_forums/sanitizer.rb +10 -0
- data/lib/mongoid_forums/version.rb +3 -0
- data/lib/mongoid_forums.rb +40 -0
- data/lib/tasks/mongoid_forums_tasks.rake +4 -0
- data/test/controllers/mongoid_forums/admin/base_controller_test.rb +11 -0
- data/test/controllers/mongoid_forums/admin/categories_controller_test.rb +31 -0
- data/test/controllers/mongoid_forums/admin/forums_controller_test.rb +31 -0
- data/test/controllers/mongoid_forums/forums_controller_test.rb +16 -0
- data/test/controllers/mongoid_forums/posts_controller_test.rb +36 -0
- data/test/controllers/mongoid_forums/topics_controller_test.rb +36 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/welcome.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/assets/stylesheets/welcome.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +11 -0
- data/test/dummy/app/controllers/welcome_controller.rb +4 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/welcome_helper.rb +2 -0
- data/test/dummy/app/models/concerns/zero_oid_fix.rb +10 -0
- data/test/dummy/app/models/user.rb +43 -0
- data/test/dummy/app/views/layouts/application.haml +13 -0
- data/test/dummy/app/views/partials/_nav.haml +6 -0
- data/test/dummy/app/views/welcome/index.html.erb +2 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +29 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +76 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/devise.rb +259 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/kaminari_config.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/mongoid_forums.rb +5 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/simple_form.rb +166 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/test/dummy/config/locales/devise.en.yml +60 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/locales/simple_form.en.yml +31 -0
- data/test/dummy/config/mongoid.yml +69 -0
- data/test/dummy/config/routes.rb +8 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/test/dummy/log/development.log +152624 -0
- data/test/dummy/log/test.log +51 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/welcome_controller_test.rb +9 -0
- data/test/dummy/test/fixtures/users.yml +11 -0
- data/test/dummy/test/models/user_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0405ebcb982faa24d5a9bbe01ba43bf8 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/04b994ecf135576af395f1d87108f0e1 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0532538bff94834533de08d16379c66f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/063d0c765cb2fe0a6fa3995059d65fcc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0a395daf2ed2bad0174008f223997c21 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0a4181c6e19406e1c40781394b0f7496 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/0f520169da88dbfbdd5b5f40cb5acc80 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1b516e1e4f37dd27b32d035c2c825de7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1d1293f6abfd57a3035ab25a567fe43e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/25a167c7563d6fe8ec6b13ec1ac09274 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/268f4f56598234185d91373d61899b3f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/26ce0653a8cb3da5990ace16181dbd63 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2dedb8177c20286c4259c1d58c5646cc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2fda08fb2ff79ca1dd653c3b688c1651 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/30d0258c36708f3d7911d6ba2303aaad +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/311da47a66243f663a4557a7e9997796 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/37b103f4623089af1456b90830fe941c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/37f7e269b2ddbd05160232e59bf0288f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/408e554cb00cbb09ae89a1e7ac45ea4f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/41f10e590485de7db44ca61e32c135ea +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/45e716730a5c02112d5817e1b8faa1a0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/4acd6b11130459cfdf814caad7638e95 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/60f651a96095c10f531bd7bf9a14beb5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6b12ee5284cadf70954a584a88b6c529 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6be29bb8e609ed29aaa3a6d4a04a9ae0 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6cef1e9aec64b514669e261e511dc792 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/76dc342539f7133a15b70b919f77425a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/873adae1bf2f532256c8ffe71a557df5 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/8d7f8b5066922abfdf12e8cf0a7f2f0e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/948b1a4ef7d3401c10fc537c40b56a1e +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/99d8deee7a422780b297ca618f4062c8 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9d4262e6cd4898fd1df7f51b2d3e5c92 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/9e611bdf180a46600cc5019392a1b561 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ab4dfca9c17bc07c2fce0127b5d9669f +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/af01a98a48fa1ebf1d65f0429ba2bb28 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/bc0c996f7ce50479170183c13af2d29d +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/beeaeba29291235e532fb452d94795b3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cc040cf4f4539a12745d02867976f5ba +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/ce30207f8949b0e3a822f6094bd31dcc +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d675d8a6b14078d1fc331870b4992050 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/daba24276ab6f3be739a0385f977df1c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/df5f9fbb250c939b0513aa2a35b4855b +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e22980ed174c68b2505214836a40e271 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e2c4f946939f2d7d0b42d86383755cae +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e6a87270f3b0e8a73bcec17322694b61 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/e95bb3887fb84a7d966c0fc7c4e087fd +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/eaa7a7fe023d19cd34c33a47e6b303f3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f91f775cd15edae9264ec0c23937c58b +0 -0
- data/test/fixtures/mongoid_forums/categories.yml +11 -0
- data/test/fixtures/mongoid_forums/forums.yml +11 -0
- data/test/fixtures/mongoid_forums/posts.yml +11 -0
- data/test/fixtures/mongoid_forums/ranks.yml +11 -0
- data/test/fixtures/mongoid_forums/topics.yml +11 -0
- data/test/integration/navigation_test.rb +9 -0
- data/test/models/mongoid_forums/category_test.rb +9 -0
- data/test/models/mongoid_forums/forum_test.rb +9 -0
- data/test/models/mongoid_forums/post_test.rb +9 -0
- data/test/models/mongoid_forums/rank_test.rb +9 -0
- data/test/models/mongoid_forums/topic_test.rb +9 -0
- data/test/mongoid_forums_test.rb +7 -0
- data/test/test_helper.rb +17 -0
- metadata +491 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module MongoidForums
|
|
2
|
+
module ForumsHelper
|
|
3
|
+
def topics_count(forum)
|
|
4
|
+
forum.topics.count
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def posts_count(forum)
|
|
8
|
+
if forum.posts_count == nil
|
|
9
|
+
forum.posts_count = forum.topics.inject(0) {|sum, topic| topic.posts.count + sum }
|
|
10
|
+
forum.save
|
|
11
|
+
end
|
|
12
|
+
forum.posts_count
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams
|
|
4
|
+
|
|
5
|
+
This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/alert.rb
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
=end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
module MongoidForums
|
|
31
|
+
class Alert
|
|
32
|
+
include Mongoid::Document
|
|
33
|
+
include Mongoid::Timestamps
|
|
34
|
+
include ActionView::Helpers::DateHelper
|
|
35
|
+
|
|
36
|
+
field :read, :type => Boolean, :default => false
|
|
37
|
+
field :read_at, :type => DateTime
|
|
38
|
+
|
|
39
|
+
# MongoidForums::Topic
|
|
40
|
+
field :mongoid_forums_topic_replier
|
|
41
|
+
field :mongoid_forums_topic_count, :default => 0
|
|
42
|
+
belongs_to :mongoid_forums_topic_post, :class_name => "MongoidForums::Post"
|
|
43
|
+
|
|
44
|
+
# Relations
|
|
45
|
+
belongs_to :subscription, :class_name => "MongoidForums::Subscription"
|
|
46
|
+
belongs_to :user, :index => true, :class_name => MongoidForums.user_class.to_s
|
|
47
|
+
|
|
48
|
+
def link
|
|
49
|
+
str = ""
|
|
50
|
+
case self.subscription.subscribable_type
|
|
51
|
+
when "MongoidForums::Topic"
|
|
52
|
+
str += "/forums/"
|
|
53
|
+
if self.mongoid_forums_topic_post == nil
|
|
54
|
+
str += "topics/" + self.subscription.subscribable.id.to_s
|
|
55
|
+
else
|
|
56
|
+
str += "posts/" + self.mongoid_forums_topic_post_id.to_s
|
|
57
|
+
end
|
|
58
|
+
else
|
|
59
|
+
str
|
|
60
|
+
end
|
|
61
|
+
str
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def text
|
|
65
|
+
str = ""
|
|
66
|
+
case self.subscription.subscribable_type
|
|
67
|
+
when "MongoidForums::Topic"
|
|
68
|
+
str += self.mongoid_forums_topic_replier
|
|
69
|
+
if self.mongoid_forums_topic_count > 0
|
|
70
|
+
str += " and " + self.mongoid_forums_topic_count.to_s + " other" + (self.mongoid_forums_topic_count > 1 ? "s" : "")
|
|
71
|
+
end
|
|
72
|
+
str += " replied to " + self.subscription.subscribable.subject
|
|
73
|
+
else
|
|
74
|
+
str
|
|
75
|
+
end
|
|
76
|
+
str += " " + time_ago_in_words(self.updated_at, false, :vague => true) + " ago"
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams
|
|
4
|
+
|
|
5
|
+
This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/concerns/subscribable.rb
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
=end
|
|
28
|
+
|
|
29
|
+
require 'active_support/concern'
|
|
30
|
+
|
|
31
|
+
module MongoidForums
|
|
32
|
+
module Concerns
|
|
33
|
+
module Subscribable
|
|
34
|
+
extend ActiveSupport::Concern
|
|
35
|
+
|
|
36
|
+
included do
|
|
37
|
+
has_many :subscriptions, :as => :subscribable, :class_name => "MongoidForums::Subscription"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def subscribe_creator
|
|
41
|
+
subscribe_user(self.user_id)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def subscribe_user(user_id)
|
|
45
|
+
if user_id && !subscriber?(user_id)
|
|
46
|
+
if sub = subscriptions.where(:subscriber_id => user_id, :unsubscribed => true).first
|
|
47
|
+
sub.unsubscribed = false
|
|
48
|
+
sub.save
|
|
49
|
+
else
|
|
50
|
+
subscriptions.create(:subscriber_id => user_id)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def unsubscribe_user(user_id)
|
|
56
|
+
sub = subscriptions.where(:subscriber_id => user_id).first
|
|
57
|
+
sub.unsubscribed = true
|
|
58
|
+
sub.save
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def subscriber?(user_id)
|
|
62
|
+
subscriptions.where(:subscriber_id => user_id, :unsubscribed => false).count > 0
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def subscription_for user_id
|
|
66
|
+
subscriptions.first(:conditions => { :subscriber_id=>user_id })
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def alert_subscribers(*args)
|
|
70
|
+
subscriptions.where(:unsubscribed => false).each do |sub|
|
|
71
|
+
sub.alert_subscriber(args)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams
|
|
4
|
+
|
|
5
|
+
This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/concerns/viewable.rb
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
=end
|
|
28
|
+
|
|
29
|
+
require 'active_support/concern'
|
|
30
|
+
|
|
31
|
+
module MongoidForums
|
|
32
|
+
module Concerns
|
|
33
|
+
module Viewable
|
|
34
|
+
extend ActiveSupport::Concern
|
|
35
|
+
|
|
36
|
+
included do
|
|
37
|
+
field :views_count
|
|
38
|
+
has_many :views, :as => :viewable, :class_name => "MongoidForums::View"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def view_for(user)
|
|
42
|
+
views.where(:user_id => user.id).first
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Track when users last viewed topics
|
|
46
|
+
def register_view_by(user)
|
|
47
|
+
return unless user
|
|
48
|
+
|
|
49
|
+
view = views.find_or_create_by(:user_id => user.id)
|
|
50
|
+
view.user_id = user.id
|
|
51
|
+
view.inc(count: 1)
|
|
52
|
+
inc(views_count: 1)
|
|
53
|
+
|
|
54
|
+
view.past_viewed_at = view.current_viewed_at
|
|
55
|
+
view.current_viewed_at = Time.now
|
|
56
|
+
view.save
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module MongoidForums
|
|
2
|
+
class Forum
|
|
3
|
+
include Mongoid::Document
|
|
4
|
+
include MongoidForums::Concerns::Viewable
|
|
5
|
+
|
|
6
|
+
belongs_to :category, :class_name => "MongoidForums::Category"
|
|
7
|
+
has_many :topics, :class_name => "MongoidForums::Topic"
|
|
8
|
+
|
|
9
|
+
# Caching
|
|
10
|
+
field :posts_count, :type => Integer
|
|
11
|
+
|
|
12
|
+
field :name
|
|
13
|
+
validates :name, :presence => true
|
|
14
|
+
|
|
15
|
+
field :order, :type => Integer, :default => 0
|
|
16
|
+
|
|
17
|
+
def unread_topic_count(user)
|
|
18
|
+
view = View.where(:viewable_id => id, :user_id => user.id).first
|
|
19
|
+
return topics.count unless view.present?
|
|
20
|
+
count = 0
|
|
21
|
+
topics.each do |topics|
|
|
22
|
+
if topics.created_at > view.current_viewed_at
|
|
23
|
+
count+=1
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
return count
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def count_of_posts
|
|
30
|
+
topics.inject(0) {|sum, topic| topic.posts.count + sum }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def increment_posts_count
|
|
34
|
+
if self.posts_count == nil
|
|
35
|
+
self.posts_count = 1
|
|
36
|
+
else
|
|
37
|
+
self.posts_count += 1
|
|
38
|
+
end
|
|
39
|
+
self.save
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
module MongoidForums
|
|
2
|
+
class Permission
|
|
3
|
+
|
|
4
|
+
def initialize(user)
|
|
5
|
+
allow "mongoid_forums/admin/forums", [:new]
|
|
6
|
+
allow "mongoid_forums/forums", [:index, :show]
|
|
7
|
+
|
|
8
|
+
allow "mongoid_forums/topics", [:show] do |topic|
|
|
9
|
+
(topic.hidden && user.present? && topic.user_id == user.id) || !topic.hidden
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
if user.present?
|
|
13
|
+
allow "mongoid_forums/posts", [:new, :create]
|
|
14
|
+
allow "mongoid_forums/forums", [:new, :create]
|
|
15
|
+
allow "mongoid_forums/redirect", [:forum, :topic, :posts, :subscriptions]
|
|
16
|
+
|
|
17
|
+
allow "mongoid_forums/topics", [:my_subscriptions, :my_topics, :my_posts]
|
|
18
|
+
|
|
19
|
+
allow "mongoid_forums/topics", [:edit, :update] do |topic|
|
|
20
|
+
topic.user_id == user.id && !topic.locked && !topic.hidden
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
allow "mongoid_forums/posts", [:edit, :update] do |post|
|
|
24
|
+
post.user_id == user.id && !post.topic.locked
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
allow "mongoid_forums/redirect", [:subscriptions]
|
|
28
|
+
#allow_param :topic, [:name, posts: :text]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
rank = Rank.where(:members => user.id).first
|
|
32
|
+
|
|
33
|
+
allow_all if rank && rank.admin
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def allow?(controller, action, resource = nil)
|
|
39
|
+
puts controller
|
|
40
|
+
puts action
|
|
41
|
+
allowed = @allow_all || @allowed_actions[[controller.to_s, action.to_s]]
|
|
42
|
+
allowed && (allowed == true || resource && allowed.call(resource))
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def allow_all
|
|
46
|
+
@allow_all = true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def allow(controllers, actions, &block)
|
|
50
|
+
@allowed_actions ||= {}
|
|
51
|
+
Array(controllers).each do |controller|
|
|
52
|
+
Array(actions).each do |action|
|
|
53
|
+
@allowed_actions[[controller.to_s, action.to_s]] = block || true
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def allow_param(resource, attributes)
|
|
59
|
+
@allowed_params ||= {}
|
|
60
|
+
Array(resource).each do |resource|
|
|
61
|
+
@allowed_params[resource.to_s] ||= []
|
|
62
|
+
@allowed_params[resource.to_s] += Array(attributes).map(&:to_s)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def allow_param?(resource, attribute)
|
|
67
|
+
if @allow_all
|
|
68
|
+
true
|
|
69
|
+
elsif @allowed_params && @allowed_params[resource.to_s]
|
|
70
|
+
@allowed_params[resource.to_s].include? attribute.to_s
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def allow_nested_param(resources, attribute, nested_attributes)
|
|
75
|
+
@allowed_params ||= {}
|
|
76
|
+
Array(resources).each do |resource|
|
|
77
|
+
@allowed_params[resource.to_s] ||= []
|
|
78
|
+
@allowed_params[resource.to_s] += [{ attribute.to_s => Array(nested_attributes).map(&:to_s)}]
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def permit_params!(params)
|
|
83
|
+
if @allow_all
|
|
84
|
+
params.permit!
|
|
85
|
+
elsif @allowed_params
|
|
86
|
+
@allowed_params.each do |resource, attributes|
|
|
87
|
+
if params[resource].respond_to? :permit
|
|
88
|
+
params[resource] = params[resource].permit(*attributes)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module MongoidForums
|
|
2
|
+
class Post
|
|
3
|
+
include Mongoid::Document
|
|
4
|
+
include Mongoid::Timestamps
|
|
5
|
+
|
|
6
|
+
before_save :set_topic_last_post_at
|
|
7
|
+
|
|
8
|
+
belongs_to :topic, :class_name => "MongoidForums::Topic"
|
|
9
|
+
|
|
10
|
+
belongs_to :user, :class_name => MongoidForums.user_class.to_s
|
|
11
|
+
|
|
12
|
+
belongs_to :reply_to, :class_name => "MongoidForums::Post"
|
|
13
|
+
|
|
14
|
+
has_many :replies, :class_name => "MongoidForums::Post",
|
|
15
|
+
:foreign_key => "reply_to_id",
|
|
16
|
+
:dependent => :nullify
|
|
17
|
+
|
|
18
|
+
field :text, type: String
|
|
19
|
+
validates :text, :presence => true
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
def by_created_at
|
|
23
|
+
order_by([:created_at, :asc])
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def by_updated_at
|
|
27
|
+
order_by([:updated_at, :desc])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
protected
|
|
33
|
+
def set_topic_last_post_at
|
|
34
|
+
self.topic.update_attribute(:last_post_at, self.created_at)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
|
|
3
|
+
Copyright 2011 Ryan Bigg, Philip Arndt and Josh Adams
|
|
4
|
+
|
|
5
|
+
This code was obtained from: https://github.com/kultus/forem-2/blob/master/app/models/forem/subscription.rb
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
=end
|
|
28
|
+
|
|
29
|
+
module MongoidForums
|
|
30
|
+
class Subscription
|
|
31
|
+
include Mongoid::Document
|
|
32
|
+
include Mongoid::Timestamps
|
|
33
|
+
|
|
34
|
+
field :unsubscribed, :type => Boolean, :default => false
|
|
35
|
+
|
|
36
|
+
belongs_to :subscribable, :polymorphic => true, :index => true
|
|
37
|
+
belongs_to :subscriber, :class_name => MongoidForums.user_class.to_s, :index => true
|
|
38
|
+
|
|
39
|
+
validates :subscriber_id, :presence => true
|
|
40
|
+
validates :subscribable_id, :presence => true
|
|
41
|
+
validates :subscribable_type, :presence => true
|
|
42
|
+
|
|
43
|
+
#attr_accessible :subscriber_id
|
|
44
|
+
|
|
45
|
+
def alert_subscriber(*args)
|
|
46
|
+
alert = MongoidForums::Alert.where(:subscription_id => self.id, :read => false).first
|
|
47
|
+
puts "ALERTING SUBSCRIBERS WITH"
|
|
48
|
+
puts alert
|
|
49
|
+
case self.subscribable_type
|
|
50
|
+
when "MongoidForums::Topic"
|
|
51
|
+
#return if !allow :read, self.subscribable
|
|
52
|
+
if alert == nil
|
|
53
|
+
last_post = self.subscribable.posts.last
|
|
54
|
+
return if last_post.user.id == self.subscriber_id
|
|
55
|
+
MongoidForums::Alert.create(:subscription_id => self.id, :user_id => self.subscriber_id, :mongoid_forums_topic_post => last_post, :mongoid_forums_topic_replier => last_post.user.forum_display_name)
|
|
56
|
+
else
|
|
57
|
+
alert.updated_at = Time.now
|
|
58
|
+
alert.mongoid_forums_topic_count += 1
|
|
59
|
+
alert.save
|
|
60
|
+
end
|
|
61
|
+
else
|
|
62
|
+
raise TypeError, 'This object is not subscribable!'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module MongoidForums
|
|
2
|
+
class Topic
|
|
3
|
+
include Mongoid::Document
|
|
4
|
+
include Mongoid::Timestamps
|
|
5
|
+
include MongoidForums::Concerns::Subscribable
|
|
6
|
+
include MongoidForums::Concerns::Viewable
|
|
7
|
+
|
|
8
|
+
after_create :subscribe_creator
|
|
9
|
+
|
|
10
|
+
belongs_to :forum, :class_name => "MongoidForums::Forum"
|
|
11
|
+
has_many :posts, :class_name => "MongoidForums::Post"
|
|
12
|
+
|
|
13
|
+
belongs_to :user, :class_name => MongoidForums.user_class.to_s
|
|
14
|
+
|
|
15
|
+
field :name
|
|
16
|
+
validates :name, :presence => true
|
|
17
|
+
|
|
18
|
+
field :locked, type: Boolean, default: false
|
|
19
|
+
field :pinned, type: Boolean, default: false
|
|
20
|
+
field :hidden, type: Boolean, default: false
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def unread_post_count(user)
|
|
24
|
+
view = View.where(:viewable_id => id, :user_id => user.id).first
|
|
25
|
+
return posts.count unless view.present?
|
|
26
|
+
count = 0
|
|
27
|
+
posts.each do |post|
|
|
28
|
+
if post.created_at > view.current_viewed_at
|
|
29
|
+
count+=1
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
return count
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class << self
|
|
36
|
+
def by_most_recent_post
|
|
37
|
+
order_by([:last_post_at, :desc])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def by_pinned_or_most_recent_post
|
|
41
|
+
order_by([:pinned, :desc], [:last_post_at, :desc])
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module MongoidForums
|
|
2
|
+
class View
|
|
3
|
+
include Mongoid::Document
|
|
4
|
+
include Mongoid::Timestamps
|
|
5
|
+
|
|
6
|
+
field :current_viewed_at, :type => DateTime
|
|
7
|
+
field :past_viewed_at, :type => DateTime
|
|
8
|
+
|
|
9
|
+
before_create :set_viewed_at_to_now
|
|
10
|
+
|
|
11
|
+
belongs_to :viewable, :polymorphic => true, :index => true
|
|
12
|
+
belongs_to :user, :class_name => MongoidForums.user_class.to_s, :index => true
|
|
13
|
+
|
|
14
|
+
validates :viewable_id, :presence => true
|
|
15
|
+
validates :viewable_type, :presence => true
|
|
16
|
+
|
|
17
|
+
#attr_accessible :user, :current_viewed_at, :count
|
|
18
|
+
#field :count, type: Integer
|
|
19
|
+
|
|
20
|
+
def viewed_at
|
|
21
|
+
updated_at
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
def set_viewed_at_to_now
|
|
26
|
+
self.current_viewed_at = Time.now
|
|
27
|
+
self.past_viewed_at = current_viewed_at
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
!!!
|
|
2
|
+
%html
|
|
3
|
+
%head
|
|
4
|
+
%title Forums
|
|
5
|
+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
|
6
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
|
7
|
+
= csrf_meta_tags
|
|
8
|
+
%body
|
|
9
|
+
- if mongoid_forums_user.present?
|
|
10
|
+
- @alerts.each do |al|
|
|
11
|
+
= al.mongoid_forums_topic_replier
|
|
12
|
+
replied to
|
|
13
|
+
- topic = MongoidForums::Post.find(al.mongoid_forums_topic_post_id).topic
|
|
14
|
+
= link_to topic.name, al.link
|
|
15
|
+
= time_ago_in_words(al.created_at)
|
|
16
|
+
ago
|
|
17
|
+
|
|
18
|
+
- flash.each do |name, msg|
|
|
19
|
+
= content_tag :p, msg if msg.is_a?(String)
|
|
20
|
+
|
|
21
|
+
= yield
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
%h1 Listing all forums
|
|
2
|
+
|
|
3
|
+
- @categories.each do |category|
|
|
4
|
+
%h2
|
|
5
|
+
= category.name
|
|
6
|
+
Category
|
|
7
|
+
%table{:border => "1"}
|
|
8
|
+
%tr
|
|
9
|
+
%th
|
|
10
|
+
Name
|
|
11
|
+
%th
|
|
12
|
+
Last post
|
|
13
|
+
%th
|
|
14
|
+
Topics
|
|
15
|
+
%th
|
|
16
|
+
Posts
|
|
17
|
+
%th
|
|
18
|
+
Unread topics
|
|
19
|
+
%th
|
|
20
|
+
Views
|
|
21
|
+
|
|
22
|
+
- category.forums.order_by([:order, :asc]).each do |forum|
|
|
23
|
+
%tr
|
|
24
|
+
%td
|
|
25
|
+
= link_to forum.name, forum
|
|
26
|
+
%td
|
|
27
|
+
- unless forum.topics.last.nil?
|
|
28
|
+
- last_post = forum.topics.select {|topic| !topic.hidden }.last.posts.last
|
|
29
|
+
= time_ago_in_words ( last_post.created_at )
|
|
30
|
+
ago on
|
|
31
|
+
= link_to last_post.topic.name, last_post.topic
|
|
32
|
+
by
|
|
33
|
+
= last_post.user.forum_display_name
|
|
34
|
+
- else
|
|
35
|
+
No posts yet
|
|
36
|
+
%td
|
|
37
|
+
= topics_count(forum) ? topics_count(forum) : "None"
|
|
38
|
+
%td
|
|
39
|
+
= posts_count(forum) ? posts_count(forum) : "None"
|
|
40
|
+
%td
|
|
41
|
+
= forum.unread_topic_count(mongoid_forums_user)
|
|
42
|
+
%td
|
|
43
|
+
= forum.views_count ? forum.views_count : "None"
|