<% # Copyright (C) 2011 - 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 . %> <% provide :page_title, join_title( t(:topic, "Topic"), @topic.title) @discussion_presenter = DiscussionTopicPresenter.new(@topic, @current_user) %> <% if (@headers || !@locked) && ((show_crs_graphs = can_do(@context, @current_user, :view_all_grades) && ConditionalRelease::Service.triggers_mastery_paths?(@topic.assignment, @current_user, session)) || !@context.try(:feature_enabled?, :rce_enhancements)) %> <% provide :right_side do %> <%= render :partial => "shared/wiki_sidebar" %> <% end %> <% else %> <% provide_blank :right_side %> <% end %> <% if !@headers %>

<%= @topic.title %>

<% end %> <% if @unlock_at && @unlock_at > Time.now && !can_do(@context, @current_user, :moderate_forum) %>

<%= @topic.title %>

<% if @topic.is_a?(Announcement) %> <%= t(:announcement_locked_until, "This announcement is locked until %{time}", time: datetime_string(@unlock_at)) %> <% else %> <%= @locked.is_a?(Hash) ? lock_explanation(@locked, 'topic', @context) : t(:topic_time_locked, "This topic is locked until %{time}", time: datetime_string(@unlock_at)) %> <% end %>
<% else %>
<%= t 'Press ALT + F8 to see a list of keyboard shortcuts' %>
<% if !@topic.is_announcement && can_do(@context, @current_user, :moderate_forum) %> <% end %> <% if @topic.grants_right?(@current_user, :update) %> <%= t(:edit, 'Edit') %> <% end %> <% if @current_user.present? %> <% if @discussion_presenter.should_show_rubric?(@current_user) %> <%# HACK! this is here because edit_rubric.js expects there to be a #add_rubric_url on the page and sets it's
to it %> <% if can_do(@topic.assignment, @current_user, :update) %> <% end %> <% end %> <% end %>
<% if @topic.for_assignment? %> <%= render :partial => 'assignment_details' %> <%= render :partial => 'peer_reviews' %> <% end %> <% if @topic.todo_date? %> <%= render :partial => 'assignment_todo' %> <% end %> <% if @topic.for_group_discussion? %> <%= render :partial => 'group_discussion', :locals => {show_da_note: (@topic.for_assignment? && @topic.assignment.only_visible_to_overrides)} %> <% end %>
<%= avatar((@topic.user), context_code: @context.asset_string) if @topic.user %>

<%= @topic.title %>

<% if @topic.user %> <%= link_to context_user_name(@topic.context, @topic.user), context_url(@topic.context, :context_user_url, @topic.user_id), @discussion_presenter.author_link_attrs %> <% end %>
<% if @topic.root_topic.try(:context) && @topic.root_topic.try(:context) != @context %> <%= t(:from_context, "From *%{context_name}*", { :context_name => @topic.root_topic.context.short_name, :wrapper => "\\1" }) %> <% end %>
<% if can_do(@context, @current_user, :moderate_forum) %>
<%= friendly_datetime @topic.posted_at, context: @topic.context %>
<% end %> <%= render :partial => 'new_and_total_badge', :locals => { :unread_count => @topic.unread_count(@current_user), :reply_count => @topic.discussion_subentry_count } %>
<% unless @locked.is_a?(Hash) && !@locked[:can_view] && !can_do(@topic, @current_user, :update) %>
<%= public_user_content(@topic.message) %>
<% end %> <% if @unlock_at && @unlock_at > Time.now && @topic.is_a?(Announcement) %>
<%= t 'announcement_locked', 'The content of this announcement will not be visible to users until %{date}', :date => datetime_string(@unlock_at) %>
<% end %> <% if @locked %>
<% if @topic.is_a? Announcement %> <%= t 'announcement_closed', 'This announcement is closed for comments' %> <% elsif @locked.is_a?(Hash) %> <%= lock_explanation(@locked, 'topic', @context) %> <% end %>
<% end %> <% if @topic.editor_id && @topic.user_id && @topic.editor_id != @topic.user_id %>
<%= t 'edited_by', 'This topic was edited by %{user}', :user => link_to(context_user_name(@topic.context, @topic.editor_id), context_url(@topic.context, :context_user_url, @topic.editor_id)) %>
<% end %> <% if @topic.podcast_enabled %> <% if @context_enrollment %> <% elsif @context.available? %> <% end %> <% end %> <% if @topic.external_feed %>
<%= t 'retrieved_from_feed', 'Retrieved from %{feed}', :feed => link_to(@topic.external_feed.display_name, @topic.external_feed.url) %>
<% end %> <% if @topic.attachment %> <% end %>
<% if @domain_root_account.feature_enabled?(:responsive_awareness) %>
<% else %>
<% end %> " size = 50 > <%= t("Filter replies by unread") %> <% if can_do(@context, @current_user, :moderate_forum) %> <%= t("Show deleted replies") %> <% end %>    
<% if @domain_root_account.feature_enabled?(:responsive_awareness) %>
<% if @initial_post_required %> <%= t :initial_post_required, "Replies are only visible to those who have posted at least one reply." %> <% else %> <%= t :loading_replies, "Loading replies..." %> <% end %>
<%= prefetch_assignment_external_tools %>
<% if @headers != false %> <% else %> <%= render :partial => "shared/sequence_footer", :locals => {:asset => @sequence_asset, :context => @sequence_asset.context} if @sequence_asset %> <% end %> <% if !@headers %>
<% end %>
<% end %>