Skip to content

Commit

Permalink
Show medium title and date
Browse files Browse the repository at this point in the history
  • Loading branch information
Splines committed Aug 4, 2024
1 parent 3c92607 commit bb2402e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 5 additions & 1 deletion app/controllers/annotations_overview_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ def extract_relevant_information(annotation, is_shared: false)
text: annotation.comment_optional,
color: annotation.color,
updated_at: annotation.updated_at,
# TODO: teachable is marked optional in medium, so we should handle the case
# where it is nil
lecture: annotation.medium.teachable.lecture.title,
link: annotation_open_link(annotation, is_shared)
link: annotation_open_link(annotation, is_shared),
medium_title: annotation.medium.caption,
medium_date: annotation.medium.lesson&.date_localized
}
end

Expand Down
22 changes: 17 additions & 5 deletions app/views/annotations/_annotations_overview_accordion.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="accordion-item">
<% collapseLabel="annotation-overview-collapse-#{index}-#{is_students_annotations}" %>

<!-- Header -->
<!-- Accordion header -->
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#<%= collapseLabel %>"
Expand All @@ -15,14 +15,13 @@
</button>
</h2>

<!-- Body -->
<!-- Accordion body -->
<div class="accordion-collapse collapse" id="<%= collapseLabel %>"
data-bs-parent="#<%= accordionLabel %>">
<div class="accordion-body">

<% annotations.each do |annotation| %>
<a href="<%= annotation[:link] %>" style="text-decoration: none;">
<!-- Card -->
<!-- Card shared by students will obtain their border color -->
<!-- according to their category via JS. -->
<% border_color_style = is_students_annotations ? \
Expand All @@ -32,10 +31,23 @@
<div class="annotation-overview-item card mb-3"
data-annotation-card-category="<%= category_str %>"
style="<%= border_color_style %>">
<div class="card-header">
<%= annotation[:category].capitalize %>

<!-- Card header -->
<div class="card-header d-flex justify-content-between">
<div>
<strong>
<%= annotation[:category].capitalize %>
<% if not annotation[:medium_title].empty? %>
| <%= annotation[:medium_title] %>
<% end %>
</strong>
</div>
<div class="text-body-secondary font-monospace">
<em><%= annotation[:medium_date] %></em>
</div>
</div>

<!-- Card body -->
<div class="card-body">
<p class="card-text">
<%= truncate(annotation[:text], length: 100) %>
Expand Down

0 comments on commit bb2402e

Please sign in to comment.