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
data/config/locales/ru.yml
DELETED
@@ -1,196 +0,0 @@
|
|
1
|
-
ru:
|
2
|
-
today: "Сегодня"
|
3
|
-
my_forum:
|
4
|
-
pm:
|
5
|
-
sent: 'Сообщение отправленно'
|
6
|
-
mailer:
|
7
|
-
new_pm_notification_subject: 'Уведомление о новом личном сообщении'
|
8
|
-
shared:
|
9
|
-
post_preview:
|
10
|
-
preview: 'Предпросмотр сообщения'
|
11
|
-
additional_info:
|
12
|
-
real_name: 'Ваше имя'
|
13
|
-
phone: 'Контактный телефон'
|
14
|
-
website_url: 'Ваш сайт'
|
15
|
-
personal_text: 'Подпись'
|
16
|
-
car_info: 'Марка и модель авто'
|
17
|
-
|
18
|
-
profile_popover:
|
19
|
-
posts_count: 'Сообщений: '
|
20
|
-
registered_at: 'Регистрация: '
|
21
|
-
status: 'Статус:'
|
22
|
-
online: 'на форуме'
|
23
|
-
offline: 'не на форуме'
|
24
|
-
last_online: 'Был на форуме:'
|
25
|
-
user_name: 'Имя'
|
26
|
-
phone: 'Телефон'
|
27
|
-
car_info: 'Марка авто'
|
28
|
-
write_pm: 'Написать ЛС'
|
29
|
-
only_for_registereg_users: 'Доступно только зарегестрированным пользователям'
|
30
|
-
|
31
|
-
today: "Сегодня в %{hhmm}"
|
32
|
-
yesterday: "Вчера в %{hhmm}"
|
33
|
-
create_new_pm: 'Написать личное сообщение'
|
34
|
-
create_new_topic: 'Создать новую тему'
|
35
|
-
reply_for_pm: 'Ответить на сообщение'
|
36
|
-
successfull_aploaded: 'Файлы успешно загружены'
|
37
|
-
|
38
|
-
attachments:
|
39
|
-
allowed_extensions: "Разрешенные расширения файлов: %{ext}"
|
40
|
-
|
41
|
-
bbquote:
|
42
|
-
wrote: 'написал'
|
43
|
-
|
44
|
-
admin:
|
45
|
-
forums:
|
46
|
-
index:
|
47
|
-
create_category: 'Создать новую категорию'
|
48
|
-
|
49
|
-
roles:
|
50
|
-
new:
|
51
|
-
role_name: 'Название роли'
|
52
|
-
|
53
|
-
|
54
|
-
categories:
|
55
|
-
new:
|
56
|
-
create_new_category: 'Создать новую категорию'
|
57
|
-
category_name: 'Название категории'
|
58
|
-
|
59
|
-
|
60
|
-
forums:
|
61
|
-
new:
|
62
|
-
create_new_forum: 'Создать новый форум'
|
63
|
-
forum_name: 'Название форума'
|
64
|
-
forum_description: 'Описание форума'
|
65
|
-
|
66
|
-
|
67
|
-
welcome:
|
68
|
-
index:
|
69
|
-
topics_count: "%{topics_count} тем"
|
70
|
-
messages_count: "%{messages_count} сообщений"
|
71
|
-
last_answer_from: 'Последний ответ от: '
|
72
|
-
in_forum: 'в '
|
73
|
-
users_online: 'Сейчас на форуме: '
|
74
|
-
today_online: 'Сегодня на форуме были: '
|
75
|
-
recent_topics: 'Последние сообщения'
|
76
|
-
topic_name: 'Тема:'
|
77
|
-
last_message_from: 'Последнее сообщение от:'
|
78
|
-
date: 'Дата:'
|
79
|
-
|
80
|
-
forums:
|
81
|
-
show:
|
82
|
-
subject: 'Тема'
|
83
|
-
author: 'Автор'
|
84
|
-
answers: 'Ответов'
|
85
|
-
viewa: 'Просмотров'
|
86
|
-
mark_all_as_read: 'Отметить все как прочитанное'
|
87
|
-
last_message: 'Последний ответ'
|
88
|
-
topic_subject:
|
89
|
-
author: "Автор: %{author}"
|
90
|
-
|
91
|
-
topics:
|
92
|
-
new:
|
93
|
-
name: 'Название темы'
|
94
|
-
description: 'Описание'
|
95
|
-
post_text: ''
|
96
|
-
create_new_topic_in: "Создать новую тему в '%{topic_name}'"
|
97
|
-
show:
|
98
|
-
messages_in_topic: "Сообщений в теме: %{count}"
|
99
|
-
pin_topic: 'Закрепить тему'
|
100
|
-
unpin_topic: 'Открепить тему'
|
101
|
-
lock_topic: 'Закрыть тему'
|
102
|
-
unlock_topic: 'Открыть тему'
|
103
|
-
delete_topic: 'Удалить тему'
|
104
|
-
are_you_sure?: 'Вы уверены?'
|
105
|
-
warning_closed_topic: 'Внимание! Эта тема закрыта, никто кроме вас, не сможет ответить!'
|
106
|
-
user_info:
|
107
|
-
user_posts_count: "%{count} сообщений"
|
108
|
-
quick_answer:
|
109
|
-
quick_answer: 'Быстрый ответ'
|
110
|
-
quick_answer_preview: 'Предварительный просмотр'
|
111
|
-
advanced_answer: 'Расширенный ответ'
|
112
|
-
post:
|
113
|
-
edited_by: "Было отредактированно %{login}, %{date}"
|
114
|
-
sent: "Отправленно: %{datetime}"
|
115
|
-
number: "Сообщение #%{post_number}"
|
116
|
-
quote: 'Цитировать'
|
117
|
-
edit: 'изменить'
|
118
|
-
delete: 'удалить'
|
119
|
-
|
120
|
-
posts:
|
121
|
-
edit:
|
122
|
-
post_text: 'Текст поста'
|
123
|
-
edit_post_in: "Редактировать пост в '%{topic_name}'"
|
124
|
-
|
125
|
-
users:
|
126
|
-
signin:
|
127
|
-
sign_in_head: 'Вход на форум'
|
128
|
-
login: 'Логин'
|
129
|
-
password: 'Пароль'
|
130
|
-
enter: 'Войти'
|
131
|
-
forgot_password: 'Восстановить пароль'
|
132
|
-
new:
|
133
|
-
login: 'Логин'
|
134
|
-
email: 'E-mail'
|
135
|
-
password: 'Пароль'
|
136
|
-
register_new_user: 'Регистрация нового участника'
|
137
|
-
register: 'Зарегестрироваться'
|
138
|
-
forgot_password:
|
139
|
-
forgot_password_head: 'Восстановление пароля'
|
140
|
-
reset_password: 'Сбросить пароль'
|
141
|
-
new_password_sent: 'Новый пароль отправлен на указанный email'
|
142
|
-
edit:
|
143
|
-
edit_profile: 'Редактирование персональных данных'
|
144
|
-
email: 'Электронная почта'
|
145
|
-
current_password: 'Текущий пароль'
|
146
|
-
new_password: 'Новый пароль'
|
147
|
-
avatar: 'Аватар'
|
148
|
-
avatar_upload_description: 'Загрузите свой аватар или укажите ссылку'
|
149
|
-
update: 'Обновить'
|
150
|
-
update_avatar: 'Обновить аватар'
|
151
|
-
edit_additional_info: 'Дополнительная информация'
|
152
|
-
|
153
|
-
|
154
|
-
private_messages:
|
155
|
-
sidebar:
|
156
|
-
inbox: 'Входящие'
|
157
|
-
outbox: 'Отправленные'
|
158
|
-
deleted: 'Удаленные'
|
159
|
-
new:
|
160
|
-
recipient: 'Кому'
|
161
|
-
subject: 'Тема'
|
162
|
-
body: 'Сообщение'
|
163
|
-
new_private_message: 'Написать личное сообщение'
|
164
|
-
send: 'Отправить'
|
165
|
-
create:
|
166
|
-
cant_find_recipient: 'Ошибка, пользователя адресата не существует'
|
167
|
-
|
168
|
-
|
169
|
-
layouts:
|
170
|
-
my_forum:
|
171
|
-
user_navbar:
|
172
|
-
welcome_to_forum: 'Добро пожаловать'
|
173
|
-
private_messages: 'Личные сообщения'
|
174
|
-
new_forum_messages: 'Непрочитанные темы'
|
175
|
-
user_profile: 'Профиль'
|
176
|
-
logout: 'Выход'
|
177
|
-
guest_navbar:
|
178
|
-
login: 'Войти'
|
179
|
-
register: 'Зарегестрироваться'
|
180
|
-
|
181
|
-
|
182
|
-
will_paginate:
|
183
|
-
previous_label: 'Назад'
|
184
|
-
next_label: 'Вперед'
|
185
|
-
page_gap: ''
|
186
|
-
|
187
|
-
|
188
|
-
activerecord:
|
189
|
-
errors:
|
190
|
-
models:
|
191
|
-
my_forum/user:
|
192
|
-
attributes:
|
193
|
-
login:
|
194
|
-
taken: 'Занят'
|
195
|
-
email:
|
196
|
-
taken: 'Занят'
|
@@ -1,12 +0,0 @@
|
|
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
|
@@ -1,17 +0,0 @@
|
|
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
|
@@ -1,34 +0,0 @@
|
|
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
|
@@ -1,15 +0,0 @@
|
|
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
|
@@ -1,16 +0,0 @@
|
|
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
|
@@ -1,24 +0,0 @@
|
|
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
|
@@ -1,7 +0,0 @@
|
|
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
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
module MyForum
|
4
|
-
RSpec.describe UsersController, type: :controller do
|
5
|
-
routes { MyForum::Engine.routes }
|
6
|
-
|
7
|
-
describe 'Loggin in' do
|
8
|
-
it 'should login user by password' do
|
9
|
-
user = User.create!(login: 'demo', password: '12345678', email: 'demo@example.com')
|
10
|
-
|
11
|
-
post :signin, user: { login: 'demo', password: '12345678' }
|
12
|
-
expect(session[:user_id]).to eq(user.id)
|
13
|
-
expect(response).to redirect_to(root_path)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should not login user if login or password incorrect' do
|
17
|
-
post :signin, user: { login: '', password: '' }
|
18
|
-
expect(response).to render_template(:signin)
|
19
|
-
expect(session[:user_id]).to eq(nil)
|
20
|
-
|
21
|
-
post :signin, user: { login: 'wrong', password: 'credentials' }
|
22
|
-
expect(response).to render_template(:signin)
|
23
|
-
expect(session[:user_id]).to eq(nil)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#forgot_password" do
|
28
|
-
it 'should send new generated password for user' do
|
29
|
-
user = User.create!(login: 'demo', password: '12345678', email: 'demo@example.com')
|
30
|
-
session[:user_id] = user.id
|
31
|
-
expect(user.valid_password?('12345678')).to be true
|
32
|
-
|
33
|
-
post :forgot_password, user: { email: 'demo@example.com'}
|
34
|
-
expect(user.reload.valid_password?('12345678')).to be false
|
35
|
-
|
36
|
-
last_delivery = ActionMailer::Base.deliveries.last
|
37
|
-
new_password = last_delivery.text_part.body.decoded.split(' ').last
|
38
|
-
expect(user.reload.valid_password?(new_password)).to be true
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "#edit" do
|
43
|
-
before :each do
|
44
|
-
@user = User.create!(login: 'demo', password: '12345678', email: 'demo@example.com')
|
45
|
-
session[:user_id] = @user.id
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should not change password' do
|
49
|
-
patch :update, id: @user.id, user: {email: 'abc@google.com', password: ''}
|
50
|
-
expect(@user.reload.valid_password?('12345678')).to be true
|
51
|
-
expect(@user.reload.email).to eq('abc@google.com')
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should not change password if old password not given' do
|
55
|
-
patch :update, id: @user.id, user: {email: 'abc@google.com', password: 'new_password'}
|
56
|
-
expect(@user.reload.valid_password?('new_password')).to be false
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should update user with password' do
|
60
|
-
expect(@user.reload.valid_password?('12345678')).to be true
|
61
|
-
patch :update, id: @user.id, user: {email: 'abc@google.com', password: '12345678', new_password: 'new_password'}
|
62
|
-
expect(@user.reload.valid_password?('new_password')).to be true
|
63
|
-
expect(@user.reload.email).to eq('abc@google.com')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "#create" do
|
68
|
-
it 'should create new user' do
|
69
|
-
post :create, user: {email: 'new_user@google.com', password: 'new_user_pass', login: 'new_user'}
|
70
|
-
user = User.find_by_email('new_user@google.com')
|
71
|
-
expect(user.login).to eq('new_user')
|
72
|
-
expect(user.valid_password?('new_user_pass')).to be true
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
Binary file
|