my_forum 0.0.1.beta37 → 0.0.1.beta38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/my_forum/application.css.scss +9 -0
- data/app/assets/stylesheets/my_forum/posts.css.scss +11 -2
- data/app/controllers/my_forum/users_controller.rb +7 -1
- data/app/controllers/my_forum/welcome_controller.rb +1 -1
- data/app/helpers/my_forum/users_helper.rb +4 -0
- data/app/models/my_forum/user.rb +22 -1
- data/app/views/my_forum/topics/_profile_popover.haml +42 -19
- data/app/views/my_forum/users/edit.haml +9 -0
- data/config/locales/ru.yml +14 -4
- data/lib/my_forum/version.rb +1 -1
- metadata +2 -6
- data/spec/dummy/log/test.log +0 -3719
- data/spec/dummy/test.db +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31f75c76f47fdee65be36da33f7542c0a3f23a0d
|
4
|
+
data.tar.gz: d01efedd20e6ff6d653562bc33c0622e6cc4f98d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35ffc2e59280e2be0621d15121ec332332239c6631dee21debc59a7c04f9cb8904c2255e6025a7f0306c8392879d4d89206d1c7b8e4824bc210cfdd9cc4019d5
|
7
|
+
data.tar.gz: dd15a84b6cea17291df8891de0551d9257d33c3f74f2fb34ba34c6a6646cb03b018f02d2da5c2413e57f6b682c0794a84046251764e04f5d8c72b44c39e2c8b0
|
@@ -19,6 +19,15 @@
|
|
19
19
|
@import "font-awesome-sprockets";
|
20
20
|
@import "font-awesome";
|
21
21
|
|
22
|
+
.popover {
|
23
|
+
min-width: 540px !important;
|
24
|
+
}
|
25
|
+
|
26
|
+
.popover-title {
|
27
|
+
font-weight: bold;
|
28
|
+
color: #000;
|
29
|
+
}
|
30
|
+
|
22
31
|
.modal-dialog {
|
23
32
|
.post_attachment {
|
24
33
|
max-width: 200px;
|
@@ -1,10 +1,13 @@
|
|
1
1
|
.profile-popover {
|
2
|
-
width: 360px;
|
3
2
|
font-size: 11px;
|
4
3
|
color: #000;
|
5
4
|
|
5
|
+
.second_row {
|
6
|
+
margin-left: 10px;
|
7
|
+
}
|
8
|
+
|
6
9
|
.pm {
|
7
|
-
margin
|
10
|
+
margin: 16px 0;
|
8
11
|
}
|
9
12
|
}
|
10
13
|
|
@@ -29,6 +32,12 @@
|
|
29
32
|
}
|
30
33
|
|
31
34
|
.post_from_user_login {
|
35
|
+
.user_profile_popover {
|
36
|
+
position: relative;
|
37
|
+
z-index: 100;
|
38
|
+
padding: 5px;
|
39
|
+
}
|
40
|
+
|
32
41
|
font-weight: bold;
|
33
42
|
color: #c1ccf5;
|
34
43
|
}
|
@@ -14,7 +14,13 @@ module MyForum
|
|
14
14
|
|
15
15
|
def update
|
16
16
|
update_password
|
17
|
-
|
17
|
+
|
18
|
+
current_user.update!(user_update_params)
|
19
|
+
|
20
|
+
User::ADDITIONAL_INFO_ATTRS.each do |attr|
|
21
|
+
current_user.update(attr => params[:user][attr]) if params[:user][attr]
|
22
|
+
end
|
23
|
+
|
18
24
|
redirect_to edit_user_path(current_user)
|
19
25
|
end
|
20
26
|
|
@@ -20,7 +20,7 @@ module MyForum
|
|
20
20
|
SELECT posts.id, posts.user_id, posts.text, posts.topic_id, posts.updated_at, topics.name as topic_name, topics.forum_id, topics.deleted FROM my_forum_posts AS posts
|
21
21
|
LEFT JOIN my_forum_topics AS topics ON posts.topic_id = topics.id
|
22
22
|
LEFT JOIN my_forum_forums AS forums ON forums.id = topics.forum_id
|
23
|
-
WHERE posts.id IN (SELECT MAX(id) FROM my_forum_posts GROUP BY topic_id) AND posts.is_deleted IS FALSE AND topics.deleted IS FALSE
|
23
|
+
WHERE posts.id IN (SELECT MAX(id) FROM my_forum_posts GROUP BY topic_id) AND posts.is_deleted IS FALSE AND topics.deleted IS FALSE AND forums.id IN (#{available_forum_ids.join(',')})
|
24
24
|
ORDER BY posts.id DESC LIMIT 10
|
25
25
|
")
|
26
26
|
end
|
data/app/models/my_forum/user.rb
CHANGED
@@ -18,11 +18,32 @@ module MyForum
|
|
18
18
|
enum gender: [:female, :male, :alien]
|
19
19
|
serialize :additional_info
|
20
20
|
|
21
|
-
|
22
21
|
validates_uniqueness_of :login, :email
|
23
22
|
|
24
23
|
before_save :encrypt_password
|
25
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
|
+
"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# TODO should be stored in DB for editin from admin panel
|
44
|
+
#serialized_attr_accessor :real_name, :phone, :website_url, :personal_text
|
45
|
+
serialized_attr_accessor
|
46
|
+
|
26
47
|
def valid_password?(submitted_password)
|
27
48
|
password == encrypt(submitted_password)
|
28
49
|
end
|
@@ -1,22 +1,45 @@
|
|
1
1
|
.profile-popover
|
2
|
-
.row
|
3
|
-
.col-
|
4
|
-
|
2
|
+
.row.col-md-12
|
3
|
+
.row.col-md-6
|
4
|
+
.row
|
5
|
+
.col-sm-6
|
6
|
+
%strong= t('my_forum.profile_popover.posts_count')
|
7
|
+
.col-sm-6
|
8
|
+
= user.posts_count
|
9
|
+
.row
|
10
|
+
.col-sm-6
|
11
|
+
%strong= t('my_forum.profile_popover.registered_at')
|
12
|
+
.col-sm-6
|
13
|
+
= time(user.created_at)
|
14
|
+
.row
|
15
|
+
.col-sm-6
|
16
|
+
%strong= t('my_forum.profile_popover.status')
|
17
|
+
.col-sm-6
|
18
|
+
- is_online = is_online_user?(user.login)
|
19
|
+
= is_online ? t('my_forum.profile_popover.online') : t('my_forum.profile_popover.offline')
|
20
|
+
- unless is_online
|
21
|
+
.row
|
22
|
+
.col-sm-6
|
23
|
+
%strong= t('my_forum.profile_popover.last_online')
|
24
|
+
.col-sm-6
|
25
|
+
= time(user.updated_at)
|
26
|
+
.row.pm
|
27
|
+
.col-sm-12= link_to t('my_forum.profile_popover.write_pm'), new_private_message_path(to: user.login), class: 'btn btn-xs btn-warning'
|
5
28
|
|
6
|
-
|
7
|
-
|
8
|
-
|
29
|
+
.row.col-md-6.second_row
|
30
|
+
.row
|
31
|
+
.col-sm-5
|
32
|
+
%strong= t('my_forum.profile_popover.user_name')
|
33
|
+
.col-sm-7
|
34
|
+
= user.phone || '-'
|
35
|
+
.row
|
36
|
+
.col-sm-5
|
37
|
+
%strong= t('my_forum.profile_popover.phone')
|
38
|
+
.col-sm-7
|
39
|
+
= user.real_name || '-'
|
40
|
+
.row
|
41
|
+
.col-sm-5
|
42
|
+
%strong= t('my_forum.profile_popover.car_info')
|
43
|
+
.col-sm-7
|
44
|
+
= user.car_info || '-'
|
9
45
|
|
10
|
-
.row
|
11
|
-
.col-sm-5= t('my_forum.profile_popover.status')
|
12
|
-
.col-sm-4
|
13
|
-
- is_online = is_online_user?(user.login)
|
14
|
-
= is_online ? t('my_forum.profile_popover.online') : t('my_forum.profile_popover.offline')
|
15
|
-
|
16
|
-
- unless
|
17
|
-
.row
|
18
|
-
.col-sm-5= t('my_forum.profile_popover.last_online')
|
19
|
-
.col-sm-4= time(user.updated_at)
|
20
|
-
|
21
|
-
.row.pm
|
22
|
-
.col-sm-12= link_to t('my_forum.profile_popover.write_pm'), new_private_message_path(to: user.login), class: 'btn btn-xs btn-warning'
|
@@ -25,3 +25,12 @@
|
|
25
25
|
.row= form.file_field :avatar
|
26
26
|
.row= form.text_field :avatar_url, placeholder: 'http://...'
|
27
27
|
.row= form.submit t('.update_avatar'), class: 'btn btn-primary btn-sm submit_update_avatar'
|
28
|
+
%br
|
29
|
+
%h2= t('.edit_additional_info')
|
30
|
+
.row
|
31
|
+
.col-md-4
|
32
|
+
= form_for current_user, url: user_path(current_user), role: 'form' do |form|
|
33
|
+
- additional_info_attrs.each do |attr|
|
34
|
+
.form-group= form.text_field attr, class: 'name form-control', placeholder: t("my_forum.additional_info.#{attr.to_s}")
|
35
|
+
|
36
|
+
= form.submit t('.update'), class: 'btn btn-primary btn-sm'
|
data/config/locales/ru.yml
CHANGED
@@ -8,14 +8,23 @@ ru:
|
|
8
8
|
shared:
|
9
9
|
post_preview:
|
10
10
|
preview: 'Предпросмотр сообщения'
|
11
|
+
additional_info:
|
12
|
+
real_name: 'Ваше имя'
|
13
|
+
phone: 'Контактный телефон'
|
14
|
+
website_url: 'Ваш сайт'
|
15
|
+
personal_text: 'Подпись'
|
16
|
+
car_info: 'Марка и модель авто'
|
11
17
|
|
12
18
|
profile_popover:
|
13
|
-
posts_count: '
|
14
|
-
registered_at: '
|
15
|
-
status: '
|
19
|
+
posts_count: 'Сообщений: '
|
20
|
+
registered_at: 'Регистрация: '
|
21
|
+
status: 'Статус:'
|
16
22
|
online: 'на форуме'
|
17
23
|
offline: 'не на форуме'
|
18
|
-
last_online: 'Был на
|
24
|
+
last_online: 'Был на форуме:'
|
25
|
+
user_name: 'Имя'
|
26
|
+
phone: 'Телефон'
|
27
|
+
car_info: 'Марка авто'
|
19
28
|
write_pm: 'Написать ЛС'
|
20
29
|
|
21
30
|
today: "Сегодня в %{hhmm}"
|
@@ -130,6 +139,7 @@ ru:
|
|
130
139
|
avatar_upload_description: 'Загрузите свой аватар или укажите ссылку'
|
131
140
|
update: 'Обновить'
|
132
141
|
update_avatar: 'Обновить аватар'
|
142
|
+
edit_additional_info: 'Дополнительная информация'
|
133
143
|
|
134
144
|
|
135
145
|
private_messages:
|
data/lib/my_forum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my_forum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vitaly Omelchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -323,12 +323,10 @@ files:
|
|
323
323
|
- spec/dummy/db/development.sqlite3
|
324
324
|
- spec/dummy/db/schema.rb
|
325
325
|
- spec/dummy/db/test.sqlite3
|
326
|
-
- spec/dummy/log/test.log
|
327
326
|
- spec/dummy/public/404.html
|
328
327
|
- spec/dummy/public/422.html
|
329
328
|
- spec/dummy/public/500.html
|
330
329
|
- spec/dummy/public/favicon.ico
|
331
|
-
- spec/dummy/test.db
|
332
330
|
- spec/helpers/my_forum/posts_helper_spec.rb
|
333
331
|
- spec/helpers/my_forum/private_messages_helper_spec.rb
|
334
332
|
- spec/models/my_forum/emoticon_spec.rb
|
@@ -395,14 +393,12 @@ test_files:
|
|
395
393
|
- spec/dummy/db/development.sqlite3
|
396
394
|
- spec/dummy/db/schema.rb
|
397
395
|
- spec/dummy/db/test.sqlite3
|
398
|
-
- spec/dummy/log/test.log
|
399
396
|
- spec/dummy/public/404.html
|
400
397
|
- spec/dummy/public/422.html
|
401
398
|
- spec/dummy/public/500.html
|
402
399
|
- spec/dummy/public/favicon.ico
|
403
400
|
- spec/dummy/Rakefile
|
404
401
|
- spec/dummy/README.rdoc
|
405
|
-
- spec/dummy/test.db
|
406
402
|
- spec/helpers/my_forum/posts_helper_spec.rb
|
407
403
|
- spec/helpers/my_forum/private_messages_helper_spec.rb
|
408
404
|
- spec/models/my_forum/emoticon_spec.rb
|