Patch #1486 ยป show_new_activity.diff
| app/controllers/boards_controller.rb | ||
|---|---|---|
|
:include => [:author, {:last_reply => :author}],
|
||
|
:limit => @topic_pages.items_per_page,
|
||
|
:offset => @topic_pages.current.offset
|
||
|
|
||
|
# Mark this board as seen
|
||
|
(session[:boards] ||= {})[@board.id] = Time.now if User.current.logged?
|
||
|
|
||
|
render :action => 'show', :layout => !request.xhr?
|
||
|
end
|
||
|
|
||
| app/controllers/messages_controller.rb | ||
|---|---|---|
|
find_board
|
||
|
@message = @board.messages.find(params[:id], :include => :parent)
|
||
|
@topic = @message.root
|
||
|
|
||
|
# Mark this topic as seen.
|
||
|
(session[:topics] ||= {})[@topic.id] = Time.now if User.current.logged?
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
end
|
||
| app/helpers/boards_helper.rb | ||
|---|---|---|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
module BoardsHelper
|
||
|
# Return true if there has been new activity on the board since the user was
|
||
|
# last seen.
|
||
|
def new_board_activity?(board)
|
||
|
return false if board.last_message.nil? || !User.current.logged?
|
||
|
|
||
|
return board.last_message.updated_on > ((session[:boards] ||= {})[board.id] || User.current.last_login_on || Time.now.utc)
|
||
|
end
|
||
|
|
||
|
# Return true if there has been new activity in the topic since the user was
|
||
|
# last seen.
|
||
|
def new_topic_activity?(topic)
|
||
|
return false if topic.last_reply.nil? || !User.current.logged?
|
||
|
|
||
|
return topic.last_reply.updated_on > ((session[:topics] ||= {})[topic.id] || User.current.last_login_on || Time.now)
|
||
|
end
|
||
|
end
|
||
| app/views/boards/index.rhtml | ||
|---|---|---|
|
</tr></thead>
|
||
|
<tbody>
|
||
|
<% for board in @boards %>
|
||
|
<tr class="<%= cycle 'odd', 'even' %>">
|
||
|
<tr class="<%= cycle 'odd', 'even' %> <%=new_board_activity?(board) ? 'new_activity' : '' %>">
|
||
|
<td>
|
||
|
<%= link_to h(board.name), {:action => 'show', :id => board}, :class => "icon22 icon22-comment" %><br />
|
||
|
<%=h board.description %>
|
||
| app/views/boards/show.rhtml | ||
|---|---|---|
|
</tr></thead>
|
||
|
<tbody>
|
||
|
<% @topics.each do |topic| %>
|
||
|
<tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
|
||
|
<tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %> <%=new_topic_activity?(topic) ? 'new_activity' : '' %>">
|
||
|
<td class="subject"><%= link_to h(topic.subject), { :controller => 'messages', :action => 'show', :board_id => @board, :id => topic }, :class => 'icon' %></td>
|
||
|
<td class="author" align="center"><%= topic.author %></td>
|
||
|
<td class="created_on" align="center"><%= format_time(topic.created_on) %></td>
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
tr.message td.last_message { font-size: 80%; }
|
||
|
tr.message.locked td.subject a { background-image: url(../images/locked.png); }
|
||
|
tr.message.sticky td.subject a { background-image: url(../images/sticky.png); font-weight: bold; }
|
||
|
tr.message.new_activity td.subject { font-weight: bold;}
|
||
|
tr.user td { width:13%; }
|
||
|
tr.user td.email { width:18%; }
|
||
| ... | ... | |
|
td.hours { text-align: right; font-weight: bold; padding-right: 0.5em; }
|
||
|
td.hours .hours-dec { font-size: 0.9em; }
|
||
|
table.boards tr.new_activity { font-weight: bold;}
|
||
|
table.list tbody tr:hover { background-color:#ffffdd; }
|
||
|
table td {padding:2px;}
|
||
|
table p {margin:0;}
|
||