add last activity to forums
This commit is contained in:
@@ -690,6 +690,10 @@ tr.spacer {
|
||||
}
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ class Forum < ActiveRecord::Base
|
||||
forumgroup
|
||||
end
|
||||
|
||||
def threads
|
||||
forumthreads
|
||||
end
|
||||
|
||||
def can_read?(user)
|
||||
group.can_read?(user) && (role_read.nil? || (!user.nil? && user.role >= role_read))
|
||||
end
|
||||
|
||||
@@ -10,7 +10,17 @@
|
||||
<div class="items bold">
|
||||
<% group.forums.sort_by{ |f| f.position || 0 }.each do |f| %>
|
||||
<% if f.can_read?(current_user) %>
|
||||
<%= link_to f.name, f, id: "forum-#{f.id}", class: "item" %>
|
||||
<div class="item">
|
||||
<%= link_to f.name, f, id: "forum-#{f.id}"%>
|
||||
<div class="item-info">
|
||||
<% if trd = f.threads.last %>
|
||||
<%= trd.author.name %> <%= link_to "posted", forumthread_path(f) %> <time title="<%= trd.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= trd.created_at.to_datetime.rfc3339 %>"><%= trd.created_at.strftime("%e %b %Y, %H:%M") %></time>.
|
||||
<% else %>
|
||||
No replies yet.
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,17 @@
|
||||
<div class="clear-right"></div>
|
||||
</div>
|
||||
<div class="items bold">
|
||||
<%= link_to thread.title, forumthread_path(thread), class: "item #{"locked" if thread.locked}#{"sticky" if thread.sticky}" %>
|
||||
<div class="item">
|
||||
<%= link_to thread.title, forumthread_path(thread), class: "#{"locked" if thread.locked}#{"sticky" if thread.sticky}" %>
|
||||
<div class="item-info">
|
||||
<% if rpl = thread.replies.last %>
|
||||
<%= rpl.author.name %> <%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %> <time title="<%= rpl.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= rpl.created_at.to_datetime.rfc3339 %>"><%= rpl.created_at.strftime("%e %b %Y, %H:%M") %></time>.
|
||||
<% else %>
|
||||
No replies yet.
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user