my_forum 0.0.1.beta12 → 0.0.1.beta13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d05bd4d494aa68f5d47341af87baf2596b8505b
|
4
|
+
data.tar.gz: 48609dd576844d2df68842e01b56b6e6e4aa79ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 005dc4d10a8d3612d2882f15d2231415ba9b2c8f4677e0cccd8147781ad37948454af72bce152178ab288f70dd1d4b6f10de9f11c8045c322ecd7b3b379da55f
|
7
|
+
data.tar.gz: bd8ee7df43c42160f188e94aa89e344c4ff2ba196459e0dceb7b7ef79225f36827db3162809eb4181ae59800194780f1f5cb7806ded617ac717f2ae7170525ce
|
@@ -36,7 +36,7 @@ module MyForum
|
|
36
36
|
if local_time.to_date == Time.now.to_date
|
37
37
|
return t('my_forum.today', hhmm: local_time.strftime('%H:%M'))
|
38
38
|
elsif local_time.to_date == (Time.now - 1.day).to_date
|
39
|
-
return t('my_forum.
|
39
|
+
return t('my_forum.yesterday ', hhmm: local_time.strftime('%H:%M'))
|
40
40
|
end
|
41
41
|
|
42
42
|
local_time.strftime('%Y-%m-%d %H:%M')
|
@@ -3,24 +3,26 @@ require_dependency "my_forum/application_controller"
|
|
3
3
|
module MyForum
|
4
4
|
class WelcomeController < ApplicationController
|
5
5
|
def index
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
@forum_categories = if current_user && current_user.is_admin?
|
7
|
+
Category.includes(:forums)
|
8
|
+
else
|
9
|
+
@forum_categories = Category.includes(:forums, :user_groups).
|
10
|
+
reject{|category| (category.user_groups.map(&:name) & (current_user_groups)).blank? }
|
11
|
+
end
|
10
12
|
|
11
13
|
|
12
14
|
# Don`r forget permissions
|
13
15
|
available_forum_ids = MyForum::Forum.where(category_id: @forum_categories.map(&:id)).pluck(:id)
|
14
16
|
@recent_topics = if available_forum_ids.blank?
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
[]
|
18
|
+
else
|
19
|
+
Topic.find_by_sql("
|
20
|
+
SELECT my_forum_topics.* FROM my_forum_topics
|
21
|
+
JOIN my_forum_forums ON my_forum_forums.id = my_forum_topics.forum_id
|
22
|
+
WHERE my_forum_forums.id IN (#{available_forum_ids.join(',')})
|
23
|
+
ORDER BY my_forum_topics.updated_at DESC limit 10
|
24
|
+
")
|
25
|
+
end
|
24
26
|
|
25
27
|
end
|
26
28
|
end
|
@@ -13,16 +13,16 @@
|
|
13
13
|
.col-md-2.col-sm-2.forum-info= forum_stat(forum)
|
14
14
|
.col-md-3.col-sm-3.forum-last-message-info= forum_last_message_info(forum)
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
%
|
19
|
-
|
20
|
-
%
|
21
|
-
%
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
- if @recent_topics
|
17
|
+
#recent_topics
|
18
|
+
%table.table
|
19
|
+
%caption= t('.recent_topics')
|
20
|
+
%thead
|
21
|
+
%tr
|
22
|
+
%th= t('.topic_name')
|
23
|
+
%th= t('.last_message_from')
|
24
|
+
%th= t('.date')
|
25
|
+
%tbody
|
26
26
|
-@recent_topics.each do |topic|
|
27
27
|
%tr
|
28
28
|
%td= link_to topic.name, forum_topic_path(topic.forum, topic)
|
data/config/locales/ru.yml
CHANGED
data/lib/my_forum/version.rb
CHANGED