Skip to content

Commit

Permalink
Merge pull request #5360 from dodona-edu/enhance/coppy-course
Browse files Browse the repository at this point in the history
Make copy course button more prominent for featured courses
  • Loading branch information
jorg-vr authored Feb 13, 2024
2 parents 86e042c + 36a1c3b commit 6850c32
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/helpers/courses_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def registration_action_for(**args)

secret = args[:secret]
membership = args[:membership]
css_class = args[:class] || 'btn btn-filled'

if membership.nil? || membership.unsubscribed?
if course.open_for_user?(current_user) || current_user.nil?
Expand All @@ -13,13 +14,13 @@ def registration_action_for(**args)
subscribe_course_path(@course, secret: secret),
title: t('courses.registration.registration-tooltip'),
method: :post,
class: 'btn btn-filled'
class: css_class
else
link_to t('courses.show.subscribe'),
subscribe_course_path(@course, secret: secret),
title: t('courses.registration.registration-tooltip'),
method: :post,
class: 'btn btn-filled'
class: css_class
end
else
tag.p t("courses.show.registration-#{@course.registration}-info", institution: @course.institution&.name)
Expand Down
15 changes: 13 additions & 2 deletions app/views/courses/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@

<% if @course.description.present? or current_user&.member_of?(@course).! %>
<div class="card-supporting-text card-border row course-description">
<div class="col-sm-<%= current_user&.member_of?(@course).! ? '6' : '12' %> col-12">
<div class="col-sm-<%= (@course.featured? && policy(@course).copy?) || current_user&.member_of?(@course).! ? '6' : '12' %> col-12">
<%= cache @course do %>
<%= markdown(@course.description) %>
<% end %>
</div>
<% if current_user&.member_of?(@course).! %>
<% if @course.featured? && policy(@course).copy? %>
<div class="col-sm-6 col-12">
<div class="callout callout-info">
<p><%= t(".copy_info_html") %></p>
<%= link_to new_course_url(copy_options: {base_id: @course.id}), class: "btn btn-filled with-icon" do %>
<i class="mdi mdi-content-copy mdi-18"></i> <%= t(".copy") %>
<% end %>
</div>
</div>
<% elsif current_user&.member_of?(@course).! %>
<%= render partial: 'not_a_member_card' %>
<% if @lti_launch %>
<%= render partial: 'not_a_member_dialog' %>
Expand All @@ -55,6 +64,8 @@
<div class="card-actions card-border">
<% if current_user&.member_of? @course %>
<%= button_to t('.unsubscribe'), unsubscribe_course_path(@course), class: 'btn btn-text', data: {confirm: t('general.are_you_sure')} %>
<% elsif @course.featured? and policy(@course).copy? %>
<%= registration_action_for course: @course, membership: @current_membership, secret: (@course.secret if @course.secret_required?(current_user)), class: 'btn btn-text' %>
<% end %>
<% if policy(@course).copy? or policy(@course).scoresheet? or policy(@course).download_submissions? %>
<a class="btn btn-icon dropdown-toggle hidden-print" data-bs-toggle="dropdown">
Expand Down
1 change: 1 addition & 0 deletions config/locales/views/courses/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ en:
one: 1 pending user is rejected.
other: "%{count} pending users are rejected."
copy: "Copy this course"
copy_info_html: "Ready to bring this course to your students? Use the copy button to get started. Dive into <a href=\"https://docs.dodona.be/en/guides/teachers/course-management/\">our documentation</a> to discover how to customize and manage your course effortlessly."
manage_series: "Manage series"
download_deadlines: "Add course to calendar"
download_deadlines_tooltip: "Add this link to your calendar application to show the course deadlines in your calendar"
Expand Down
1 change: 1 addition & 0 deletions config/locales/views/courses/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ nl:
one: 1 gebruiker op de wachtlijst is afgewezen.
other: "%{count} gebruikers op de wachtlijst zijn afgewezen."
copy: "Deze cursus kopiëren"
copy_info_html: "Wil je met aan de slag met deze cursus met jouw studenten? Maak dan je eigen kopie. Ontdek in <a href=\"https://docs.dodona.be/nl/guides/teachers/course-management/\">onze documentatie</a> hoe je jouw cursus moeiteloos kunt beheren."
manage_series: "Reeksen beheren"
download_deadlines: "Cursus toevoegen aan agenda"
download_deadlines_tooltip: "Voeg deze link toe aan je agenda-applicatie om de deadlines van deze cursus in je kalender te zien"
Expand Down

0 comments on commit 6850c32

Please sign in to comment.