1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <%
- # Copyright (C) 2012 - present Instructure, Inc.
- #
- # This file is part of Canvas.
- #
- # Canvas is free software: you can redistribute it and/or modify it under
- # the terms of the GNU Affero General Public License as published by the Free
- # Software Foundation, version 3 of the License.
- #
- # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
- # details.
- #
- # You should have received a copy of the GNU Affero General Public License along
- # with this program. If not, see <http://www.gnu.org/licenses/>.
- %>
- <h2 class="recent-activity-header">
- <% if @context.nil? || @context.is_a?(User) %>
- <%= t :recent_activity, "Recent Activity" %>
- <% else %>
- <%= t :recent_activity_in_course, "Recent Activity in %{course_or_group}", :course_or_group => @context.nickname_for(@current_user, :short_name) %>
- <% end %>
- </h2>
- <ul class="recent_activity unstyled_list">
- <% categorized_items =
- Rails.cache.fetch(['categorized_stream_items', @current_user, collection_cache_key(@stream_items)].cache_key, :expires_in => 15.minutes) do
- categorize_stream_items(@stream_items)
- end
- %>
- <% %w(Announcement Conversation Assignment DiscussionTopic AssessmentRequest).each do |category| %>
- <% items = categorized_items[category] %>
- <% category_class = category.underscore %>
- <% if items.present? %>
- <li class="stream-category stream-<%= category_class %>" data-category="<%= category %>">
- <div class="stream_header">
- <div class="image-block">
- <div class=image-block-image>
- <i class="<%= {
- 'conversation' => 'icon-message',
- 'grading' => 'icon-check-plus',
- 'discussion_topic' => 'icon-discussion',
- 'assessment_request' => 'icon-peer-review'
- }[category_class] || "icon-#{category_class}" %>"></i>
- </div>
- <div class=image-block-content>
- <div class=title>
- <%= activity_category_title(category, items) %>
- </div>
- <% unread_count = items.select { |i| i.unread }.size %>
- <% if unread_count > 0 %>
- <strong class="unread-count">
- <span class="accessibly-hidden"><%= t(:unread_count_badge, { :one => "1 *unread item*", :other => "%{count} *unread items*" },
- :count => unread_count,
- :wrapper => '<span>\1</span>') %>
- </span>
- </strong>
- <% end %>
- <div class="links">
- <%= activity_category_links(category, items) %>
- </div>
- </div>
- </div>
- <div class=header-right-side>
- <a href="#" class="toggle-details" aria-controls="details_container"></a>
- </div>
- </div>
- <div class='details_container'>
- <table id="<%= category_class %>-details" class="stream-details">
- <caption class="accessibly-hidden"><%= category_details_label(category) %></caption>
- <thead class="accessibly-hidden">
- <tr>
- <th scope="col">{{#t}}Unread{{/t}}</th>
- <th scope="col">{{#t}}Message{{/t}}</th>
- <th scope="col">{{#t}}Date{{/t}}</th>
- <th></th>
- </tr>
- </thead>
- {{> views/shared/recent_activity_item}}
- </table>
- </div>
- </li>
- <% end %>
- <% end %>
- </ul>
- <% if categorized_items.values.map(&:count).sum == 0 %>
- {{> views/shared/no_recent_activity}}
- <% end %>
|