my_forum 0.0.1.beta60 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -12
- data/Rakefile +3 -4
- data/app/assets/javascripts/my_forum/application.js +0 -6
- data/{spec/dummy/app/assets/stylesheets → app/assets/stylesheets/my_forum}/application.css +1 -1
- data/app/controllers/my_forum/application_controller.rb +0 -81
- data/app/helpers/my_forum/application_helper.rb +0 -43
- data/app/views/layouts/my_forum/application.html.erb +14 -0
- data/config/routes.rb +0 -48
- data/lib/my_forum/engine.rb +0 -31
- data/lib/my_forum/version.rb +1 -1
- data/lib/tasks/my_forum_tasks.rake +4 -155
- data/{spec → test}/dummy/README.rdoc +0 -0
- data/{spec → test}/dummy/Rakefile +0 -0
- data/{spec → test}/dummy/app/assets/javascripts/application.js +1 -1
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/{spec → test}/dummy/app/controllers/application_controller.rb +0 -0
- data/{spec → test}/dummy/app/helpers/application_helper.rb +0 -0
- data/{spec → test}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{spec → test}/dummy/bin/bundle +0 -0
- data/{spec → test}/dummy/bin/rails +0 -0
- data/{spec → test}/dummy/bin/rake +0 -0
- data/{spec → test}/dummy/config/application.rb +0 -0
- data/{spec → test}/dummy/config/boot.rb +0 -0
- data/{spec → test}/dummy/config/database.yml +0 -0
- data/{spec → test}/dummy/config/environment.rb +0 -0
- data/{spec → test}/dummy/config/environments/development.rb +0 -0
- data/{spec → test}/dummy/config/environments/production.rb +1 -1
- data/{spec → test}/dummy/config/environments/test.rb +1 -1
- data/{spec → test}/dummy/config/initializers/assets.rb +0 -0
- data/{spec → test}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{spec → test}/dummy/config/initializers/cookies_serializer.rb +0 -0
- data/{spec → test}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/{spec → test}/dummy/config/initializers/inflections.rb +0 -0
- data/{spec → test}/dummy/config/initializers/mime_types.rb +0 -0
- data/{spec → test}/dummy/config/initializers/session_store.rb +0 -0
- data/{spec → test}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{spec → test}/dummy/config/locales/en.yml +0 -0
- data/{spec → test}/dummy/config/routes.rb +0 -0
- data/{spec → test}/dummy/config/secrets.yml +0 -0
- data/{spec → test}/dummy/config.ru +0 -0
- data/{spec → test}/dummy/public/404.html +0 -0
- data/{spec → test}/dummy/public/422.html +0 -0
- data/{spec → test}/dummy/public/500.html +0 -0
- data/{spec → test}/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/my_forum_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +84 -355
- data/app/assets/javascripts/my_forum/admin/categories.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/admin/dashboard.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/admin/forums.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/admin/roles.js +0 -2
- data/app/assets/javascripts/my_forum/admin/users.js +0 -2
- data/app/assets/javascripts/my_forum/forums.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/jquery.scrollTo.min.js +0 -7
- data/app/assets/javascripts/my_forum/jquery.selection.js +0 -354
- data/app/assets/javascripts/my_forum/my_forum.js.coffee +0 -118
- data/app/assets/javascripts/my_forum/posts.js.coffee +0 -20
- data/app/assets/javascripts/my_forum/topics.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/users.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/welcome.js.coffee +0 -0
- data/app/assets/stylesheets/my_forum/admin/categories.css.scss +0 -0
- data/app/assets/stylesheets/my_forum/admin/dashboard.css.scss +0 -3
- data/app/assets/stylesheets/my_forum/admin/forums.css.scss +0 -7
- data/app/assets/stylesheets/my_forum/admin/roles.css +0 -4
- data/app/assets/stylesheets/my_forum/admin/users.css +0 -4
- data/app/assets/stylesheets/my_forum/application.css.scss +0 -80
- data/app/assets/stylesheets/my_forum/forums.css.scss +0 -31
- data/app/assets/stylesheets/my_forum/posts.css.scss +0 -138
- data/app/assets/stylesheets/my_forum/private_messages.css.scss +0 -11
- data/app/assets/stylesheets/my_forum/topics.css.scss +0 -16
- data/app/assets/stylesheets/my_forum/users.css.scss +0 -3
- data/app/assets/stylesheets/my_forum/welcome.css.scss +0 -73
- data/app/controllers/my_forum/admin/categories_controller.rb +0 -36
- data/app/controllers/my_forum/admin/dashboard_controller.rb +0 -13
- data/app/controllers/my_forum/admin/emoticons_controller.rb +0 -65
- data/app/controllers/my_forum/admin/forums_controller.rb +0 -35
- data/app/controllers/my_forum/admin/mail_controller.rb +0 -31
- data/app/controllers/my_forum/admin/roles_controller.rb +0 -38
- data/app/controllers/my_forum/admin/users_controller.rb +0 -14
- data/app/controllers/my_forum/attachments_controller.rb +0 -30
- data/app/controllers/my_forum/forums_controller.rb +0 -39
- data/app/controllers/my_forum/images_controller.rb +0 -7
- data/app/controllers/my_forum/posts_controller.rb +0 -81
- data/app/controllers/my_forum/private_messages_controller.rb +0 -73
- data/app/controllers/my_forum/topics_controller.rb +0 -96
- data/app/controllers/my_forum/users_controller.rb +0 -145
- data/app/controllers/my_forum/welcome_controller.rb +0 -30
- data/app/helpers/my_forum/admin/dashboard_helper.rb +0 -4
- data/app/helpers/my_forum/admin/forums_helper.rb +0 -4
- data/app/helpers/my_forum/admin/roles_helper.rb +0 -4
- data/app/helpers/my_forum/admin/users_helper.rb +0 -4
- data/app/helpers/my_forum/emoticons_helper.rb +0 -7
- data/app/helpers/my_forum/forums_helper.rb +0 -44
- data/app/helpers/my_forum/posts_helper.rb +0 -72
- data/app/helpers/my_forum/private_messages_helper.rb +0 -25
- data/app/helpers/my_forum/topics_helper.rb +0 -18
- data/app/helpers/my_forum/users_helper.rb +0 -33
- data/app/helpers/my_forum/welcome_helper.rb +0 -4
- data/app/mailers/application_mailer.rb +0 -4
- data/app/mailers/my_forum/user_mailer.rb +0 -24
- data/app/models/my_forum/attachment.rb +0 -12
- data/app/models/my_forum/avatar.rb +0 -11
- data/app/models/my_forum/category.rb +0 -7
- data/app/models/my_forum/category_permission.rb +0 -6
- data/app/models/my_forum/emoticon.rb +0 -6
- data/app/models/my_forum/forum.rb +0 -50
- data/app/models/my_forum/image.rb +0 -5
- data/app/models/my_forum/log_read_mark.rb +0 -4
- data/app/models/my_forum/post.rb +0 -26
- data/app/models/my_forum/private_message.rb +0 -8
- data/app/models/my_forum/role.rb +0 -6
- data/app/models/my_forum/topic.rb +0 -41
- data/app/models/my_forum/user.rb +0 -71
- data/app/models/my_forum/user_group.rb +0 -13
- data/app/models/my_forum/user_group_link.rb +0 -6
- data/app/models/my_forum/user_roles.rb +0 -6
- data/app/views/layouts/mailer.html.erb +0 -5
- data/app/views/layouts/mailer.text.erb +0 -1
- data/app/views/layouts/my_forum/_guest_navbar.html.haml +0 -4
- data/app/views/layouts/my_forum/_user_navbar.html.haml +0 -19
- data/app/views/layouts/my_forum/admin_application.haml +0 -29
- data/app/views/layouts/my_forum/application.haml +0 -23
- data/app/views/my_forum/admin/categories/edit.haml +0 -9
- data/app/views/my_forum/admin/categories/new.haml +0 -5
- data/app/views/my_forum/admin/dashboard/index.haml +0 -0
- data/app/views/my_forum/admin/emoticons/edit.haml +0 -4
- data/app/views/my_forum/admin/emoticons/index.haml +0 -15
- data/app/views/my_forum/admin/emoticons/new.haml +0 -5
- data/app/views/my_forum/admin/forums/index.haml +0 -47
- data/app/views/my_forum/admin/forums/new.haml +0 -6
- data/app/views/my_forum/admin/mail/index.haml +0 -9
- data/app/views/my_forum/admin/roles/index.haml +0 -12
- data/app/views/my_forum/admin/roles/new.haml +0 -22
- data/app/views/my_forum/admin/users/index.haml +0 -10
- data/app/views/my_forum/forums/_topic_subject.html.haml +0 -16
- data/app/views/my_forum/forums/show.haml +0 -29
- data/app/views/my_forum/posts/edit.html.haml +0 -31
- data/app/views/my_forum/private_messages/_sidebar.haml +0 -10
- data/app/views/my_forum/private_messages/inbox.haml +0 -26
- data/app/views/my_forum/private_messages/new.haml +0 -21
- data/app/views/my_forum/private_messages/show.haml +0 -10
- data/app/views/my_forum/shared/_post_preview.haml +0 -15
- data/app/views/my_forum/shared/_upload_photo.haml +0 -45
- data/app/views/my_forum/shared/post_preview.js.coffee +0 -4
- data/app/views/my_forum/topics/_post.haml +0 -29
- data/app/views/my_forum/topics/_profile_popover.haml +0 -47
- data/app/views/my_forum/topics/_quick_answer.haml +0 -34
- data/app/views/my_forum/topics/_topic_header.haml +0 -4
- data/app/views/my_forum/topics/_user_info.haml +0 -9
- data/app/views/my_forum/topics/new.haml +0 -38
- data/app/views/my_forum/topics/show.haml +0 -60
- data/app/views/my_forum/user_mailer/custom_email.text.erb +0 -1
- data/app/views/my_forum/user_mailer/pm_notification.text.erb +0 -6
- data/app/views/my_forum/user_mailer/reset_password_email.haml +0 -1
- data/app/views/my_forum/user_mailer/reset_password_email.text.erb +0 -1
- data/app/views/my_forum/users/edit.haml +0 -36
- data/app/views/my_forum/users/forgot_password.haml +0 -10
- data/app/views/my_forum/users/new.haml +0 -14
- data/app/views/my_forum/users/signin.haml +0 -14
- data/app/views/my_forum/users/signout.haml +0 -0
- data/app/views/my_forum/welcome/index.haml +0 -37
- data/config/initializers/will_paginate.rb +0 -24
- data/config/locales/en.yml +0 -68
- data/config/locales/ru.yml +0 -196
- data/db/migrate/20141117122725_create_my_forum_forums.rb +0 -12
- data/db/migrate/20141117122742_create_my_forum_topics.rb +0 -17
- data/db/migrate/20141117122751_create_my_forum_posts.rb +0 -11
- data/db/migrate/20141118081021_create_my_forum_categories.rb +0 -8
- data/db/migrate/20141118131215_create_my_forum_users.rb +0 -34
- data/db/migrate/20141222094522_create_my_forum_roles.rb +0 -10
- data/db/migrate/20141222094538_create_my_forum_user_roles.rb +0 -9
- data/db/migrate/20150202115250_create_my_forum_log_read_marks.rb +0 -10
- data/db/migrate/20150215200453_create_my_forum_user_groups.rb +0 -15
- data/db/migrate/20150215204852_create_my_forum_user_group_links.rb +0 -9
- data/db/migrate/20150215212443_create_my_forum_category_permissions.rb +0 -9
- data/db/migrate/20150227210814_create_my_forum_private_messages.rb +0 -16
- data/db/migrate/20151012095554_create_my_forum_images.rb +0 -12
- data/db/migrate/20151218135729_add_is_deleted.rb +0 -6
- data/db/migrate/20151220121140_create_my_forum_emoticons.rb +0 -10
- data/db/migrate/20151221203243_my_forum_rename_user_avatar.rb +0 -5
- data/db/migrate/20151221205045_my_forum_change_user_avatar.rb +0 -5
- data/db/migrate/20160122202142_add_latest_post_info_for_topic.rb +0 -24
- data/db/migrate/20160210130805_add_indexes_for_topics.rb +0 -7
- data/db/migrate/20160214085201_add_edited_by_for_post.rb +0 -5
- data/spec/controllers/my_forum/admin/emoticons_controller_spec.rb +0 -7
- data/spec/controllers/my_forum/admin/mail_controller_spec.rb +0 -7
- data/spec/controllers/my_forum/private_messages_controller_spec.rb +0 -7
- data/spec/controllers/my_forum/users_controller_spec.rb +0 -76
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +0 -159
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -12
- data/spec/helpers/my_forum/posts_helper_spec.rb +0 -24
- data/spec/helpers/my_forum/private_messages_helper_spec.rb +0 -17
- data/spec/models/my_forum/emoticon_spec.rb +0 -7
- data/spec/models/my_forum/private_message_spec.rb +0 -7
- data/spec/models/my_forum/user_spec.rb +0 -13
- data/spec/rails_helper.rb +0 -52
- data/spec/spec_helper.rb +0 -87
@@ -1,50 +0,0 @@
|
|
1
|
-
module MyForum
|
2
|
-
class Forum < ActiveRecord::Base
|
3
|
-
belongs_to :category
|
4
|
-
has_many :topics
|
5
|
-
has_many :posts
|
6
|
-
|
7
|
-
def has_unread_posts?(current_user)
|
8
|
-
return false unless current_user
|
9
|
-
|
10
|
-
latest_post_ids = self.topics.where('latest_post_created_at >= ?', current_user.created_at).pluck(:latest_post_id)
|
11
|
-
read_log = []
|
12
|
-
read_log = LogReadMark.where("user_id = ? AND post_id IN (?)", current_user.id, latest_post_ids).pluck(:post_id) unless latest_post_ids.blank?
|
13
|
-
|
14
|
-
!(latest_post_ids - read_log).empty?
|
15
|
-
end
|
16
|
-
|
17
|
-
# Forum index page
|
18
|
-
def topics_with_latest_post_info(page: 0, per_page: 30)
|
19
|
-
Topic.paginate_by_sql("
|
20
|
-
SELECT
|
21
|
-
my_forum_topics.*,
|
22
|
-
my_forum_topics.latest_post_created_at AS last_post_time,
|
23
|
-
my_forum_topics.latest_post_login AS last_post_user_login
|
24
|
-
FROM my_forum_topics
|
25
|
-
WHERE my_forum_topics.forum_id = #{self.id} AND my_forum_topics.deleted IS FALSE
|
26
|
-
ORDER BY my_forum_topics.pinned DESC, my_forum_topics.latest_post_created_at DESC
|
27
|
-
", page: page, per_page: per_page)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.unread_topics_with_latest_post_info(user_id:, page: 0, per_page: 30)
|
31
|
-
log_topic_ids = LogReadMark.where(user_id: user_id).pluck(:topic_id)
|
32
|
-
log_topic_ids = [0] if log_topic_ids.empty?
|
33
|
-
|
34
|
-
Topic.paginate_by_sql("
|
35
|
-
SELECT
|
36
|
-
my_forum_topics.*,
|
37
|
-
my_forum_topics.latest_post_created_at AS last_post_time,
|
38
|
-
my_forum_topics.latest_post_login AS last_post_user_login
|
39
|
-
FROM my_forum_topics
|
40
|
-
WHERE my_forum_topics.id NOT IN (#{log_topic_ids.join(',')}) AND my_forum_topics.deleted IS FALSE
|
41
|
-
ORDER BY my_forum_topics.id DESC
|
42
|
-
", page: page, per_page: per_page)
|
43
|
-
end
|
44
|
-
|
45
|
-
def unread_topics_with_user
|
46
|
-
log_topic_ids = LogReadMark.where(user_id: current_user.id).pluck(:topic_id)
|
47
|
-
Topic.where('id NOT IN (?)', log_topic_ids).order('updated_at DESC').paginate(:page => params[:page], :per_page => 30)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/app/models/my_forum/post.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module MyForum
|
2
|
-
class Post < ActiveRecord::Base
|
3
|
-
belongs_to :topic, :counter_cache => true
|
4
|
-
belongs_to :user, :counter_cache => true
|
5
|
-
|
6
|
-
after_create :update_topic_latest_post
|
7
|
-
after_update :update_topic_latest_post, :if => :is_deleted?
|
8
|
-
|
9
|
-
default_scope { where(is_deleted: false) }
|
10
|
-
|
11
|
-
PER_PAGE = 15
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def update_topic_latest_post
|
16
|
-
post = self.is_deleted ? Post.where(topic_id: self.topic_id).last : self
|
17
|
-
|
18
|
-
self.topic.update(
|
19
|
-
latest_post_id: post.id,
|
20
|
-
latest_post_created_at: post.created_at,
|
21
|
-
latest_post_login: post.user.login,
|
22
|
-
latest_post_user_id: post.user.id
|
23
|
-
)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
module MyForum
|
2
|
-
class PrivateMessage < ActiveRecord::Base
|
3
|
-
scope :unread_count_for, -> (user) { where(recipient_id: user.id, unread: true).count }
|
4
|
-
scope :inbox_for, -> (user) { where(recipient_id: user.id).order('created_at DESC') }
|
5
|
-
|
6
|
-
attr_accessor :recipient
|
7
|
-
end
|
8
|
-
end
|
data/app/models/my_forum/role.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
module MyForum
|
2
|
-
class Topic < ActiveRecord::Base
|
3
|
-
has_many :posts, counter_cache: true, dependent: :destroy
|
4
|
-
belongs_to :forum, counter_cache: true
|
5
|
-
belongs_to :user
|
6
|
-
|
7
|
-
default_scope { where(deleted: false) }
|
8
|
-
|
9
|
-
def info
|
10
|
-
author = (post = posts.first).user.login
|
11
|
-
created = post.created_at
|
12
|
-
|
13
|
-
{ author: author, created: created }
|
14
|
-
end
|
15
|
-
|
16
|
-
def owner
|
17
|
-
posts.first.user
|
18
|
-
end
|
19
|
-
|
20
|
-
def unread?(current_user, last_post)
|
21
|
-
return false unless current_user
|
22
|
-
return false if current_user.created_at > last_post.created_at
|
23
|
-
|
24
|
-
logged_post = LogReadMark.where(user_id: current_user.id, topic_id: self.id).first
|
25
|
-
return true unless logged_post
|
26
|
-
|
27
|
-
last_post.id > logged_post.post_id
|
28
|
-
end
|
29
|
-
|
30
|
-
def mark_as_read(current_user, last_post)
|
31
|
-
return true unless current_user
|
32
|
-
|
33
|
-
log = LogReadMark.find_or_create_by(user_id: current_user.id, topic_id: self.id)
|
34
|
-
|
35
|
-
if last_post.id.to_i > log.post_id.to_i
|
36
|
-
log.post_id = last_post.id
|
37
|
-
log.save
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/app/models/my_forum/user.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
module MyForum
|
2
|
-
class User < ActiveRecord::Base
|
3
|
-
require 'digest'
|
4
|
-
|
5
|
-
has_many :posts, class_name: 'MyForum::Post'
|
6
|
-
has_many :attachments
|
7
|
-
has_many :user_roles
|
8
|
-
has_many :roles, through: :user_roles
|
9
|
-
has_many :user_group_links
|
10
|
-
has_many :user_groups, through: :user_group_links
|
11
|
-
|
12
|
-
has_one :avatar
|
13
|
-
|
14
|
-
default_scope { where(is_deleted: false) }
|
15
|
-
scope :online, -> { where("updated_at > ?", 10.minutes.ago) }
|
16
|
-
scope :today_visited, -> { where("updated_at > ?", Time.now.beginning_of_day) }
|
17
|
-
|
18
|
-
enum gender: [:female, :male, :alien]
|
19
|
-
serialize :additional_info
|
20
|
-
|
21
|
-
validates_uniqueness_of :login, :email
|
22
|
-
|
23
|
-
before_save :encrypt_password
|
24
|
-
|
25
|
-
ADDITIONAL_INFO_ATTRS = [:real_name, :phone, :car_info]
|
26
|
-
#, :website_url, :personal_text
|
27
|
-
|
28
|
-
def self.serialized_attr_accessor(*args)
|
29
|
-
ADDITIONAL_INFO_ATTRS.each do |attr|
|
30
|
-
eval "
|
31
|
-
def #{attr}
|
32
|
-
(self.additional_info || {})[:#{attr}]
|
33
|
-
end
|
34
|
-
|
35
|
-
def #{attr}=(value)
|
36
|
-
self.additional_info ||= {}
|
37
|
-
self.additional_info[:#{attr}] = value
|
38
|
-
end"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# TODO should be stored in DB for editin from admin panel
|
43
|
-
#serialized_attr_accessor :real_name, :phone, :website_url, :personal_text
|
44
|
-
serialized_attr_accessor
|
45
|
-
|
46
|
-
def valid_password?(submitted_password)
|
47
|
-
password == encrypt(submitted_password)
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def encrypt_password
|
53
|
-
return unless password_changed?
|
54
|
-
|
55
|
-
self.salt = make_salt unless valid_password?(password)
|
56
|
-
self.password = encrypt(password)
|
57
|
-
end
|
58
|
-
|
59
|
-
def encrypt(string)
|
60
|
-
secure_hash("#{salt}--#{string}")
|
61
|
-
end
|
62
|
-
|
63
|
-
def make_salt
|
64
|
-
secure_hash("#{Time.now.utc}--#{password}")
|
65
|
-
end
|
66
|
-
|
67
|
-
def secure_hash(string)
|
68
|
-
Digest::SHA2.hexdigest(string)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module MyForum
|
2
|
-
class UserGroup < ActiveRecord::Base
|
3
|
-
has_many :user_group_links
|
4
|
-
has_many :users, through: :user_group_links
|
5
|
-
|
6
|
-
has_many :category_permissions
|
7
|
-
has_many :categories, through: :category_permissions
|
8
|
-
|
9
|
-
# TODO fix this
|
10
|
-
GUEST_GROUP = UserGroup.find_by_name('Guests') #find(1)
|
11
|
-
MEMBER_GROUP = UserGroup.find_by_name('Member') #.find(2)
|
12
|
-
end
|
13
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= yield %>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
.col-md-6
|
2
|
-
= "#{t('.welcome_to_forum')}, #{current_user.login}"
|
3
|
-
= current_user.id if Rails.env.development?
|
4
|
-
|
5
|
-
.col-md-6
|
6
|
-
.btn-group.pull-right{ role: 'group' }
|
7
|
-
=link_to private_messages_path, class: 'btn btn-sm btn-default' do
|
8
|
-
=t('.private_messages')
|
9
|
-
= new_private_messages_count_bage
|
10
|
-
%span.glyphicon.glyphicon-envelope
|
11
|
-
=link_to unread_topics_path, class: 'btn btn-sm btn-default' do
|
12
|
-
=t('.new_forum_messages')
|
13
|
-
%span.glyphicon.glyphicon-eye-open
|
14
|
-
=link_to edit_user_path(current_user), class: 'btn btn-sm btn-default' do
|
15
|
-
=t('.user_profile')
|
16
|
-
%span.glyphicon.glyphicon-user
|
17
|
-
= link_to logout_path, class: 'btn btn-sm btn-default' do
|
18
|
-
=t('.logout')
|
19
|
-
%span.glyphicon.glyphicon-log-out
|
@@ -1,29 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
%title Forum
|
5
|
-
= stylesheet_link_tag 'my_forum/application', media: 'all', 'data-turbolinks-track' => true
|
6
|
-
= javascript_include_tag 'my_forum/application', 'data-turbolinks-track' => true
|
7
|
-
= csrf_meta_tag
|
8
|
-
|
9
|
-
%body#admin
|
10
|
-
%nav.navbar.navbar-inverse.navbar-fixed-top{ role: 'navigation'}
|
11
|
-
.container-fluid
|
12
|
-
.navbar-header
|
13
|
-
=link_to 'Admin panel', admin_root_path, class: 'navbar-brand'
|
14
|
-
|
15
|
-
|
16
|
-
#admin-content.container-fluid
|
17
|
-
.row
|
18
|
-
.col-sm-3.col-md-2.sidebar
|
19
|
-
%ul.nav.nav-sidebar
|
20
|
-
%li= link_to t('.manage_forums'), admin_forums_path
|
21
|
-
%li= link_to t('.manage_roles'), admin_roles_path
|
22
|
-
%li= link_to t('.manage_users'), admin_users_path
|
23
|
-
%li= link_to t('.manage_mail'), admin_mail_list_path
|
24
|
-
%li= link_to t('.manage_emoticons'), admin_emoticons_path
|
25
|
-
|
26
|
-
.col-sm-9.col-md-10
|
27
|
-
= yield
|
28
|
-
|
29
|
-
|
@@ -1,23 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
%title Forum
|
5
|
-
= stylesheet_link_tag 'my_forum/application', media: 'all', 'data-turbolinks-track' => true
|
6
|
-
= javascript_include_tag 'my_forum/application', 'data-turbolinks-track' => true
|
7
|
-
= csrf_meta_tag
|
8
|
-
|
9
|
-
%body.container-fluid
|
10
|
-
|
11
|
-
#forum_header
|
12
|
-
#guest_navbar
|
13
|
-
= render current_user ? '/layouts/my_forum/user_navbar' : '/layouts/my_forum/guest_navbar'
|
14
|
-
|
15
|
-
#body
|
16
|
-
- if flash[:notice]
|
17
|
-
.row
|
18
|
-
.alert.alert-success.text-center{ role: 'alert' }
|
19
|
-
= flash[:notice]
|
20
|
-
.row
|
21
|
-
.col-md-6
|
22
|
-
#forum-navigation= draw_navigation
|
23
|
-
= yield
|
File without changes
|
@@ -1,15 +0,0 @@
|
|
1
|
-
- if @emoticons.blank?
|
2
|
-
=t('.no_emoticons')
|
3
|
-
- else
|
4
|
-
%table.table
|
5
|
-
-@emoticons.each do |smile|
|
6
|
-
%tr
|
7
|
-
%td= smile.code
|
8
|
-
%td
|
9
|
-
%img{ src: emoticon_url_for(smile), class: 'smile' }
|
10
|
-
%td= smile.is_active
|
11
|
-
%td= link_to t('.edit'), edit_admin_emoticon_path(smile)
|
12
|
-
%td= link_to t('.delete'), admin_emoticon_path(smile), method: :delete, data: { confirm: "Are you sure?" }
|
13
|
-
|
14
|
-
|
15
|
-
=link_to t('.add'), new_admin_emoticon_path
|
@@ -1,47 +0,0 @@
|
|
1
|
-
.page-header
|
2
|
-
%h2= t('.forums')
|
3
|
-
|
4
|
-
= link_to t('.create_category'), new_admin_category_path, class: 'btn btn-primary btn-sm'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
.container-fluid
|
9
|
-
- @categories.each do |category|
|
10
|
-
.row.category_box
|
11
|
-
.col-md-10.category_name
|
12
|
-
=category.name
|
13
|
-
.col-md-2.category_name
|
14
|
-
.pull-right.btn-group.btn-group-sm{ rel: 'group' }
|
15
|
-
= link_to t('.create_forum'), new_admin_category_forum_path(category), class: 'btn btn-default'
|
16
|
-
.pull-right.btn-group.btn-group-sm{ rel: 'group' }
|
17
|
-
= link_to t('.edit'), edit_admin_category_path(category), class: 'btn btn-default'
|
18
|
-
|
19
|
-
-# .btn-group.btn-group-sm
|
20
|
-
-# %button{ class: 'btn btn-default dropdown-toggle', data: { toggle: 'dropdown', aria_haspopup: true, aria_expanded: false } }
|
21
|
-
-# Options
|
22
|
-
-# %span.caret
|
23
|
-
-# %ul{ class: 'dropdown-menu'}
|
24
|
-
-# %li= link_to t('.edit'), edit_admin_category_path(category)
|
25
|
-
-# %li= link_to t('.delete'), '#'
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
.row.category_forums
|
36
|
-
.col-md-12
|
37
|
-
= t('.no_forums') if category.forums.blank?
|
38
|
-
-category.forums.each do |forum|
|
39
|
-
.row
|
40
|
-
.col-md-12
|
41
|
-
%strong=forum.name
|
42
|
-
%br
|
43
|
-
=forum.description
|
44
|
-
|
45
|
-
.pull-right
|
46
|
-
=link_to '', '#', class: 'glyphicon glyphicon-edit'
|
47
|
-
=link_to '', '#', class: 'glyphicon glyphicon-trash'
|
@@ -1,22 +0,0 @@
|
|
1
|
-
.page-header
|
2
|
-
%h2= t('.new-role')
|
3
|
-
|
4
|
-
= form_for @role, url: admin_roles_path do |f|
|
5
|
-
.row
|
6
|
-
= f.text_field :name, placeholder: t('.role_name')
|
7
|
-
.row
|
8
|
-
= f.text_field :color
|
9
|
-
|
10
|
-
-# .row
|
11
|
-
-# admin access
|
12
|
-
-# .btn-group{ 'data-toggle' => "buttons" }
|
13
|
-
-# =f.label :admin_access, class: 'btn btn-success btn-sm active' do
|
14
|
-
-# = f.radio_button :admin_access, true
|
15
|
-
-# yes
|
16
|
-
-# =f.label :admin_access, class: 'btn btn-danger btn-sm' do
|
17
|
-
-# = f.radio_button :admin_access, false
|
18
|
-
-# no
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
= f.submit
|
@@ -1,16 +0,0 @@
|
|
1
|
-
- forum ||= topic.forum
|
2
|
-
|
3
|
-
.row
|
4
|
-
.col-md-12
|
5
|
-
- if topic.pinned?
|
6
|
-
%i.fa.fa-thumb-tack
|
7
|
-
- if topic.unread?(current_user, topic.posts.last)
|
8
|
-
.new_topic.label.label-warning= t('.new')
|
9
|
-
- if topic.closed?
|
10
|
-
%i.fa.fa-lock
|
11
|
-
|
12
|
-
= link_to topic.name.html_safe, forum_topic_path(forum, topic)
|
13
|
-
.row
|
14
|
-
.col-md-12.topic_description
|
15
|
-
=# topic.description.html_safe
|
16
|
-
= t('.author', author: topic.owner.login)
|
@@ -1,29 +0,0 @@
|
|
1
|
-
= new_topic_button
|
2
|
-
|
3
|
-
- if current_user
|
4
|
-
= link_to t('.mark_all_as_read'), mark_all_as_read_path
|
5
|
-
|
6
|
-
.container-fluid
|
7
|
-
.row.forum-header
|
8
|
-
.col-md-1
|
9
|
-
.col-md-6=t('.subject')
|
10
|
-
.col-md-1=t('.author')
|
11
|
-
.col-md-1=t('.answers')
|
12
|
-
.col-md-1=t('.views')
|
13
|
-
.col-md-2=t('.last_message')
|
14
|
-
|
15
|
-
.row.topic-list-container
|
16
|
-
.box.topic-list
|
17
|
-
- if @forum_topics.blank?
|
18
|
-
.row.topic-row
|
19
|
-
.col-md-12.col-sm-12.text-center= t('.no-topics')
|
20
|
-
- else
|
21
|
-
- @forum_topics.each do |topic|
|
22
|
-
.row.topic-row
|
23
|
-
.col-md-7.col-sm-7= render 'topic_subject', topic: topic, forum: @forum
|
24
|
-
.col-md-1.col-sm-1= topic.posts.first.user.login rescue '-'
|
25
|
-
.col-md-1.col-sm-1= topic.posts_count
|
26
|
-
.col-md-1.col-sm-1= topic.views.to_i
|
27
|
-
.col-md-2.col-sm-2.info= topic_last_post_info(topic)
|
28
|
-
|
29
|
-
= will_paginate @forum_topics
|
@@ -1,31 +0,0 @@
|
|
1
|
-
%h2= t('.edit_post_in', topic_name: @topic.name)
|
2
|
-
|
3
|
-
#edit-post
|
4
|
-
= form_for @post, url: forum_topic_post_path(@forum, @topic, @post, page: params[:page]), role: 'form' do |form|
|
5
|
-
.row
|
6
|
-
.col-md-12
|
7
|
-
.text-editor-buttons{ data: { apply_to: 'post_text' } }
|
8
|
-
%div.btn-group
|
9
|
-
=link_to '#', class: 'btn btn-default btn-sm' do
|
10
|
-
%i{ class: 'fa fa-bold' }
|
11
|
-
=link_to '#', class: 'btn btn-default btn-sm' do
|
12
|
-
%i{ class: 'fa fa-italic' }
|
13
|
-
=link_to '#', class: 'btn btn-default btn-sm' do
|
14
|
-
%i{ class: 'fa fa-strikethrough' }
|
15
|
-
=link_to '#', class: 'btn btn-default btn-sm' do
|
16
|
-
%i{ class: 'fa fa-underline' }
|
17
|
-
|
18
|
-
%div.btn-group
|
19
|
-
=link_to '#', class: 'btn btn-default btn-sm', data: { toggle: 'modal' } do
|
20
|
-
%i{ class: 'fa fa-camera-retro' }
|
21
|
-
|
22
|
-
%div.btn-group.smiles
|
23
|
-
- emoticons_list.each do |code, path|
|
24
|
-
=link_to '#', class: 'btn btn-default btn-sm smile-past' do
|
25
|
-
%img{ src: path, class: 'smile', data: { code: code } }
|
26
|
-
|
27
|
-
.form-group= form.text_area :text, placeholder: t('.post_text'), class: 'form-control', rows: 10
|
28
|
-
|
29
|
-
= form.submit class: 'btn '
|
30
|
-
|
31
|
-
= render partial: 'my_forum/shared/upload_photo', locals: { textarea: 'post_text' }
|
@@ -1,26 +0,0 @@
|
|
1
|
-
.container-fluid
|
2
|
-
.row
|
3
|
-
.col-md-2
|
4
|
-
= render partial: 'sidebar'
|
5
|
-
|
6
|
-
.col-md-10
|
7
|
-
|
8
|
-
= new_pm_button
|
9
|
-
|
10
|
-
.panel.panel-default
|
11
|
-
.panel-heading= t('.private_messages')
|
12
|
-
%table.table
|
13
|
-
%thead
|
14
|
-
%tr
|
15
|
-
%td=t('.date')
|
16
|
-
%td=t('.from')
|
17
|
-
%td=t('.subject')
|
18
|
-
%tbody
|
19
|
-
- @private_messages.each do |message|
|
20
|
-
%tr
|
21
|
-
- html_class = 'unread' if message.unread?
|
22
|
-
%td=link_to message.created_at.strftime('%d-%b-%y %H:%M'), private_message_url(message), class: html_class
|
23
|
-
%td=link_to message.sender_login, private_message_url(message), class: html_class
|
24
|
-
%td=link_to message.subject, private_message_url(message), class: html_class
|
25
|
-
|
26
|
-
= will_paginate @private_messages
|
@@ -1,21 +0,0 @@
|
|
1
|
-
.container-fluid
|
2
|
-
.row
|
3
|
-
.col-md-2
|
4
|
-
= render partial: 'sidebar'
|
5
|
-
|
6
|
-
.col-md-10
|
7
|
-
%h2= t('.new_private_message')
|
8
|
-
|
9
|
-
= errors_for @pm
|
10
|
-
|
11
|
-
= form_for @pm, url: private_messages_path, role: 'form', autocomplete: 'off' do |form|
|
12
|
-
- if params[:reply]
|
13
|
-
.form-group= form.text_field :recipient, value: @reply_pm.sender_login, autocomplete: 'off', class: 'subject form-control'
|
14
|
-
.form-group= form.text_field :subject, value: @reply_pm.subject ,class: 'subject form-control', placeholder: t('.subject')
|
15
|
-
- else
|
16
|
-
.form-group= form.text_field :recipient, value: params[:to], class: 'subject form-control autocomplete', placeholder: t('.recipient'), data: { autocomplete_path: autocomplete_users_path }
|
17
|
-
.form-group= form.text_field :subject, class: 'subject form-control', placeholder: t('.subject')
|
18
|
-
|
19
|
-
.form-group= form.text_area :body, class: 'body form-control', placeholder: t('.body')
|
20
|
-
|
21
|
-
= form.submit t('.send'), class: 'btn btn-primary btn-sm'
|