my_forum 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +12 -1
- data/Rakefile +4 -3
- data/{test/dummy/public/favicon.ico → 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 +2 -0
- data/app/assets/javascripts/my_forum/admin/users.js +2 -0
- data/app/assets/javascripts/my_forum/application.js +6 -0
- data/app/assets/javascripts/my_forum/forums.js.coffee +0 -0
- data/app/assets/javascripts/my_forum/jquery.scrollTo.min.js +7 -0
- data/app/assets/javascripts/my_forum/jquery.selection.js +354 -0
- data/app/assets/javascripts/my_forum/my_forum.js.coffee +118 -0
- data/app/assets/javascripts/my_forum/posts.js.coffee +20 -0
- 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 +3 -0
- data/app/assets/stylesheets/my_forum/admin/forums.css.scss +7 -0
- data/app/assets/stylesheets/my_forum/admin/roles.css +4 -0
- data/app/assets/stylesheets/my_forum/admin/users.css +4 -0
- data/app/assets/stylesheets/my_forum/application.css.scss +80 -0
- data/app/assets/stylesheets/my_forum/forums.css.scss +31 -0
- data/app/assets/stylesheets/my_forum/posts.css.scss +138 -0
- data/app/assets/stylesheets/my_forum/private_messages.css.scss +11 -0
- data/app/assets/stylesheets/my_forum/topics.css.scss +16 -0
- data/app/assets/stylesheets/my_forum/users.css.scss +3 -0
- data/app/assets/stylesheets/my_forum/welcome.css.scss +73 -0
- data/app/controllers/my_forum/admin/categories_controller.rb +36 -0
- data/app/controllers/my_forum/admin/dashboard_controller.rb +13 -0
- data/app/controllers/my_forum/admin/emoticons_controller.rb +65 -0
- data/app/controllers/my_forum/admin/forums_controller.rb +35 -0
- data/app/controllers/my_forum/admin/mail_controller.rb +31 -0
- data/app/controllers/my_forum/admin/roles_controller.rb +38 -0
- data/app/controllers/my_forum/admin/users_controller.rb +14 -0
- data/app/controllers/my_forum/application_controller.rb +81 -0
- data/app/controllers/my_forum/attachments_controller.rb +30 -0
- data/app/controllers/my_forum/forums_controller.rb +39 -0
- data/app/controllers/my_forum/images_controller.rb +7 -0
- data/app/controllers/my_forum/posts_controller.rb +96 -0
- data/app/controllers/my_forum/private_messages_controller.rb +73 -0
- data/app/controllers/my_forum/topics_controller.rb +96 -0
- data/app/controllers/my_forum/users_controller.rb +145 -0
- data/app/controllers/my_forum/welcome_controller.rb +30 -0
- data/app/helpers/my_forum/admin/dashboard_helper.rb +4 -0
- data/app/helpers/my_forum/admin/forums_helper.rb +4 -0
- data/app/helpers/my_forum/admin/roles_helper.rb +4 -0
- data/app/helpers/my_forum/admin/users_helper.rb +4 -0
- data/app/helpers/my_forum/application_helper.rb +43 -0
- data/app/helpers/my_forum/emoticons_helper.rb +7 -0
- data/app/helpers/my_forum/forums_helper.rb +44 -0
- data/app/helpers/my_forum/posts_helper.rb +76 -0
- data/app/helpers/my_forum/private_messages_helper.rb +25 -0
- data/app/helpers/my_forum/topics_helper.rb +18 -0
- data/app/helpers/my_forum/users_helper.rb +33 -0
- data/app/helpers/my_forum/welcome_helper.rb +4 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/mailers/my_forum/user_mailer.rb +31 -0
- data/app/models/my_forum/attachment.rb +12 -0
- data/app/models/my_forum/avatar.rb +11 -0
- data/app/models/my_forum/category.rb +7 -0
- data/app/models/my_forum/category_permission.rb +6 -0
- data/app/models/my_forum/emoticon.rb +6 -0
- data/app/models/my_forum/forum.rb +50 -0
- data/app/models/my_forum/image.rb +5 -0
- data/app/models/my_forum/log_read_mark.rb +4 -0
- data/app/models/my_forum/post.rb +26 -0
- data/app/models/my_forum/private_message.rb +8 -0
- data/app/models/my_forum/role.rb +6 -0
- data/app/models/my_forum/topic.rb +41 -0
- data/app/models/my_forum/user.rb +71 -0
- data/app/models/my_forum/user_group.rb +13 -0
- data/app/models/my_forum/user_group_link.rb +6 -0
- data/app/models/my_forum/user_roles.rb +6 -0
- data/app/views/layouts/mailer.html.erb +5 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/layouts/my_forum/_guest_navbar.html.haml +4 -0
- data/app/views/layouts/my_forum/_user_navbar.html.haml +19 -0
- data/app/views/layouts/my_forum/admin_application.haml +29 -0
- data/app/views/layouts/my_forum/application.haml +23 -0
- data/app/views/my_forum/admin/categories/edit.haml +9 -0
- data/app/views/my_forum/admin/categories/new.haml +5 -0
- data/app/views/my_forum/admin/dashboard/index.haml +0 -0
- data/app/views/my_forum/admin/emoticons/edit.haml +4 -0
- data/app/views/my_forum/admin/emoticons/index.haml +15 -0
- data/app/views/my_forum/admin/emoticons/new.haml +5 -0
- data/app/views/my_forum/admin/forums/index.haml +47 -0
- data/app/views/my_forum/admin/forums/new.haml +6 -0
- data/app/views/my_forum/admin/mail/index.haml +9 -0
- data/app/views/my_forum/admin/roles/index.haml +12 -0
- data/app/views/my_forum/admin/roles/new.haml +22 -0
- data/app/views/my_forum/admin/users/index.haml +10 -0
- data/app/views/my_forum/forums/_topic_subject.html.haml +16 -0
- data/app/views/my_forum/forums/show.haml +29 -0
- data/app/views/my_forum/posts/edit.html.haml +31 -0
- data/app/views/my_forum/private_messages/_sidebar.haml +10 -0
- data/app/views/my_forum/private_messages/inbox.haml +26 -0
- data/app/views/my_forum/private_messages/new.haml +21 -0
- data/app/views/my_forum/private_messages/show.haml +10 -0
- data/app/views/my_forum/shared/_post_preview.haml +15 -0
- data/app/views/my_forum/shared/_upload_photo.haml +45 -0
- data/app/views/my_forum/shared/post_preview.js.coffee +4 -0
- data/app/views/my_forum/topics/_post.haml +29 -0
- data/app/views/my_forum/topics/_profile_popover.haml +47 -0
- data/app/views/my_forum/topics/_quick_answer.haml +34 -0
- data/app/views/my_forum/topics/_topic_header.haml +4 -0
- data/app/views/my_forum/topics/_user_info.haml +9 -0
- data/app/views/my_forum/topics/new.haml +38 -0
- data/app/views/my_forum/topics/show.haml +60 -0
- data/app/views/my_forum/user_mailer/custom_email.text.erb +1 -0
- data/app/views/my_forum/user_mailer/ping_from_post.haml +8 -0
- data/app/views/my_forum/user_mailer/ping_from_post.text.erb +6 -0
- data/app/views/my_forum/user_mailer/pm_notification.text.erb +6 -0
- data/app/views/my_forum/user_mailer/reset_password_email.haml +1 -0
- data/app/views/my_forum/user_mailer/reset_password_email.text.erb +1 -0
- data/app/views/my_forum/users/edit.haml +36 -0
- data/app/views/my_forum/users/forgot_password.haml +10 -0
- data/app/views/my_forum/users/new.haml +14 -0
- data/app/views/my_forum/users/signin.haml +14 -0
- data/app/views/my_forum/users/signout.haml +0 -0
- data/app/views/my_forum/welcome/index.haml +37 -0
- data/config/initializers/will_paginate.rb +24 -0
- data/config/locales/en.yml +68 -0
- data/config/locales/ru.yml +198 -0
- data/config/routes.rb +48 -0
- data/db/migrate/20141117122725_create_my_forum_forums.rb +12 -0
- data/db/migrate/20141117122742_create_my_forum_topics.rb +17 -0
- data/db/migrate/20141117122751_create_my_forum_posts.rb +11 -0
- data/db/migrate/20141118081021_create_my_forum_categories.rb +8 -0
- data/db/migrate/20141118131215_create_my_forum_users.rb +34 -0
- data/db/migrate/20141222094522_create_my_forum_roles.rb +10 -0
- data/db/migrate/20141222094538_create_my_forum_user_roles.rb +9 -0
- data/db/migrate/20150202115250_create_my_forum_log_read_marks.rb +10 -0
- data/db/migrate/20150215200453_create_my_forum_user_groups.rb +15 -0
- data/db/migrate/20150215204852_create_my_forum_user_group_links.rb +9 -0
- data/db/migrate/20150215212443_create_my_forum_category_permissions.rb +9 -0
- data/db/migrate/20150227210814_create_my_forum_private_messages.rb +16 -0
- data/db/migrate/20151012095554_create_my_forum_images.rb +12 -0
- data/db/migrate/20151218135729_add_is_deleted.rb +6 -0
- data/db/migrate/20151220121140_create_my_forum_emoticons.rb +10 -0
- data/db/migrate/20151221203243_my_forum_rename_user_avatar.rb +5 -0
- data/db/migrate/20151221205045_my_forum_change_user_avatar.rb +5 -0
- data/db/migrate/20160122202142_add_latest_post_info_for_topic.rb +24 -0
- data/db/migrate/20160210130805_add_indexes_for_topics.rb +7 -0
- data/db/migrate/20160214085201_add_edited_by_for_post.rb +5 -0
- data/lib/my_forum/engine.rb +31 -0
- data/lib/my_forum/version.rb +1 -1
- data/lib/tasks/my_forum_tasks.rake +155 -4
- data/spec/controllers/my_forum/admin/emoticons_controller_spec.rb +7 -0
- data/spec/controllers/my_forum/admin/mail_controller_spec.rb +7 -0
- data/spec/controllers/my_forum/private_messages_controller_spec.rb +7 -0
- data/spec/controllers/my_forum/users_controller_spec.rb +76 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +1 -1
- data/{app/assets/stylesheets/my_forum → spec/dummy/app/assets/stylesheets}/application.css +1 -1
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/bin/bundle +0 -0
- data/{test → spec}/dummy/bin/rails +0 -0
- data/{test → spec}/dummy/bin/rake +0 -0
- data/{test → spec}/dummy/config/application.rb +0 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +1 -1
- data/{test → spec}/dummy/config/environments/test.rb +1 -1
- data/{test → spec}/dummy/config/initializers/assets.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +0 -0
- data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/{test → spec}/dummy/config/routes.rb +0 -0
- data/{test → spec}/dummy/config/secrets.yml +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +159 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +12 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/my_forum/posts_helper_spec.rb +24 -0
- data/spec/helpers/my_forum/private_messages_helper_spec.rb +17 -0
- data/spec/models/my_forum/emoticon_spec.rb +7 -0
- data/spec/models/my_forum/private_message_spec.rb +7 -0
- data/spec/models/my_forum/user_spec.rb +13 -0
- data/spec/rails_helper.rb +52 -0
- data/spec/spec_helper.rb +87 -0
- metadata +356 -83
- data/app/views/layouts/my_forum/application.html.erb +0 -14
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/integration/navigation_test.rb +0 -10
- data/test/my_forum_test.rb +0 -7
- data/test/test_helper.rb +0 -15
@@ -0,0 +1,24 @@
|
|
1
|
+
module WillPaginate
|
2
|
+
module ActionView
|
3
|
+
def will_paginate(collection = nil, options = {})
|
4
|
+
options[:renderer] ||= BootstrapLinkRenderer
|
5
|
+
super.try :html_safe
|
6
|
+
end
|
7
|
+
|
8
|
+
class BootstrapLinkRenderer < LinkRenderer
|
9
|
+
protected
|
10
|
+
|
11
|
+
def html_container(html)
|
12
|
+
tag :nav, tag(:ul, html, class: 'pagination'), container_attributes
|
13
|
+
end
|
14
|
+
|
15
|
+
def page_number(page)
|
16
|
+
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
|
17
|
+
end
|
18
|
+
|
19
|
+
def previous_or_next_page(page, text, classname)
|
20
|
+
tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
en:
|
2
|
+
my_forum:
|
3
|
+
today: "Today '%{hhmm}'"
|
4
|
+
yerstaday: "Yerstaday '%{hhmm}'"
|
5
|
+
|
6
|
+
admin:
|
7
|
+
forums:
|
8
|
+
index:
|
9
|
+
create_category: 'Create New Category'
|
10
|
+
|
11
|
+
|
12
|
+
categories:
|
13
|
+
new:
|
14
|
+
create_new_category: 'Create new Category'
|
15
|
+
category_name: 'Category name'
|
16
|
+
|
17
|
+
|
18
|
+
forums:
|
19
|
+
new:
|
20
|
+
create_new_forum: 'Create new Forum'
|
21
|
+
forum_name: 'Forum name'
|
22
|
+
forum_description: 'Forum description'
|
23
|
+
|
24
|
+
|
25
|
+
welcome:
|
26
|
+
index:
|
27
|
+
topics_count: "%{topics_count} topics"
|
28
|
+
messages_count: "%{messages_count} messages"
|
29
|
+
last_answer_from: 'Last answer from: '
|
30
|
+
in_forum: 'in '
|
31
|
+
|
32
|
+
forums:
|
33
|
+
topic_subject:
|
34
|
+
author: "Author: %{author}"
|
35
|
+
|
36
|
+
topics:
|
37
|
+
new:
|
38
|
+
name: 'Topic name'
|
39
|
+
description: 'Description'
|
40
|
+
post_text: 'Post text'
|
41
|
+
create_new_topic_in: "Create new topic in '%{topic_name}'"
|
42
|
+
show:
|
43
|
+
messages_in_topic: "Messages in topic: %{count}"
|
44
|
+
user_info:
|
45
|
+
user_posts_count: "%{count} messages"
|
46
|
+
quick_answer:
|
47
|
+
quick_answer: 'Quick answer'
|
48
|
+
advanced_answer: 'Advanced answer'
|
49
|
+
|
50
|
+
users:
|
51
|
+
signin:
|
52
|
+
sign_in_head: 'Forum Enter'
|
53
|
+
new:
|
54
|
+
login: 'Login'
|
55
|
+
email: 'E-mail'
|
56
|
+
password: 'Password'
|
57
|
+
|
58
|
+
layouts:
|
59
|
+
my_forum:
|
60
|
+
user_navbar:
|
61
|
+
welcome_to_forum: 'Welcome back'
|
62
|
+
private_messages: 'Private messages'
|
63
|
+
new_forum_messages: 'New Forum messages'
|
64
|
+
user_profile: 'My profile'
|
65
|
+
logout: 'Logout'
|
66
|
+
guest_navbar:
|
67
|
+
login: 'Login'
|
68
|
+
register: 'Register'
|
@@ -0,0 +1,198 @@
|
|
1
|
+
ru:
|
2
|
+
today: "Сегодня"
|
3
|
+
my_forum:
|
4
|
+
pm:
|
5
|
+
sent: 'Сообщение отправленно'
|
6
|
+
mailer:
|
7
|
+
new_pm_notification_subject: 'Уведомление о новом личном сообщении'
|
8
|
+
ping_user: "Вас упоминули в теме %{topic_name}"
|
9
|
+
shared:
|
10
|
+
post_preview:
|
11
|
+
preview: 'Предпросмотр сообщения'
|
12
|
+
additional_info:
|
13
|
+
real_name: 'Ваше имя'
|
14
|
+
phone: 'Контактный телефон'
|
15
|
+
website_url: 'Ваш сайт'
|
16
|
+
personal_text: 'Подпись'
|
17
|
+
car_info: 'Марка и модель авто'
|
18
|
+
|
19
|
+
profile_popover:
|
20
|
+
posts_count: 'Сообщений: '
|
21
|
+
registered_at: 'Регистрация: '
|
22
|
+
status: 'Статус:'
|
23
|
+
online: 'на форуме'
|
24
|
+
offline: 'не на форуме'
|
25
|
+
last_online: 'Был на форуме:'
|
26
|
+
user_name: 'Имя'
|
27
|
+
phone: 'Телефон'
|
28
|
+
car_info: 'Марка авто'
|
29
|
+
write_pm: 'Написать ЛС'
|
30
|
+
only_for_registereg_users: 'Доступно только зарегестрированным пользователям'
|
31
|
+
|
32
|
+
today: "Сегодня в %{hhmm}"
|
33
|
+
yesterday: "Вчера в %{hhmm}"
|
34
|
+
create_new_pm: 'Написать личное сообщение'
|
35
|
+
create_new_topic: 'Создать новую тему'
|
36
|
+
reply_for_pm: 'Ответить на сообщение'
|
37
|
+
successfull_aploaded: 'Файлы успешно загружены'
|
38
|
+
|
39
|
+
attachments:
|
40
|
+
allowed_extensions: "Разрешенные расширения файлов: %{ext}"
|
41
|
+
|
42
|
+
bbquote:
|
43
|
+
wrote: 'написал'
|
44
|
+
|
45
|
+
admin:
|
46
|
+
forums:
|
47
|
+
index:
|
48
|
+
create_category: 'Создать новую категорию'
|
49
|
+
|
50
|
+
roles:
|
51
|
+
new:
|
52
|
+
role_name: 'Название роли'
|
53
|
+
|
54
|
+
|
55
|
+
categories:
|
56
|
+
new:
|
57
|
+
create_new_category: 'Создать новую категорию'
|
58
|
+
category_name: 'Название категории'
|
59
|
+
|
60
|
+
|
61
|
+
forums:
|
62
|
+
new:
|
63
|
+
create_new_forum: 'Создать новый форум'
|
64
|
+
forum_name: 'Название форума'
|
65
|
+
forum_description: 'Описание форума'
|
66
|
+
|
67
|
+
|
68
|
+
welcome:
|
69
|
+
index:
|
70
|
+
topics_count: "%{topics_count} тем"
|
71
|
+
messages_count: "%{messages_count} сообщений"
|
72
|
+
last_answer_from: 'Последний ответ от: '
|
73
|
+
in_forum: 'в '
|
74
|
+
users_online: 'Сейчас на форуме: '
|
75
|
+
today_online: 'Сегодня на форуме были: '
|
76
|
+
recent_topics: 'Последние сообщения'
|
77
|
+
topic_name: 'Тема:'
|
78
|
+
last_message_from: 'Последнее сообщение от:'
|
79
|
+
date: 'Дата:'
|
80
|
+
|
81
|
+
forums:
|
82
|
+
show:
|
83
|
+
subject: 'Тема'
|
84
|
+
author: 'Автор'
|
85
|
+
answers: 'Ответов'
|
86
|
+
viewa: 'Просмотров'
|
87
|
+
mark_all_as_read: 'Отметить все как прочитанное'
|
88
|
+
last_message: 'Последний ответ'
|
89
|
+
topic_subject:
|
90
|
+
author: "Автор: %{author}"
|
91
|
+
|
92
|
+
topics:
|
93
|
+
new:
|
94
|
+
name: 'Название темы'
|
95
|
+
description: 'Описание'
|
96
|
+
post_text: ''
|
97
|
+
create: 'Создать тему'
|
98
|
+
create_new_topic_in: "Создать новую тему в '%{topic_name}'"
|
99
|
+
show:
|
100
|
+
messages_in_topic: "Сообщений в теме: %{count}"
|
101
|
+
pin_topic: 'Закрепить тему'
|
102
|
+
unpin_topic: 'Открепить тему'
|
103
|
+
lock_topic: 'Закрыть тему'
|
104
|
+
unlock_topic: 'Открыть тему'
|
105
|
+
delete_topic: 'Удалить тему'
|
106
|
+
are_you_sure?: 'Вы уверены?'
|
107
|
+
warning_closed_topic: 'Внимание! Эта тема закрыта, никто кроме вас, не сможет ответить!'
|
108
|
+
user_info:
|
109
|
+
user_posts_count: "%{count} сообщений"
|
110
|
+
quick_answer:
|
111
|
+
quick_answer: 'Быстрый ответ'
|
112
|
+
quick_answer_preview: 'Предварительный просмотр'
|
113
|
+
advanced_answer: 'Расширенный ответ'
|
114
|
+
post:
|
115
|
+
edited_by: "Было отредактированно %{login}, %{date}"
|
116
|
+
sent: "Отправленно: %{datetime}"
|
117
|
+
number: "Сообщение #%{post_number}"
|
118
|
+
quote: 'Цитировать'
|
119
|
+
edit: 'изменить'
|
120
|
+
delete: 'удалить'
|
121
|
+
|
122
|
+
posts:
|
123
|
+
edit:
|
124
|
+
post_text: 'Текст поста'
|
125
|
+
edit_post_in: "Редактировать пост в '%{topic_name}'"
|
126
|
+
|
127
|
+
users:
|
128
|
+
signin:
|
129
|
+
sign_in_head: 'Вход на форум'
|
130
|
+
login: 'Логин'
|
131
|
+
password: 'Пароль'
|
132
|
+
enter: 'Войти'
|
133
|
+
forgot_password: 'Восстановить пароль'
|
134
|
+
new:
|
135
|
+
login: 'Логин'
|
136
|
+
email: 'E-mail'
|
137
|
+
password: 'Пароль'
|
138
|
+
register_new_user: 'Регистрация нового участника'
|
139
|
+
register: 'Зарегестрироваться'
|
140
|
+
forgot_password:
|
141
|
+
forgot_password_head: 'Восстановление пароля'
|
142
|
+
reset_password: 'Сбросить пароль'
|
143
|
+
new_password_sent: 'Новый пароль отправлен на указанный email'
|
144
|
+
edit:
|
145
|
+
edit_profile: 'Редактирование персональных данных'
|
146
|
+
email: 'Электронная почта'
|
147
|
+
current_password: 'Текущий пароль'
|
148
|
+
new_password: 'Новый пароль'
|
149
|
+
avatar: 'Аватар'
|
150
|
+
avatar_upload_description: 'Загрузите свой аватар или укажите ссылку'
|
151
|
+
update: 'Обновить'
|
152
|
+
update_avatar: 'Обновить аватар'
|
153
|
+
edit_additional_info: 'Дополнительная информация'
|
154
|
+
|
155
|
+
|
156
|
+
private_messages:
|
157
|
+
sidebar:
|
158
|
+
inbox: 'Входящие'
|
159
|
+
outbox: 'Отправленные'
|
160
|
+
deleted: 'Удаленные'
|
161
|
+
new:
|
162
|
+
recipient: 'Кому'
|
163
|
+
subject: 'Тема'
|
164
|
+
body: 'Сообщение'
|
165
|
+
new_private_message: 'Написать личное сообщение'
|
166
|
+
send: 'Отправить'
|
167
|
+
create:
|
168
|
+
cant_find_recipient: 'Ошибка, пользователя адресата не существует'
|
169
|
+
|
170
|
+
|
171
|
+
layouts:
|
172
|
+
my_forum:
|
173
|
+
user_navbar:
|
174
|
+
welcome_to_forum: 'Добро пожаловать'
|
175
|
+
private_messages: 'Личные сообщения'
|
176
|
+
new_forum_messages: 'Непрочитанные темы'
|
177
|
+
user_profile: 'Профиль'
|
178
|
+
logout: 'Выход'
|
179
|
+
guest_navbar:
|
180
|
+
login: 'Войти'
|
181
|
+
register: 'Зарегестрироваться'
|
182
|
+
|
183
|
+
|
184
|
+
will_paginate:
|
185
|
+
previous_label: 'Назад'
|
186
|
+
next_label: 'Вперед'
|
187
|
+
page_gap: ''
|
188
|
+
|
189
|
+
|
190
|
+
activerecord:
|
191
|
+
errors:
|
192
|
+
models:
|
193
|
+
my_forum/user:
|
194
|
+
attributes:
|
195
|
+
login:
|
196
|
+
taken: 'Занят'
|
197
|
+
email:
|
198
|
+
taken: 'Занят'
|
data/config/routes.rb
CHANGED
@@ -1,2 +1,50 @@
|
|
1
1
|
MyForum::Engine.routes.draw do
|
2
|
+
root 'welcome#index'
|
3
|
+
|
4
|
+
match 'signin', to: 'users#signin', via: [:get, :post]
|
5
|
+
match 'logout', to: 'users#logout', via: [:get]
|
6
|
+
match 'forgot_password', to: 'users#forgot_password', via: [:get, :post]
|
7
|
+
|
8
|
+
match 'unread_topics', to: 'forums#unread_topics', via: [:get], as: :unread_topics
|
9
|
+
match 'mark_all_as_read', to: 'forums#mark_all_as_read', via: [:get], as: :mark_all_as_read
|
10
|
+
|
11
|
+
match 'post/:id', to: 'posts#show', via: [:get], as: :post_content
|
12
|
+
match 'post/preview', to: 'posts#preview', via: [:post], as: :post_preview
|
13
|
+
|
14
|
+
resources :images
|
15
|
+
resources :avatars
|
16
|
+
resources :attachments
|
17
|
+
|
18
|
+
resources :users do
|
19
|
+
patch :avatar_update
|
20
|
+
|
21
|
+
collection do
|
22
|
+
get :autocomplete
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
resources :private_messages
|
27
|
+
|
28
|
+
resources :forums, only: [:index, :show] do
|
29
|
+
resources :topics do
|
30
|
+
patch :pin
|
31
|
+
patch :close
|
32
|
+
patch :delete
|
33
|
+
resources :posts
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
namespace :admin do
|
38
|
+
root 'dashboard#index'
|
39
|
+
|
40
|
+
match 'forums', to: 'forums#index', via: [:get]
|
41
|
+
match 'mail_list', to: 'mail#index', via: [:get, :post]
|
42
|
+
|
43
|
+
resources :emoticons
|
44
|
+
resources :users
|
45
|
+
resources :roles
|
46
|
+
resources :categories do
|
47
|
+
resources :forums
|
48
|
+
end
|
49
|
+
end
|
2
50
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateMyForumForums < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :my_forum_forums do |t|
|
4
|
+
t.integer :category_id
|
5
|
+
t.string :name
|
6
|
+
t.string :description
|
7
|
+
t.integer :topics_count
|
8
|
+
t.integer :posts_count
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateMyForumTopics < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :my_forum_topics do |t|
|
4
|
+
t.integer :forum_id
|
5
|
+
t.integer :user_id
|
6
|
+
t.integer :latest_post_id
|
7
|
+
t.string :name
|
8
|
+
t.string :description
|
9
|
+
t.integer :views
|
10
|
+
t.integer :posts_count, default: 0
|
11
|
+
t.boolean :pinned, default: false
|
12
|
+
t.boolean :closed, default: false
|
13
|
+
t.boolean :deleted, default: false
|
14
|
+
t.timestamps null: false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class CreateMyForumUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :my_forum_users do |t|
|
4
|
+
t.string :login
|
5
|
+
t.string :password
|
6
|
+
t.string :salt
|
7
|
+
t.string :real_name
|
8
|
+
t.integer :gender
|
9
|
+
t.date :birthdate
|
10
|
+
t.text :signature
|
11
|
+
t.string :avatar
|
12
|
+
t.string :location
|
13
|
+
t.string :user_ip
|
14
|
+
t.text :additional_info
|
15
|
+
t.string :email
|
16
|
+
t.integer :posts_count
|
17
|
+
t.boolean :activated, default: false
|
18
|
+
t.boolean :is_admin, default: false
|
19
|
+
t.boolean :is_moderator, default: false
|
20
|
+
t.boolean :is_deleted, default: false
|
21
|
+
t.boolean :permanently_banned, default: false
|
22
|
+
t.timestamps null: false
|
23
|
+
t.timestamp :last_logged_in
|
24
|
+
end
|
25
|
+
|
26
|
+
MyForum::User.reset_column_information
|
27
|
+
user = MyForum::User.new(login: 'admin', password: 'admin', is_admin: true, email: 'admin@example.com')
|
28
|
+
user.save
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.down
|
32
|
+
drop_table :my_forum_users
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateMyForumUserGroups < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :my_forum_user_groups do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :html_color
|
6
|
+
t.boolean :default, default: false
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
|
10
|
+
MyForum::UserGroup.create!(name: 'Guests')
|
11
|
+
MyForum::UserGroup.create!(name: 'Member', default: true)
|
12
|
+
MyForum::UserGroup.create!(name: 'Moderator')
|
13
|
+
MyForum::UserGroup.create!(name: 'Admin')
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateMyForumPrivateMessages < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :my_forum_private_messages do |t|
|
4
|
+
t.integer :sender_id
|
5
|
+
t.string :sender_login
|
6
|
+
t.integer :recipient_id
|
7
|
+
t.string :recipient_login
|
8
|
+
t.boolean :sender_deleted, :default => false
|
9
|
+
t.boolean :recipient_deleted, :default => false
|
10
|
+
t.boolean :unread, :default => true
|
11
|
+
t.string :subject
|
12
|
+
t.text :body
|
13
|
+
t.timestamps null: false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AddLatestPostInfoForTopic < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :my_forum_topics, :latest_post_created_at, :datetime
|
4
|
+
add_column :my_forum_topics, :latest_post_login, :string
|
5
|
+
add_column :my_forum_topics, :latest_post_user_id, :integer
|
6
|
+
|
7
|
+
count = MyForum::Topic.count
|
8
|
+
MyForum::Topic.find_in_batches do |group|
|
9
|
+
group.each do |topic|
|
10
|
+
puts "#{count-=1} Try to update #{topic.name}"
|
11
|
+
latest_post = topic.posts.last
|
12
|
+
latest_post_user = latest_post.user
|
13
|
+
next unless latest_post_user
|
14
|
+
|
15
|
+
topic.update(
|
16
|
+
latest_post_created_at: latest_post.created_at,
|
17
|
+
latest_post_login: latest_post_user.login,
|
18
|
+
latest_post_user_id: latest_post_user.id
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddIndexesForTopics < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :my_forum_topics, :latest_post_created_at, name: 'index_topics_latest_created_post'
|
4
|
+
add_index :my_forum_topics, [:deleted, :latest_post_created_at], name: 'index_topics_deleted_latest_created_post'
|
5
|
+
add_index :my_forum_topics, [:pinned, :latest_post_created_at, :deleted], name: 'index_topics_pinned_deleted_latest_created_post'
|
6
|
+
end
|
7
|
+
end
|
data/lib/my_forum/engine.rb
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
module MyForum
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace MyForum
|
4
|
+
|
5
|
+
require 'jquery-rails'
|
6
|
+
require 'bootstrap-sass'
|
7
|
+
|
8
|
+
config.after_initialize do
|
9
|
+
ActionView::Base.sanitized_allowed_tags = %w(strong em a img br p i pre div span iframe)
|
10
|
+
ActionView::Base.sanitized_allowed_attributes = %w(href title class src width height target)
|
11
|
+
end
|
12
|
+
|
13
|
+
config.generators do |g|
|
14
|
+
g.test_framework :rspec, :fixture => false
|
15
|
+
g.assets false
|
16
|
+
g.helper false
|
17
|
+
end
|
18
|
+
|
19
|
+
USE_CUSTOM_USER_MODEL = false
|
20
|
+
CUSTOM_USER_CLASS = 'User'
|
21
|
+
CUSTOM_USER_LOGIN_ATTR = 'login'
|
22
|
+
CUSTOM_USER_PASSWORD_ATTR = 'password'
|
23
|
+
CUSTOM_AUTHENTICATE_METHOD = 'users#authenticate'
|
24
|
+
|
25
|
+
attr_accessor :use_custom_user_model, :custom_user_class, :custom_user_login_attr, :custom_user_password_attr,
|
26
|
+
:custom_authenticate_method
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
self.use_custom_user_model = USE_CUSTOM_USER_MODEL
|
30
|
+
self.custom_user_class = CUSTOM_USER_CLASS
|
31
|
+
self.custom_user_login_attr = CUSTOM_USER_LOGIN_ATTR
|
32
|
+
self.custom_user_password_attr = CUSTOM_USER_PASSWORD_ATTR
|
33
|
+
self.custom_authenticate_method = CUSTOM_AUTHENTICATE_METHOD
|
34
|
+
end
|
4
35
|
end
|
5
36
|
end
|
data/lib/my_forum/version.rb
CHANGED