dm_forum 4.2.1.5
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 +23 -0
- data/README.md +33 -0
- data/Rakefile +30 -0
- data/app/assets/javascripts/dm_forum/admin.js +20 -0
- data/app/assets/javascripts/dm_forum/application.js +16 -0
- data/app/assets/javascripts/dm_forum/dm_forum.js +3 -0
- data/app/assets/stylesheets/dm_forum/admin.css +2 -0
- data/app/assets/stylesheets/dm_forum/application.css +12 -0
- data/app/controllers/dm_forum/admin/admin_controller.rb +13 -0
- data/app/controllers/dm_forum/admin/dashboard_controller.rb +12 -0
- data/app/controllers/dm_forum/admin/forum_categories_controller.rb +80 -0
- data/app/controllers/dm_forum/admin/forum_sites_controller.rb +40 -0
- data/app/controllers/dm_forum/admin/forums_controller.rb +113 -0
- data/app/controllers/dm_forum/application_controller.rb +25 -0
- data/app/controllers/dm_forum/forum_comments_controller.rb +88 -0
- data/app/controllers/dm_forum/forum_topics_controller.rb +93 -0
- data/app/controllers/dm_forum/forums_controller.rb +45 -0
- data/app/datatables/forum_user_datatable.rb +79 -0
- data/app/helpers/dm_forum/application_helper.rb +5 -0
- data/app/helpers/dm_forum/forum_helper.rb +109 -0
- data/app/mailers/forum_notification_mailer.rb +27 -0
- data/app/models/dm_forum/concerns/ability.rb +50 -0
- data/app/models/dm_forum/concerns/user.rb +37 -0
- data/app/models/dm_forum/permitted_params.rb +38 -0
- data/app/models/forum.rb +74 -0
- data/app/models/forum_category.rb +14 -0
- data/app/models/forum_comment.rb +93 -0
- data/app/models/forum_site.rb +27 -0
- data/app/models/forum_topic.rb +146 -0
- data/app/presenters/forum_comment_presenter.rb +8 -0
- data/app/presenters/forum_common_presenter.rb +31 -0
- data/app/presenters/forum_presenter.rb +14 -0
- data/app/views/dm_forum/admin/dashboard/_widget_forum_comments.html.erb +38 -0
- data/app/views/dm_forum/admin/dashboard/widget_forum_comments.js.erb +1 -0
- data/app/views/dm_forum/admin/forum_categories/_content_toolbar.html.erb +5 -0
- data/app/views/dm_forum/admin/forum_categories/_form.html.erb +18 -0
- data/app/views/dm_forum/admin/forum_categories/edit.html.erb +3 -0
- data/app/views/dm_forum/admin/forum_categories/index.html.erb +25 -0
- data/app/views/dm_forum/admin/forum_categories/new.html.erb +3 -0
- data/app/views/dm_forum/admin/forum_categories/show.html.erb +41 -0
- data/app/views/dm_forum/admin/forum_sites/_form.html.erb +18 -0
- data/app/views/dm_forum/admin/forum_sites/edit.html.erb +2 -0
- data/app/views/dm_forum/admin/forum_sites/show.html.erb +12 -0
- data/app/views/dm_forum/admin/forums/_content_toolbar.html.erb +5 -0
- data/app/views/dm_forum/admin/forums/_form.html.erb +24 -0
- data/app/views/dm_forum/admin/forums/edit.html.erb +2 -0
- data/app/views/dm_forum/admin/forums/new.html.erb +2 -0
- data/app/views/dm_forum/admin/forums/show.html.erb +68 -0
- data/app/views/dm_forum/forum_comments/_formatting.html.erb +12 -0
- data/app/views/dm_forum/forum_comments/edit.html.erb +15 -0
- data/app/views/dm_forum/forum_topics/_comment_item.html.erb +26 -0
- data/app/views/dm_forum/forum_topics/_comments_list.html.erb +63 -0
- data/app/views/dm_forum/forum_topics/_follow_button.html.erb +3 -0
- data/app/views/dm_forum/forum_topics/_form.html.erb +24 -0
- data/app/views/dm_forum/forum_topics/edit.html.erb +13 -0
- data/app/views/dm_forum/forum_topics/new.html.erb +13 -0
- data/app/views/dm_forum/forum_topics/show.html.erb +49 -0
- data/app/views/dm_forum/forum_topics/toggle_follow.js.coffee +5 -0
- data/app/views/dm_forum/forums/_category_side_list.html.erb +28 -0
- data/app/views/dm_forum/forums/_forum_header.html.erb +14 -0
- data/app/views/dm_forum/forums/_no_forums.html.erb +1 -0
- data/app/views/dm_forum/forums/_topics_list.html.erb +86 -0
- data/app/views/dm_forum/forums/categories.html.erb +32 -0
- data/app/views/dm_forum/forums/list.html.erb +10 -0
- data/app/views/dm_forum/forums/show.html.erb +39 -0
- data/app/views/layouts/email_templates/forum_notification.html.erb +15 -0
- data/app/views/layouts/email_templates/forum_notification.text.erb +16 -0
- data/config/initializers/dm_forum.rb +0 -0
- data/config/locales/fms.cs.yml +104 -0
- data/config/locales/fms.de.yml +104 -0
- data/config/locales/fms.en.yml +104 -0
- data/config/locales/fms.fi.yml +104 -0
- data/config/locales/fms.ja.yml +104 -0
- data/config/routes.rb +43 -0
- data/db/migrate/20130103151149_create_forums.rb +72 -0
- data/db/migrate/20130424125513_add_public_forum.rb +13 -0
- data/db/migrate/20130430084925_add_forum_category.rb +7 -0
- data/db/migrate/20140201112134_delete_monitorships.rb +17 -0
- data/db/migrate/20140303121325_add_requires_subscription_forum.rb +5 -0
- data/db/migrate/20140423113420_add_forum_owner.rb +6 -0
- data/db/migrate/20160821150125_index_foreign_keys_in_fms_forum_sites.rb +5 -0
- data/db/migrate/20160821150126_index_foreign_keys_in_fms_forum_topics.rb +9 -0
- data/db/migrate/20160821150127_index_foreign_keys_in_fms_forums.rb +7 -0
- data/lib/dm_forum/engine.rb +9 -0
- data/lib/dm_forum/version.rb +3 -0
- data/lib/dm_forum.rb +4 -0
- data/lib/tasks/dm_forum_tasks.rake +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/ability.rb +12 -0
- data/spec/dummy/app/models/user.rb +6 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +17 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20141114170927_add_globalize_countries.dm_core.rb +50 -0
- data/spec/dummy/db/migrate/20141114170928_devise_create_users.dm_core.rb +46 -0
- data/spec/dummy/db/migrate/20141114170929_add_user_fields.dm_core.rb +14 -0
- data/spec/dummy/db/migrate/20141114170930_rolify_create_roles.dm_core.rb +20 -0
- data/spec/dummy/db/migrate/20141114170931_add_last_access.dm_core.rb +10 -0
- data/spec/dummy/db/migrate/20141114170932_create_versions.dm_core.rb +19 -0
- data/spec/dummy/db/migrate/20141114170933_add_object_changes_column_to_versions.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170934_create_dm_core_accounts.dm_core.rb +13 -0
- data/spec/dummy/db/migrate/20141114170935_add_account_to_users.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170936_create_preferences.dm_core.rb +13 -0
- data/spec/dummy/db/migrate/20141114170937_create_comments.dm_core.rb +22 -0
- data/spec/dummy/db/migrate/20141114170938_add_activity.dm_core.rb +21 -0
- data/spec/dummy/db/migrate/20141114170939_add_type_to_comments.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170940_add_category.dm_core.rb +28 -0
- data/spec/dummy/db/migrate/20141114170941_create_email_table.dm_core.rb +26 -0
- data/spec/dummy/db/migrate/20141114170942_add_user_profile.dm_core.rb +46 -0
- data/spec/dummy/db/migrate/20141114170943_add_profile_email.dm_core.rb +14 -0
- data/spec/dummy/db/migrate/20141114170944_create_payment_history.dm_core.rb +37 -0
- data/spec/dummy/db/migrate/20141114170945_change_anchor_field.dm_core.rb +10 -0
- data/spec/dummy/db/migrate/20141114170946_create_user_site_profile.dm_core.rb +27 -0
- data/spec/dummy/db/migrate/20141114170947_add_avatar.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170948_add_notify_to_payment_history.dm_core.rb +8 -0
- data/spec/dummy/db/migrate/20141114170949_acts_as_votable_migration.dm_core.rb +28 -0
- data/spec/dummy/db/migrate/20141114170950_add_user_site_profile_uuid.dm_core.rb +19 -0
- data/spec/dummy/db/migrate/20141114170951_add_invoice_id.dm_core.rb +7 -0
- data/spec/dummy/db/migrate/20141114170952_acts_as_follower_migration.dm_core.rb +18 -0
- data/spec/dummy/db/migrate/20141114170953_rename_invoice_id.dm_core.rb +12 -0
- data/spec/dummy/db/migrate/20141114170954_add_core_addresses.dm_core.rb +18 -0
- data/spec/dummy/db/migrate/20141114170955_papertrail_increase_column.dm_core.rb +9 -0
- data/spec/dummy/db/migrate/20141114170956_acts_as_taggable_on_migration.dm_core.rb +32 -0
- data/spec/dummy/db/migrate/20141114170957_add_missing_unique_indices.dm_core.rb +23 -0
- data/spec/dummy/db/migrate/20141114170958_add_taggings_counter_cache_to_tags.dm_core.rb +16 -0
- data/spec/dummy/db/migrate/20141114170959_create_custom_fields.dm_core.rb +40 -0
- data/spec/dummy/db/migrate/20141114170960_add_missing_taggable_index.dm_core.rb +11 -0
- data/spec/dummy/db/migrate/20141119112030_create_cms.dm_cms.rb +92 -0
- data/spec/dummy/db/migrate/20141119112031_add_account_to_cms.dm_cms.rb +11 -0
- data/spec/dummy/db/migrate/20141119112032_create_blog.dm_cms.rb +62 -0
- data/spec/dummy/db/migrate/20141119112033_add_notification_sent.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119112034_add_blog_comment.dm_cms.rb +8 -0
- data/spec/dummy/db/migrate/20141119112035_add_blog_image.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119112036_rename_snippet_slug.dm_cms.rb +14 -0
- data/spec/dummy/db/migrate/20141119112037_add_requires_subscription_blog.dm_cms.rb +8 -0
- data/spec/dummy/db/migrate/20141119112038_add_pages_ranked_model.dm_cms.rb +23 -0
- data/spec/dummy/db/migrate/20141119112039_add_blog_owner.dm_cms.rb +7 -0
- data/spec/dummy/db/migrate/20141119112040_create_media_files.dm_cms.rb +30 -0
- data/spec/dummy/db/migrate/20141119112041_add_cmspage_summary.dm_cms.rb +7 -0
- data/spec/dummy/db/migrate/20141119112042_add_blog_image_email_header.dm_cms.rb +6 -0
- data/spec/dummy/db/migrate/20141119112043_add_header_image.dm_cms.rb +10 -0
- data/spec/dummy/db/migrate/20160128144312_add_favored_locale.dm_core.rb +17 -0
- data/spec/dummy/db/migrate/20160128144313_update_papertrail_v4.dm_core.rb +41 -0
- data/spec/dummy/db/schema.rb +628 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/accounts.rb +9 -0
- data/spec/factories/user_profiles.rb +10 -0
- data/spec/factories/users.rb +19 -0
- data/spec/models/forum_spec.rb +9 -0
- data/spec/rails_helper.rb +70 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/accounts.rb +17 -0
- data/spec/support/devise.rb +44 -0
- data/spec/support/fix_locale.rb +57 -0
- metadata +337 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
class ForumTopic < ActiveRecord::Base
|
|
2
|
+
|
|
3
|
+
self.table_name = 'fms_forum_topics'
|
|
4
|
+
|
|
5
|
+
attr_accessor :body
|
|
6
|
+
attr_readonly :comments_count, :hits, :forum_posts_count
|
|
7
|
+
|
|
8
|
+
# --- FriendlyId
|
|
9
|
+
extend FriendlyId
|
|
10
|
+
include DmCore::Concerns::FriendlyId
|
|
11
|
+
|
|
12
|
+
acts_as_followable
|
|
13
|
+
|
|
14
|
+
before_validation :set_default_attributes, :on => :create
|
|
15
|
+
|
|
16
|
+
after_create :create_initial_comment
|
|
17
|
+
before_update :check_for_moved_forum
|
|
18
|
+
after_update :set_comment_forum_id
|
|
19
|
+
before_destroy :count_user_comments_for_counter_cache
|
|
20
|
+
after_destroy :update_cached_forum_and_user_counts
|
|
21
|
+
|
|
22
|
+
#--- creator of forum topic
|
|
23
|
+
belongs_to :user
|
|
24
|
+
belongs_to :account
|
|
25
|
+
|
|
26
|
+
#--- creator of recent comment
|
|
27
|
+
belongs_to :last_user, :class_name => "User"
|
|
28
|
+
|
|
29
|
+
belongs_to :forum, :counter_cache => true
|
|
30
|
+
|
|
31
|
+
#--- forum's site, set by callback
|
|
32
|
+
belongs_to :forum_site, :counter_cache => true
|
|
33
|
+
|
|
34
|
+
#--- don't use acts_as_commentable since we're using a specialized ForumComment class
|
|
35
|
+
has_many :forum_comments, {:as => :commentable, :dependent => :destroy}
|
|
36
|
+
has_one :recent_comment, -> { where(ancestry_depth: 1).order('created_at DESC') }, :as => :commentable, :class_name => "ForumComment"
|
|
37
|
+
|
|
38
|
+
has_many :voices, -> { distinct(true) }, :through => :forum_comments, :source => :user
|
|
39
|
+
|
|
40
|
+
validates_presence_of :user_id, :forum_site_id, :forum_id, :title
|
|
41
|
+
validates_presence_of :body, :on => :create
|
|
42
|
+
|
|
43
|
+
default_scope { where(account_id: Account.current.id) }
|
|
44
|
+
|
|
45
|
+
# use babosa gem (to_slug) to allow better handling of multi-language slugs
|
|
46
|
+
#------------------------------------------------------------------------------
|
|
47
|
+
def model_slug
|
|
48
|
+
title
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The first comment on a topic is the topic text. So the number of *replies*
|
|
52
|
+
# is the number of comments - 1
|
|
53
|
+
#------------------------------------------------------------------------------
|
|
54
|
+
def num_replies
|
|
55
|
+
comments_count - 1
|
|
56
|
+
end
|
|
57
|
+
#------------------------------------------------------------------------------
|
|
58
|
+
def to_s
|
|
59
|
+
title
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
#------------------------------------------------------------------------------
|
|
63
|
+
def sticky?
|
|
64
|
+
sticky
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
#------------------------------------------------------------------------------
|
|
68
|
+
def hit!
|
|
69
|
+
self.class.increment_counter :hits, id
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
#------------------------------------------------------------------------------
|
|
73
|
+
def paged?
|
|
74
|
+
comments_count > ForumComment.per_page
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
#------------------------------------------------------------------------------
|
|
78
|
+
def last_page
|
|
79
|
+
[(comments_count.to_f / ForumComment.per_page.to_f).ceil.to_i, 1].max
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
#------------------------------------------------------------------------------
|
|
83
|
+
def comment_number(forum_comment)
|
|
84
|
+
self.forum_comments.where("id <= #{forum_comment.id}").count
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
#------------------------------------------------------------------------------
|
|
88
|
+
def comment_page(forum_comment)
|
|
89
|
+
[(comment_number(forum_comment).to_f / ForumComment.per_page.to_f).ceil.to_i, 1].max
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#------------------------------------------------------------------------------
|
|
93
|
+
def update_cached_comment_fields(forum_comment)
|
|
94
|
+
#--- these fields are not accessible to mass assignment
|
|
95
|
+
if remaining_comment = forum_comment.frozen? ? recent_comment : forum_comment
|
|
96
|
+
self.class.where(:id => id).update_all(:last_updated_at => remaining_comment.created_at,
|
|
97
|
+
:last_user_id => remaining_comment.user_id, :last_forum_comment_id => remaining_comment.id)
|
|
98
|
+
else
|
|
99
|
+
destroy
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
protected
|
|
104
|
+
|
|
105
|
+
#------------------------------------------------------------------------------
|
|
106
|
+
def create_initial_comment
|
|
107
|
+
self.forum_comments.create_comment(self, body, user)
|
|
108
|
+
@body = nil
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
#------------------------------------------------------------------------------
|
|
112
|
+
def set_default_attributes
|
|
113
|
+
self.forum_site_id = forum.forum_site_id if forum_id
|
|
114
|
+
self.sticky ||= 0
|
|
115
|
+
self.last_updated_at ||= Time.now.utc
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
#------------------------------------------------------------------------------
|
|
119
|
+
def check_for_moved_forum
|
|
120
|
+
old = ForumTopic.find(id)
|
|
121
|
+
@old_forum_id = old.forum_id if old.forum_id != forum_id
|
|
122
|
+
true
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
#------------------------------------------------------------------------------
|
|
126
|
+
def set_comment_forum_id
|
|
127
|
+
return unless @old_forum_id
|
|
128
|
+
Forum.where(:id => @old_forum_id).update_all("comments_count = comments_count - #{comments_count}")
|
|
129
|
+
Forum.where(:id => forum_id).update_all("comments_count = comments_count + #{comments_count}")
|
|
130
|
+
Forum.where(:id => @old_forum_id).update_all("forum_topics_count = forum_topics_count - 1")
|
|
131
|
+
Forum.where(:id => forum_id).update_all("forum_topics_count = forum_topics_count + 1")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
#------------------------------------------------------------------------------
|
|
135
|
+
def count_user_comments_for_counter_cache
|
|
136
|
+
@user_comments = forum_comments.group_by { |p| p.user_id }
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
#------------------------------------------------------------------------------
|
|
140
|
+
def update_cached_forum_and_user_counts
|
|
141
|
+
Forum.where(:id => forum_id).update_all("comments_count = comments_count - #{comments_count}")
|
|
142
|
+
# @user_comments.each do |user_id, comments|
|
|
143
|
+
# User.where(:id => user_id).update_all("comments_count = comments_count - #{forum_comments.size}")
|
|
144
|
+
# end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Define presentation-specific methods here. Helpers are accessed through
|
|
2
|
+
# `helpers` (aka `h`).
|
|
3
|
+
#
|
|
4
|
+
# This class is used to contain some common presenter functions
|
|
5
|
+
#------------------------------------------------------------------------------
|
|
6
|
+
class ForumCommonPresenter < BasePresenter
|
|
7
|
+
presents :model
|
|
8
|
+
|
|
9
|
+
#------------------------------------------------------------------------------
|
|
10
|
+
# Admin presenter methods
|
|
11
|
+
|
|
12
|
+
#------------------------------------------------------------------------------
|
|
13
|
+
def label_published
|
|
14
|
+
model.published? ? h.colored_label('Published', :success) : h.colored_label('Draft')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
# #------------------------------------------------------------------------------
|
|
19
|
+
# # Front-end presenter methods
|
|
20
|
+
#
|
|
21
|
+
# # Run content through a standard Textile/Liquid renderer
|
|
22
|
+
# #------------------------------------------------------------------------------
|
|
23
|
+
# def render_content(arguments = {})
|
|
24
|
+
# doc = RedCloth.new(Liquid::Template.parse(model.content).render(arguments, :filters => [LiquidFilters],
|
|
25
|
+
# :registers => {:controller => controller, :view => self, :account_site_assets => '/site_assets', :current_user => current_user}))
|
|
26
|
+
# #doc.hard_breaks = false
|
|
27
|
+
#
|
|
28
|
+
# return doc.to_html.html_safe
|
|
29
|
+
# end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Define presentation-specific methods here. Helpers are accessed through
|
|
2
|
+
# `helpers` (aka `h`).
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
class ForumPresenter < ForumCommonPresenter
|
|
5
|
+
presents :forum
|
|
6
|
+
|
|
7
|
+
#------------------------------------------------------------------------------
|
|
8
|
+
def visibility
|
|
9
|
+
forum.visibility_to_s
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# #delegate :something, to: :course
|
|
13
|
+
#
|
|
14
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<% comment_day = params[:comment_day].to_i %>
|
|
2
|
+
<% date_range = (Date.today - comment_day.day).midnight..(Date.today - (comment_day - 1).day).midnight %>
|
|
3
|
+
<% comments = Comment.where(commentable_type: ForumTopic, created_at: date_range).order('created_at DESC') %>
|
|
4
|
+
<% title = comment_day == 0 ? 'Today\'s Forum Comments' : comment_day == 1 ? 'Yesterday\'s Forum Comments' : "Forum Comments #{comment_day} days ago" %>
|
|
5
|
+
<% content_for :forum_title_toolbar do %>
|
|
6
|
+
<%= toolbar_btn(comments.size, dm_core.admin_dashboard_path, title: 'Number of comments today', class: 'label label-success pull-right') %>
|
|
7
|
+
<div class="panel-icons-group">
|
|
8
|
+
<%= link_to icons('icon-arrow-left11'), dm_forum.admin_widget_forum_comments_path(comment_day: comment_day + 1), remote: true, class: 'btn btn-link btn-icon' %>
|
|
9
|
+
<% if @comment_day == 0 %>
|
|
10
|
+
<%= link_to icons('icon-arrow-right12'), '#', class: 'btn btn-link btn-icon disabled' %>
|
|
11
|
+
<% else %>
|
|
12
|
+
<%= link_to icons('icon-arrow-right12'), dm_forum.admin_widget_forum_comments_path(comment_day: comment_day - 1), remote: true, class: 'btn btn-link btn-icon' %></li>
|
|
13
|
+
<% end %>
|
|
14
|
+
<%= link_to icons('icon-spinner8'), dm_forum.admin_widget_forum_comments_path(comment_day: comment_day), class: 'btn btn-link btn-icon hovertip', title: 'Refresh', remote: true %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
<%= panel title: title, toolbar: content_for(:forum_title_toolbar) do %>
|
|
19
|
+
<% if comments.size == 0 %>
|
|
20
|
+
<p>No comments posted yet</p>
|
|
21
|
+
<% else %>
|
|
22
|
+
<% comments.each do |comment| %>
|
|
23
|
+
<!-- Comment -->
|
|
24
|
+
<div class="media">
|
|
25
|
+
<a class="pull-left" href="#"><div class="media-object"><%= avatar_for comment.user, 50 %></div></a>
|
|
26
|
+
<div class="media-body">
|
|
27
|
+
<%= link_to "<span class='hovertip' data-placement='right' title='#{comment.user.full_name}'>#{present(comment).author}</span>".html_safe, dm_forum.forum_forum_topic_path(comment.commentable.forum.slug, comment.commentable.slug, anchor: "forum_comment_#{comment.id}"), class: 'media-heading' %>
|
|
28
|
+
<ul class="headline-info">
|
|
29
|
+
<li><%= format_datetime comment.created_at %></li>
|
|
30
|
+
<li><%= link_to comment.commentable.title, dm_forum.forum_forum_topic_path(comment.commentable.forum.slug, comment.commentable.slug, anchor: "forum_comment_#{comment.id}"), class: 'post_title', target: '_blank' %></li>
|
|
31
|
+
</ul>
|
|
32
|
+
<%= present(comment).formatted_comment %>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<!-- /comment -->
|
|
36
|
+
<% end %>
|
|
37
|
+
<% end %>
|
|
38
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$('#widget_forum_comments').empty().append('<%= j render 'widget_forum_comments', comment_day: @comment_day %>')
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%= nav_bar_items([
|
|
2
|
+
link_to(icon_label(:edit, 'Edit'), [:edit, :admin, item], :class => "nav-btn-primary"),
|
|
3
|
+
link_to(icon_label(:trash, 'Delete'), [:admin, item], method: :delete, class: "nav-btn-danger", data: {confirm: 'Are you sure you wish to delete this category? All forums and comments will also be deleted!'})
|
|
4
|
+
])
|
|
5
|
+
%>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% submit_url = (@forum_category.new_record? ? admin_forum_categories_path : admin_forum_category_path) %>
|
|
2
|
+
<%= simple_form_for @forum_category, url: submit_url,
|
|
3
|
+
html: { class: 'form-horizontal' }, wrapper: :bs3_horizontal_form, wrapper_mappings: DmAdmin::FormWrapperMappings do |f| %>
|
|
4
|
+
|
|
5
|
+
<%= f.error_notification message: "Please review the problems below" %>
|
|
6
|
+
<% toolbar = capture do %>
|
|
7
|
+
<%= link_to icons(:cancel), [:admin, @forum_category], class: 'btn btn-link btn-icon' %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<%= panel title: @title, toolbar: toolbar do %>
|
|
10
|
+
<%= locale_tabs do |locale| %>
|
|
11
|
+
<%= f.input "name_#{locale}", label: 'Category Name', id: 'name_error', required: true %>
|
|
12
|
+
<%#= f.input "description_#{locale}", as: :text, label: 'Description', input_html: { rows: 6, class: 'input-block-level monospaced' } %>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<%= submit_or_cancel cancel_url: [:admin, @forum_category], delete_url: ([:admin, @forum_category] unless @forum_category.new_record?), delete_confirm: 'Are you sure you wish to delete this forum category? All forums and comments will also be deleted!' %>
|
|
16
|
+
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<% content_for :content_title, icon_label('font-comments', 'Forum Categories') %>
|
|
2
|
+
|
|
3
|
+
<% toolbar = toolbar_btn(icons(:new), new_admin_forum_category_path, title: 'New Category', class: "btn btn-link btn-icon") %>
|
|
4
|
+
<%= panel body: false, toolbar: toolbar do %>
|
|
5
|
+
<table id="drag_sort" class="table table-striped table-bordered table-block" data-update_url="<%= dm_forum.admin_forum_category_sort_path %>">
|
|
6
|
+
<thead>
|
|
7
|
+
<tr>
|
|
8
|
+
<th class="sort_handle"></th>
|
|
9
|
+
<th>Name</th>
|
|
10
|
+
<th width="50">Status</th>
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
13
|
+
<tbody>
|
|
14
|
+
<% @forum_categories.each do |forum_category| %>
|
|
15
|
+
<tr class="item" data-item_id="<%= forum_category.id %>">
|
|
16
|
+
<td class="sort_handle"></td>
|
|
17
|
+
<td>
|
|
18
|
+
<%= link_to(forum_category.name.to_s_default, admin_forum_category_path(forum_category)) %>
|
|
19
|
+
</td>
|
|
20
|
+
<td></td>
|
|
21
|
+
</tr>
|
|
22
|
+
<% end %>
|
|
23
|
+
</tbody>
|
|
24
|
+
</table>
|
|
25
|
+
<% end %>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<% content_for :content_title, icon_label('font-comments', @forum_category.name) %>
|
|
2
|
+
<% content_for :content_title_extra do %>
|
|
3
|
+
<%= page_header_buttons do %>
|
|
4
|
+
<%= link_to(icon_label(:edit, 'Edit'), [:edit, :admin, @forum_category], class: "btn btn-xs btn-default", title: 'Edit') %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
<% toolbar = toolbar_btn(icons(:new), new_admin_forum_category_forum_path(@forum_category), title: 'New Forum', class: "btn btn-link btn-icon") %>
|
|
9
|
+
<%= panel title: 'Forums', toolbar: toolbar, body: false do %>
|
|
10
|
+
<div class="table-overflow">
|
|
11
|
+
<table id="drag_sort" class="table table-striped table-bordered table-block" data-update_url="<%= dm_forum.admin_forum_sort_path %>">
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th class="sort_handle"></th>
|
|
15
|
+
<th>Name</th>
|
|
16
|
+
<th>Associated Event</th>
|
|
17
|
+
<th width="50">Type</th>
|
|
18
|
+
<th width="50">Status</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<% @forum_category.forums.each do |forum| %>
|
|
23
|
+
<% present forum do |forum_presenter| %>
|
|
24
|
+
<tr class="item" data-item_id="<%= forum.id %>">
|
|
25
|
+
<td class="sort_handle"></td>
|
|
26
|
+
<td>
|
|
27
|
+
<%= link_to forum.name, [:admin, forum] %>
|
|
28
|
+
<div class="description">
|
|
29
|
+
<%= forum.description %>
|
|
30
|
+
</div>
|
|
31
|
+
</td>
|
|
32
|
+
<td><%= forum.owner.try(:title) %></td>
|
|
33
|
+
<td><%= forum_presenter.visibility %></td>
|
|
34
|
+
<td><%= forum_presenter.label_published %></td>
|
|
35
|
+
</tr>
|
|
36
|
+
<% end %>
|
|
37
|
+
<% end %>
|
|
38
|
+
</tbody>
|
|
39
|
+
</table>
|
|
40
|
+
</div>
|
|
41
|
+
<% end %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%= simple_form_for @forum_site, url: dm_forum.admin_forum_site_path,
|
|
2
|
+
html: { class: 'form-horizontal' }, wrapper: :bs3_horizontal_form, wrapper_mappings: DmAdmin::FormWrapperMappings do |f| %>
|
|
3
|
+
|
|
4
|
+
<%= f.error_notification message: "Please review the problems below" %>
|
|
5
|
+
|
|
6
|
+
<% toolbar = capture do %>
|
|
7
|
+
<%= link_to icons(:cancel), dm_forum.admin_forum_site_url, class: 'btn btn-link btn-icon' %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<%= panel title: @title, toolbar: toolbar do %>
|
|
10
|
+
|
|
11
|
+
<%= f.input :enabled, as: :toggle, label: 'Enable Forums?' %>
|
|
12
|
+
<%= f.input :tagline, as: :text, label: 'Tagline', input_html: { rows: 4, class: 'input-block-level' } %>
|
|
13
|
+
<%= f.input :description, as: :text, label: 'Description', input_html: { rows: 4, class: 'input-block-level' } %>
|
|
14
|
+
|
|
15
|
+
<%= submit_or_cancel cancel_url: dm_forum.admin_forum_site_url %>
|
|
16
|
+
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<% toolbar = capture do %>
|
|
2
|
+
<%= @forum_site.enabled? ? colored_label('Forums Enabled', :success) : colored_label('Forums Disabled') %>
|
|
3
|
+
<%= link_to(icons(:edit), dm_forum.edit_admin_forum_site_path, class: "btn btn-link btn-icon") %>
|
|
4
|
+
<% end %>
|
|
5
|
+
<%= panel title: "Forum Settings", toolbar: toolbar do %>
|
|
6
|
+
<dl class="dl-horizontal">
|
|
7
|
+
<dt>Tagline</dt>
|
|
8
|
+
<dd><%= @forum_site.tagline.to_s_default %></dd>
|
|
9
|
+
<dt>Description</dt>
|
|
10
|
+
<dd><%= @forum_site.description.to_s_default %></dd>
|
|
11
|
+
</dl>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%= nav_bar_items([
|
|
2
|
+
link_to(icon_label('icon-edit', 'Edit'), [:edit, :admin, item], class: "nav-btn-primary"),
|
|
3
|
+
link_to(icon_label('icon-trash', 'Delete'), [:admin, item], method: :delete, class: "nav-btn-danger", data: {confirm: 'Are you sure you wish to delete this forum? All comments will also be deleted!'})
|
|
4
|
+
])
|
|
5
|
+
%>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<% submit_url = (@forum.new_record? ? admin_forum_category_forums_path(@forum_category) : admin_forum_path) %>
|
|
2
|
+
<%= simple_form_for @forum, url: submit_url,
|
|
3
|
+
html: { class: 'form-horizontal' }, wrapper: :bs3_horizontal_form, wrapper_mappings: DmAdmin::FormWrapperMappings do |f| %>
|
|
4
|
+
|
|
5
|
+
<%= f.error_notification message: "Please review the problems below" %>
|
|
6
|
+
<% toolbar = capture do %>
|
|
7
|
+
<%= link_to icons(:cancel), (@forum.new_record? ? admin_forum_category_path(@forum.forum_category) : admin_forum_path(@forum)), class: 'btn btn-link btn-icon' %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<%= panel title: @title, toolbar: toolbar do %>
|
|
10
|
+
<%= f.input :name, required: true, autofocus: true %>
|
|
11
|
+
<%= f.input :slug, label: 'Slug', hint: 'Leave blank to have auto-generated based on title.' %>
|
|
12
|
+
<%= f.input :description, as: :text, label: 'Description', input_html: { rows: 4, class: 'input-block-level' } %>
|
|
13
|
+
<%= f.input :published, as: :toggle, label: 'Publish It?' %>
|
|
14
|
+
<%= f.input :is_public, as: :toggle, label: 'Make Forum Public?', hint: 'This will allow anyone to see the forum. Use option below to restrict to registered users' %>
|
|
15
|
+
<%= f.input :requires_login, as: :toggle, label: 'Public Requires Login?', hint: 'If this is a public forum, user must be logged in to see it. (All private forums automatically require login)' %>
|
|
16
|
+
<% if defined? DmSubscriptions %>
|
|
17
|
+
<%= f.input :requires_subscription, as: :toggle, label: 'Subscription Required?', hint: 'User must have a paid subscription to access' %>
|
|
18
|
+
<% end %>
|
|
19
|
+
|
|
20
|
+
<%= submit_or_cancel cancel_url: (@forum.new_record? ? admin_forum_category_path(@forum.forum_category) : admin_forum_path(@forum)),
|
|
21
|
+
delete_url: ([:admin, @forum] unless @forum.new_record?), delete_confirm: 'Are you sure you wish to delete this forum? All comments will also be deleted!' %>
|
|
22
|
+
|
|
23
|
+
<% end %>
|
|
24
|
+
<% end %>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<% content_for :content_title, icon_label('font-comment', @forum.name) %>
|
|
2
|
+
<% content_for :content_title_extra do %>
|
|
3
|
+
<%= page_header_buttons do %>
|
|
4
|
+
<%= link_to(icon_label(:edit, 'Edit'), [:edit, :admin, @forum], class: "btn btn-xs btn-default", title: 'Edit') %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
<%= panel header: false do %>
|
|
9
|
+
<dl>
|
|
10
|
+
<dt>Category</dt>
|
|
11
|
+
<dd><%= link_to @forum.forum_category.name, admin_forum_category_path(@forum.forum_category) %></dd>
|
|
12
|
+
<dt>Description</dt>
|
|
13
|
+
<dd><%= @forum.description %></dd>
|
|
14
|
+
</dl>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<% if @forum.owner %>
|
|
18
|
+
<% toolbar = toolbar_btn(@forum.member_count(:automatic), '#', title: 'Number of users with automatic forum access', class: 'label label-success pull-right') %>
|
|
19
|
+
<%= panel title: 'Users with Automatic Access', toolbar: toolbar do %>
|
|
20
|
+
<h5>Automatic Access Granted for Event</h5>
|
|
21
|
+
<p><%= @forum.owner.title %></p>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<% toolbar = toolbar_btn(@forum.member_count(:manual), '#', title: 'Number of users with forum access', class: 'label label-success pull-right') %>
|
|
27
|
+
<%= panel title: 'Users with Manual Access', toolbar: toolbar do %>
|
|
28
|
+
<div class="row">
|
|
29
|
+
<div class="col-md-6">
|
|
30
|
+
<%= subsection title: 'Users with Access' do %>
|
|
31
|
+
<table class="table table-striped table-bordered">
|
|
32
|
+
<thead>
|
|
33
|
+
<tr>
|
|
34
|
+
<th>Name</th>
|
|
35
|
+
<th>Country</th>
|
|
36
|
+
</tr>
|
|
37
|
+
</thead>
|
|
38
|
+
<tbody>
|
|
39
|
+
<% @forum.member_list(:manual).each do |user| %>
|
|
40
|
+
<tr>
|
|
41
|
+
<td><%= link_to(icons("icon-minus"), dm_forum.forum_delete_member_admin_forum_path(@forum, user_id: user.id), method: :delete, title: 'Remove Access') + " ".html_safe + user.full_name %></td>
|
|
42
|
+
<td><%= user.country.english_name %></td>
|
|
43
|
+
</tr>
|
|
44
|
+
<% end %>
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
<% end %>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="col-md-6">
|
|
51
|
+
<%= subsection title: 'Add Individual Users' do %>
|
|
52
|
+
<div class="table-overflow">
|
|
53
|
+
<table id="forum_user_table" class="table table-striped table-bordered" data-source="<%= dm_forum.forum_users_admin_forum_url %>">
|
|
54
|
+
<thead>
|
|
55
|
+
<tr>
|
|
56
|
+
<th>Name</th>
|
|
57
|
+
<th>Country</th>
|
|
58
|
+
</tr>
|
|
59
|
+
</thead>
|
|
60
|
+
<tbody>
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<% end %>
|
|
66
|
+
</div>
|
|
67
|
+
<% end %>
|
|
68
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div id="markup_help">
|
|
2
|
+
<h3><%= I18n.t 'fms.views_posts.formatting_help' %></h3>
|
|
3
|
+
<p><a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">Markdown</a> <%= I18n.t 'fms.views_posts.formatting_desc' %></p>
|
|
4
|
+
<ul class="list">
|
|
5
|
+
<li><%= t 'fms.views_posts.formatting_bold' %></li>
|
|
6
|
+
<li><%= t 'fms.views_posts.formatting_italics' %></li>
|
|
7
|
+
<li><%= (t 'fms.views_posts.formatting_blockquote').html_safe %></li>
|
|
8
|
+
<li><%= t 'fms.views_posts.formatting_icode' %></li>
|
|
9
|
+
<li><%= (t 'fms.views_posts.formatting_horizontal_rule').html_safe %></li>
|
|
10
|
+
<li><%= (t 'fms.views_posts.formatting_list').html_safe %></li>
|
|
11
|
+
</ul>
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% content_for :page_title, @forum_topic.title %>
|
|
2
|
+
<%= render(:partial => 'dm_forum/forums/forum_header', :object => @forum_topic.forum, :as => :forum) %>
|
|
3
|
+
|
|
4
|
+
<h1 id="topic_title">
|
|
5
|
+
<%= @forum_topic.title %>
|
|
6
|
+
<% if @forum_topic.locked? %>
|
|
7
|
+
<span>(<%= I18n.t 'fms.topic' %> <%= I18n.t 'fms.locked' %>)</span>
|
|
8
|
+
<% end %>
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
11
|
+
<%= simple_form_for [@forum, @forum_topic, @forum_comment], wrapper: simple_form_theme_wrapper do |f| %>
|
|
12
|
+
<%#= f.error_messages %>
|
|
13
|
+
<%= f.input :body, :as => :text, :label => I18n.t('fms.views_topics.body'), :input_html => {:rows => 10} %>
|
|
14
|
+
<%= f.submit I18n.t('fms.views_posts.save'), class: 'btn btn-primary' %>
|
|
15
|
+
<% end %>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<li class="clearfix" id="<%= dom_id(comment_item) %>">
|
|
2
|
+
<div class="user"><%= avatar_for comment_item.user, 48 %></div>
|
|
3
|
+
<p class="comment_author"><%= truncate(comment_item.user.display_name, :length => 30) %>
|
|
4
|
+
<% if false #can?(:moderate, comment_item.forum_topic.forum) || !comment_item.user.active? %>
|
|
5
|
+
<span class="admin">(<%= forum_comment_user_state(comment_item) %>)</span>
|
|
6
|
+
<% end %>
|
|
7
|
+
</p>
|
|
8
|
+
<p class="info">
|
|
9
|
+
<%= present(comment_item).date_posted %>
|
|
10
|
+
<% edited = edited_on_tag(comment_item) %>
|
|
11
|
+
<%= " | #{edited}".html_safe if edited %>
|
|
12
|
+
<%= ' | '.html_safe + link_to(I18n.t('fms.reply'), '#reply') unless @forum_topic.locked? || !user_signed_in? %>
|
|
13
|
+
<% if user_signed_in? && can?(:edit, comment_item) %>
|
|
14
|
+
|
|
|
15
|
+
<%= link_to I18n.t('fms.admin.edit_post'), edit_forum_forum_topic_forum_comment_path(@forum, @forum_topic, comment_item), :class => 'utility' %>
|
|
16
|
+
<% end %>
|
|
17
|
+
</p>
|
|
18
|
+
<div class="clearfix"></div>
|
|
19
|
+
<div class="comment_text">
|
|
20
|
+
<% if comment_item.user.active? %>
|
|
21
|
+
<%= present(comment_item).formatted_comment %>
|
|
22
|
+
<% else %>
|
|
23
|
+
<p>(<% I18n.t 'fms.suspended_user_post' %>)</p>
|
|
24
|
+
<% end %>
|
|
25
|
+
</div>
|
|
26
|
+
</li>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<a name="<%= dom_id @forum_comments.first %>" id="<%= dom_id @forum_comments.first %>"> </a>
|
|
2
|
+
|
|
3
|
+
<div id="comment_section">
|
|
4
|
+
<% if @forum_comments.first.is_root? %>
|
|
5
|
+
<div class="comments clearfix">
|
|
6
|
+
<ul class="comment_list first_comment">
|
|
7
|
+
<%= render(:partial => 'comment_item', object: @forum_comments.first) %>
|
|
8
|
+
</ul>
|
|
9
|
+
</div>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<div class="comment_section_header">
|
|
13
|
+
<div class="num_comments"> <%= "#{@forum_comments.count - 1} #{I18n.t 'cms.comments_stat'}" %></div>
|
|
14
|
+
<% if user_signed_in? and !@forum_topic.locked? %>
|
|
15
|
+
<div class="reply_link"><%= link_to I18n.t('fms.reply_to_topic'), "#reply" %></div>
|
|
16
|
+
<% end %>
|
|
17
|
+
<div class="comment_pagination"><%= pagination(@forum_comments) %></div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<div class="comments clearfix">
|
|
22
|
+
<ul class="comment_list">
|
|
23
|
+
<% for forum_comment in @forum_comments do %>
|
|
24
|
+
<%= render(:partial => 'comment_item', object: forum_comment) unless forum_comment.is_root? %>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% if current_user %>
|
|
27
|
+
<li class="clearfix" id="reply">
|
|
28
|
+
<% if !@forum_topic.locked? %>
|
|
29
|
+
<div class="user"><%= avatar_for current_user, 50 %></div>
|
|
30
|
+
<div class="reply_field">
|
|
31
|
+
<%= simple_form_for [@forum, @forum_topic, @forum_topic.forum_comments.new] do |f| %>
|
|
32
|
+
<%= f.text_area :body, rows: 5, placeholder: I18n.t('cms.add_comment') %>
|
|
33
|
+
<div class="comment_formatting_hint">
|
|
34
|
+
<%= nls :comment_extra_instruction %>
|
|
35
|
+
<%= I18n.t('fms.comment_notification_inform')%>
|
|
36
|
+
</div>
|
|
37
|
+
<%= f.submit I18n.t('fms.views_topics.save_reply'), class: 'btn btn-primary' %>
|
|
38
|
+
<% end %>
|
|
39
|
+
</div>
|
|
40
|
+
<% end %>
|
|
41
|
+
</li>
|
|
42
|
+
<% end %>
|
|
43
|
+
</ul>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<% if @forum_topic.locked? %>
|
|
47
|
+
<div class="topic_locked_message">
|
|
48
|
+
<p class="topic_locked"><%= I18n.t 'fms.views_topics.locked_topic' %></p>
|
|
49
|
+
</div>
|
|
50
|
+
<% elsif !current_user %>
|
|
51
|
+
<p><%= I18n.t 'cms.comment_login_required' %></p>
|
|
52
|
+
<div class="login_required_buttons">
|
|
53
|
+
<%= link_to I18n.t('core.login'), main_app.new_user_session_path, class: 'btn btn-primary' %>
|
|
54
|
+
<%= link_to I18n.t('core.create_account'), main_app.new_user_registration_path, class: 'btn' %>
|
|
55
|
+
</div>
|
|
56
|
+
<% end %>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
<div class="comment_section_footer">
|
|
60
|
+
<div class="comment_pagination"><%= pagination(@forum_comments) %></div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="clear"></div>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<% button_title = following ? I18n.t('fms.follow_stop') : I18n.t('fms.follow') %>
|
|
2
|
+
<% follow_class = following ? 'btn btn-default btn-small follow_active' : 'btn btn-default btn-small' %>
|
|
3
|
+
<%= button_to button_title, forum_forum_topic_toggle_follow_path(@forum, @forum_topic.id), remote: true, method: :patch, id: 'follow_button', class: follow_class %>
|