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.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +12 -1
  3. data/Rakefile +4 -3
  4. data/{test/dummy/public/favicon.ico → app/assets/javascripts/my_forum/admin/categories.js.coffee} +0 -0
  5. data/app/assets/javascripts/my_forum/admin/dashboard.js.coffee +0 -0
  6. data/app/assets/javascripts/my_forum/admin/forums.js.coffee +0 -0
  7. data/app/assets/javascripts/my_forum/admin/roles.js +2 -0
  8. data/app/assets/javascripts/my_forum/admin/users.js +2 -0
  9. data/app/assets/javascripts/my_forum/application.js +6 -0
  10. data/app/assets/javascripts/my_forum/forums.js.coffee +0 -0
  11. data/app/assets/javascripts/my_forum/jquery.scrollTo.min.js +7 -0
  12. data/app/assets/javascripts/my_forum/jquery.selection.js +354 -0
  13. data/app/assets/javascripts/my_forum/my_forum.js.coffee +118 -0
  14. data/app/assets/javascripts/my_forum/posts.js.coffee +20 -0
  15. data/app/assets/javascripts/my_forum/topics.js.coffee +0 -0
  16. data/app/assets/javascripts/my_forum/users.js.coffee +0 -0
  17. data/app/assets/javascripts/my_forum/welcome.js.coffee +0 -0
  18. data/app/assets/stylesheets/my_forum/admin/categories.css.scss +0 -0
  19. data/app/assets/stylesheets/my_forum/admin/dashboard.css.scss +3 -0
  20. data/app/assets/stylesheets/my_forum/admin/forums.css.scss +7 -0
  21. data/app/assets/stylesheets/my_forum/admin/roles.css +4 -0
  22. data/app/assets/stylesheets/my_forum/admin/users.css +4 -0
  23. data/app/assets/stylesheets/my_forum/application.css.scss +80 -0
  24. data/app/assets/stylesheets/my_forum/forums.css.scss +31 -0
  25. data/app/assets/stylesheets/my_forum/posts.css.scss +138 -0
  26. data/app/assets/stylesheets/my_forum/private_messages.css.scss +11 -0
  27. data/app/assets/stylesheets/my_forum/topics.css.scss +16 -0
  28. data/app/assets/stylesheets/my_forum/users.css.scss +3 -0
  29. data/app/assets/stylesheets/my_forum/welcome.css.scss +73 -0
  30. data/app/controllers/my_forum/admin/categories_controller.rb +36 -0
  31. data/app/controllers/my_forum/admin/dashboard_controller.rb +13 -0
  32. data/app/controllers/my_forum/admin/emoticons_controller.rb +65 -0
  33. data/app/controllers/my_forum/admin/forums_controller.rb +35 -0
  34. data/app/controllers/my_forum/admin/mail_controller.rb +31 -0
  35. data/app/controllers/my_forum/admin/roles_controller.rb +38 -0
  36. data/app/controllers/my_forum/admin/users_controller.rb +14 -0
  37. data/app/controllers/my_forum/application_controller.rb +81 -0
  38. data/app/controllers/my_forum/attachments_controller.rb +30 -0
  39. data/app/controllers/my_forum/forums_controller.rb +39 -0
  40. data/app/controllers/my_forum/images_controller.rb +7 -0
  41. data/app/controllers/my_forum/posts_controller.rb +96 -0
  42. data/app/controllers/my_forum/private_messages_controller.rb +73 -0
  43. data/app/controllers/my_forum/topics_controller.rb +96 -0
  44. data/app/controllers/my_forum/users_controller.rb +145 -0
  45. data/app/controllers/my_forum/welcome_controller.rb +30 -0
  46. data/app/helpers/my_forum/admin/dashboard_helper.rb +4 -0
  47. data/app/helpers/my_forum/admin/forums_helper.rb +4 -0
  48. data/app/helpers/my_forum/admin/roles_helper.rb +4 -0
  49. data/app/helpers/my_forum/admin/users_helper.rb +4 -0
  50. data/app/helpers/my_forum/application_helper.rb +43 -0
  51. data/app/helpers/my_forum/emoticons_helper.rb +7 -0
  52. data/app/helpers/my_forum/forums_helper.rb +44 -0
  53. data/app/helpers/my_forum/posts_helper.rb +76 -0
  54. data/app/helpers/my_forum/private_messages_helper.rb +25 -0
  55. data/app/helpers/my_forum/topics_helper.rb +18 -0
  56. data/app/helpers/my_forum/users_helper.rb +33 -0
  57. data/app/helpers/my_forum/welcome_helper.rb +4 -0
  58. data/app/mailers/application_mailer.rb +4 -0
  59. data/app/mailers/my_forum/user_mailer.rb +31 -0
  60. data/app/models/my_forum/attachment.rb +12 -0
  61. data/app/models/my_forum/avatar.rb +11 -0
  62. data/app/models/my_forum/category.rb +7 -0
  63. data/app/models/my_forum/category_permission.rb +6 -0
  64. data/app/models/my_forum/emoticon.rb +6 -0
  65. data/app/models/my_forum/forum.rb +50 -0
  66. data/app/models/my_forum/image.rb +5 -0
  67. data/app/models/my_forum/log_read_mark.rb +4 -0
  68. data/app/models/my_forum/post.rb +26 -0
  69. data/app/models/my_forum/private_message.rb +8 -0
  70. data/app/models/my_forum/role.rb +6 -0
  71. data/app/models/my_forum/topic.rb +41 -0
  72. data/app/models/my_forum/user.rb +71 -0
  73. data/app/models/my_forum/user_group.rb +13 -0
  74. data/app/models/my_forum/user_group_link.rb +6 -0
  75. data/app/models/my_forum/user_roles.rb +6 -0
  76. data/app/views/layouts/mailer.html.erb +5 -0
  77. data/app/views/layouts/mailer.text.erb +1 -0
  78. data/app/views/layouts/my_forum/_guest_navbar.html.haml +4 -0
  79. data/app/views/layouts/my_forum/_user_navbar.html.haml +19 -0
  80. data/app/views/layouts/my_forum/admin_application.haml +29 -0
  81. data/app/views/layouts/my_forum/application.haml +23 -0
  82. data/app/views/my_forum/admin/categories/edit.haml +9 -0
  83. data/app/views/my_forum/admin/categories/new.haml +5 -0
  84. data/app/views/my_forum/admin/dashboard/index.haml +0 -0
  85. data/app/views/my_forum/admin/emoticons/edit.haml +4 -0
  86. data/app/views/my_forum/admin/emoticons/index.haml +15 -0
  87. data/app/views/my_forum/admin/emoticons/new.haml +5 -0
  88. data/app/views/my_forum/admin/forums/index.haml +47 -0
  89. data/app/views/my_forum/admin/forums/new.haml +6 -0
  90. data/app/views/my_forum/admin/mail/index.haml +9 -0
  91. data/app/views/my_forum/admin/roles/index.haml +12 -0
  92. data/app/views/my_forum/admin/roles/new.haml +22 -0
  93. data/app/views/my_forum/admin/users/index.haml +10 -0
  94. data/app/views/my_forum/forums/_topic_subject.html.haml +16 -0
  95. data/app/views/my_forum/forums/show.haml +29 -0
  96. data/app/views/my_forum/posts/edit.html.haml +31 -0
  97. data/app/views/my_forum/private_messages/_sidebar.haml +10 -0
  98. data/app/views/my_forum/private_messages/inbox.haml +26 -0
  99. data/app/views/my_forum/private_messages/new.haml +21 -0
  100. data/app/views/my_forum/private_messages/show.haml +10 -0
  101. data/app/views/my_forum/shared/_post_preview.haml +15 -0
  102. data/app/views/my_forum/shared/_upload_photo.haml +45 -0
  103. data/app/views/my_forum/shared/post_preview.js.coffee +4 -0
  104. data/app/views/my_forum/topics/_post.haml +29 -0
  105. data/app/views/my_forum/topics/_profile_popover.haml +47 -0
  106. data/app/views/my_forum/topics/_quick_answer.haml +34 -0
  107. data/app/views/my_forum/topics/_topic_header.haml +4 -0
  108. data/app/views/my_forum/topics/_user_info.haml +9 -0
  109. data/app/views/my_forum/topics/new.haml +38 -0
  110. data/app/views/my_forum/topics/show.haml +60 -0
  111. data/app/views/my_forum/user_mailer/custom_email.text.erb +1 -0
  112. data/app/views/my_forum/user_mailer/ping_from_post.haml +8 -0
  113. data/app/views/my_forum/user_mailer/ping_from_post.text.erb +6 -0
  114. data/app/views/my_forum/user_mailer/pm_notification.text.erb +6 -0
  115. data/app/views/my_forum/user_mailer/reset_password_email.haml +1 -0
  116. data/app/views/my_forum/user_mailer/reset_password_email.text.erb +1 -0
  117. data/app/views/my_forum/users/edit.haml +36 -0
  118. data/app/views/my_forum/users/forgot_password.haml +10 -0
  119. data/app/views/my_forum/users/new.haml +14 -0
  120. data/app/views/my_forum/users/signin.haml +14 -0
  121. data/app/views/my_forum/users/signout.haml +0 -0
  122. data/app/views/my_forum/welcome/index.haml +37 -0
  123. data/config/initializers/will_paginate.rb +24 -0
  124. data/config/locales/en.yml +68 -0
  125. data/config/locales/ru.yml +198 -0
  126. data/config/routes.rb +48 -0
  127. data/db/migrate/20141117122725_create_my_forum_forums.rb +12 -0
  128. data/db/migrate/20141117122742_create_my_forum_topics.rb +17 -0
  129. data/db/migrate/20141117122751_create_my_forum_posts.rb +11 -0
  130. data/db/migrate/20141118081021_create_my_forum_categories.rb +8 -0
  131. data/db/migrate/20141118131215_create_my_forum_users.rb +34 -0
  132. data/db/migrate/20141222094522_create_my_forum_roles.rb +10 -0
  133. data/db/migrate/20141222094538_create_my_forum_user_roles.rb +9 -0
  134. data/db/migrate/20150202115250_create_my_forum_log_read_marks.rb +10 -0
  135. data/db/migrate/20150215200453_create_my_forum_user_groups.rb +15 -0
  136. data/db/migrate/20150215204852_create_my_forum_user_group_links.rb +9 -0
  137. data/db/migrate/20150215212443_create_my_forum_category_permissions.rb +9 -0
  138. data/db/migrate/20150227210814_create_my_forum_private_messages.rb +16 -0
  139. data/db/migrate/20151012095554_create_my_forum_images.rb +12 -0
  140. data/db/migrate/20151218135729_add_is_deleted.rb +6 -0
  141. data/db/migrate/20151220121140_create_my_forum_emoticons.rb +10 -0
  142. data/db/migrate/20151221203243_my_forum_rename_user_avatar.rb +5 -0
  143. data/db/migrate/20151221205045_my_forum_change_user_avatar.rb +5 -0
  144. data/db/migrate/20160122202142_add_latest_post_info_for_topic.rb +24 -0
  145. data/db/migrate/20160210130805_add_indexes_for_topics.rb +7 -0
  146. data/db/migrate/20160214085201_add_edited_by_for_post.rb +5 -0
  147. data/lib/my_forum/engine.rb +31 -0
  148. data/lib/my_forum/version.rb +1 -1
  149. data/lib/tasks/my_forum_tasks.rake +155 -4
  150. data/spec/controllers/my_forum/admin/emoticons_controller_spec.rb +7 -0
  151. data/spec/controllers/my_forum/admin/mail_controller_spec.rb +7 -0
  152. data/spec/controllers/my_forum/private_messages_controller_spec.rb +7 -0
  153. data/spec/controllers/my_forum/users_controller_spec.rb +76 -0
  154. data/{test → spec}/dummy/README.rdoc +0 -0
  155. data/{test → spec}/dummy/Rakefile +0 -0
  156. data/{test → spec}/dummy/app/assets/javascripts/application.js +1 -1
  157. data/{app/assets/stylesheets/my_forum → spec/dummy/app/assets/stylesheets}/application.css +1 -1
  158. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  159. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  160. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  161. data/{test → spec}/dummy/bin/bundle +0 -0
  162. data/{test → spec}/dummy/bin/rails +0 -0
  163. data/{test → spec}/dummy/bin/rake +0 -0
  164. data/{test → spec}/dummy/config/application.rb +0 -0
  165. data/{test → spec}/dummy/config/boot.rb +0 -0
  166. data/{test → spec}/dummy/config/database.yml +0 -0
  167. data/{test → spec}/dummy/config/environment.rb +0 -0
  168. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  169. data/{test → spec}/dummy/config/environments/production.rb +1 -1
  170. data/{test → spec}/dummy/config/environments/test.rb +1 -1
  171. data/{test → spec}/dummy/config/initializers/assets.rb +0 -0
  172. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  173. data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +0 -0
  174. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  175. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  176. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  177. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  178. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  179. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  180. data/{test → spec}/dummy/config/routes.rb +0 -0
  181. data/{test → spec}/dummy/config/secrets.yml +0 -0
  182. data/{test → spec}/dummy/config.ru +0 -0
  183. data/spec/dummy/db/development.sqlite3 +0 -0
  184. data/spec/dummy/db/schema.rb +159 -0
  185. data/spec/dummy/db/test.sqlite3 +0 -0
  186. data/spec/dummy/log/development.log +12 -0
  187. data/{test → spec}/dummy/public/404.html +0 -0
  188. data/{test → spec}/dummy/public/422.html +0 -0
  189. data/{test → spec}/dummy/public/500.html +0 -0
  190. data/spec/dummy/public/favicon.ico +0 -0
  191. data/spec/helpers/my_forum/posts_helper_spec.rb +24 -0
  192. data/spec/helpers/my_forum/private_messages_helper_spec.rb +17 -0
  193. data/spec/models/my_forum/emoticon_spec.rb +7 -0
  194. data/spec/models/my_forum/private_message_spec.rb +7 -0
  195. data/spec/models/my_forum/user_spec.rb +13 -0
  196. data/spec/rails_helper.rb +52 -0
  197. data/spec/spec_helper.rb +87 -0
  198. metadata +356 -83
  199. data/app/views/layouts/my_forum/application.html.erb +0 -14
  200. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  201. data/test/integration/navigation_test.rb +0 -10
  202. data/test/my_forum_test.rb +0 -7
  203. 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,11 @@
1
+ class CreateMyForumPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_posts do |t|
4
+ t.integer :user_id
5
+ t.integer :topic_id
6
+ t.integer :forum_id
7
+ t.text :text, :limit => 4294967295
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ class CreateMyForumCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_categories do |t|
4
+ t.string :name
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ 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,10 @@
1
+ class CreateMyForumRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_roles do |t|
4
+ t.string :name
5
+ t.string :color
6
+ t.text :rights
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMyForumUserRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_user_roles do |t|
4
+ t.integer :user_id
5
+ t.integer :role_id
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMyForumLogReadMarks < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_log_read_marks do |t|
4
+ t.integer :user_id
5
+ t.integer :topic_id
6
+ t.integer :post_id
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ 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,9 @@
1
+ class CreateMyForumUserGroupLinks < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_user_group_links do |t|
4
+ t.integer :user_id
5
+ t.integer :user_group_id
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMyForumCategoryPermissions < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_category_permissions do |t|
4
+ t.integer :user_group_id
5
+ t.integer :category_id
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ 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,12 @@
1
+ class CreateMyForumImages < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_images do |t|
4
+ t.integer :user_id
5
+ t.integer :post_id
6
+ t.string :file_name
7
+ t.integer :file_size
8
+ t.string :type
9
+ t.timestamps null: false
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class AddIsDeleted < ActiveRecord::Migration
2
+ def change
3
+ add_column :my_forum_posts, :is_deleted, :boolean, default: false
4
+ add_column :my_forum_topics, :is_deleted, :boolean, default: false
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ class CreateMyForumEmoticons < ActiveRecord::Migration
2
+ def change
3
+ create_table :my_forum_emoticons do |t|
4
+ t.string :file_name
5
+ t.string :code
6
+ t.boolean :is_active, default: true
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class MyForumRenameUserAvatar < ActiveRecord::Migration
2
+ def change
3
+ rename_column :my_forum_users, :avatar, :avatar_url
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class MyForumChangeUserAvatar < ActiveRecord::Migration
2
+ def change
3
+ change_column :my_forum_users, :avatar_url, :text, length: 350
4
+ end
5
+ 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
@@ -0,0 +1,5 @@
1
+ class AddEditedByForPost < ActiveRecord::Migration
2
+ def change
3
+ add_column :my_forum_posts, :edited_by, :string, default: nil
4
+ end
5
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end