Extract lecture actions into its own partial and add course homepage link
This commit is contained in:
parent
b0d134fabd
commit
9d9d920eef
@ -28,31 +28,7 @@
|
||||
</div>
|
||||
|
||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
||||
<% joinable_time = lecture.start_time - 5.minutes %>
|
||||
|
||||
<% if lecture == @current_lecture %>
|
||||
Started
|
||||
<% elsif joinable_time.future? %>
|
||||
<%= button_to "Prepare",
|
||||
lecture_start_preparation_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% elsif joinable_time.past? && !lecture.attended? %>
|
||||
<% start_label = if lecture.is_live? then
|
||||
"Join"
|
||||
else
|
||||
"Start"
|
||||
end %>
|
||||
<%= button_to start_label,
|
||||
lectures_start_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% else %>
|
||||
<%= button_to "Review",
|
||||
lecture_start_review_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% end %>
|
||||
<%= render partial: 'lecture_action', locals: { lecture: } %>
|
||||
</div>
|
||||
|
||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
||||
|
||||
27
app/views/attendance_tracker/_lecture_action.html.erb
Normal file
27
app/views/attendance_tracker/_lecture_action.html.erb
Normal file
@ -0,0 +1,27 @@
|
||||
<% joinable_time = lecture.start_time - 5.minutes %>
|
||||
|
||||
<% if lecture == @current_lecture %>
|
||||
<div class="py-1">
|
||||
Started
|
||||
</div>
|
||||
<% elsif joinable_time.future? %>
|
||||
<%= button_to "Prepare",
|
||||
lecture_start_preparation_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% elsif joinable_time.past? && !lecture.attended? %>
|
||||
<% start_label = if lecture.is_live? then
|
||||
"Join"
|
||||
else
|
||||
"Start"
|
||||
end %>
|
||||
<%= button_to start_label,
|
||||
lectures_start_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% else %>
|
||||
<%= button_to "Review",
|
||||
lecture_start_review_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% end %>
|
||||
@ -1,4 +1,12 @@
|
||||
<h1 class="text-3xl font-medium"><%= @course.title %></h1>
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
<h1 class="text-3xl font-medium"><%= @course.title %></h1>
|
||||
|
||||
<% if @course.homepage.present? %>
|
||||
<a class="align-middle" href="<%= @course.homepage %>">
|
||||
<i class="fa fa-link text-blue-600"></i>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="mt-8 flow-root">
|
||||
|
||||
@ -34,32 +34,7 @@
|
||||
</div>
|
||||
|
||||
<div class="whitespace-nowrap text-sm font-medium text-gray-900">
|
||||
<% joinable_time = lecture.start_time - 5.minutes %>
|
||||
<% if lecture == @current_lecture %>
|
||||
Started
|
||||
<% elsif joinable_time.future? %>
|
||||
<%= button_to "Prepare",
|
||||
lecture_start_preparation_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% elsif joinable_time.past? && !lecture.attended? %>
|
||||
<% start_label = if lecture.is_live? then
|
||||
"Join"
|
||||
else
|
||||
"Start"
|
||||
end %>
|
||||
<%= button_to start_label,
|
||||
lectures_start_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
<% else %>
|
||||
<div class="flex justify-center">
|
||||
<%= button_to "Review",
|
||||
lecture_start_review_path(id: lecture.id),
|
||||
class: 'action-button'
|
||||
%>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render partial: 'lecture_action', locals: { lecture: } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user