diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 34224957b3..af8c079dcd 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -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? @@ -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) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 943874d5ab..8735a913bb 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -27,12 +27,21 @@ <% if @course.description.present? or current_user&.member_of?(@course).! %>
-
+
<%= cache @course do %> <%= markdown(@course.description) %> <% end %>
- <% if current_user&.member_of?(@course).! %> + <% if @course.featured? && policy(@course).copy? %> +
+
+

<%= t(".copy_info_html") %>

+ <%= link_to new_course_url(copy_options: {base_id: @course.id}), class: "btn btn-filled with-icon" do %> + <%= t(".copy") %> + <% end %> +
+
+ <% elsif current_user&.member_of?(@course).! %> <%= render partial: 'not_a_member_card' %> <% if @lti_launch %> <%= render partial: 'not_a_member_dialog' %> @@ -55,6 +64,8 @@
<% 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? %> diff --git a/config/locales/views/courses/en.yml b/config/locales/views/courses/en.yml index 2b6dd39885..610c2d329e 100644 --- a/config/locales/views/courses/en.yml +++ b/config/locales/views/courses/en.yml @@ -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 our documentation 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" diff --git a/config/locales/views/courses/nl.yml b/config/locales/views/courses/nl.yml index 9999d02eb1..a461628040 100644 --- a/config/locales/views/courses/nl.yml +++ b/config/locales/views/courses/nl.yml @@ -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 onze documentatie 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"