From 80ac3b65c8020b62c589bf8191e15c20f1dc04dd Mon Sep 17 00:00:00 2001 From: Joey Wildman Date: Sun, 20 Aug 2023 20:27:06 -0400 Subject: [PATCH 1/2] Lint views/admins, views/application, views/assessment_user_data, views/attachments --- app/views/application/maintenance.html.erb | 40 ++++++++-------- app/views/assessment_user_data/edit.html.erb | 12 ++--- app/views/attachments/_attachment.html.erb | 20 +++++--- app/views/attachments/_form.html.erb | 48 +++++++++----------- app/views/attachments/edit.html.erb | 2 +- app/views/attachments/index.html.erb | 5 +- app/views/attachments/new.html.erb | 12 ++--- 7 files changed, 69 insertions(+), 70 deletions(-) diff --git a/app/views/application/maintenance.html.erb b/app/views/application/maintenance.html.erb index 034dc998e..8f9be4c91 100755 --- a/app/views/application/maintenance.html.erb +++ b/app/views/application/maintenance.html.erb @@ -1,22 +1,22 @@
-
-

Whoa there.

-

- Autolab is currently down for regular maintenance. Nothing in - particular is wrong; we just need some time to make the site better - for you. -

-

- We try to schedule maintenance for times when few people are using - the site, and we also try to be done with maintenance as quickly as - possible. If this is a major disruption for you, be sure to let your - instructor know. We're sorry for the inconveniences, but hopefully - when Autolab comes back on it'll be better than ever before! -

- -

-
- Thanks! -

-
+
+

Whoa there.

+

+ Autolab is currently down for regular maintenance. Nothing in + particular is wrong; we just need some time to make the site better + for you. +

+

+ We try to schedule maintenance for times when few people are using + the site, and we also try to be done with maintenance as quickly as + possible. If this is a major disruption for you, be sure to let your + instructor know. We're sorry for the inconveniences, but hopefully + when Autolab comes back on it'll be better than ever before! +

+ +

+
+ Thanks! +

+
diff --git a/app/views/assessment_user_data/edit.html.erb b/app/views/assessment_user_data/edit.html.erb index deb2eddc3..4947c81ee 100755 --- a/app/views/assessment_user_data/edit.html.erb +++ b/app/views/assessment_user_data/edit.html.erb @@ -1,30 +1,30 @@
Grade type for <%= @aud.course_user_datum.user.email %> on <%= @aud.assessment.display_name %>
- <%= form_for @aud, :url => { :action => :update } do |f| %> + <%= form_for @aud, url: { action: :update } do |f| %> <%= f.error_messages %> - +

- <%= f.label(:grade_type, :value => AssessmentUserDatum::NORMAL) do %> + <%= f.label(:grade_type, value: AssessmentUserDatum::NORMAL) do %> <%= f.radio_button :grade_type, AssessmentUserDatum::NORMAL %> Normal <% end %>

- <%= f.label(:grade_type, :value => AssessmentUserDatum::ZEROED) do %> + <%= f.label(:grade_type, value: AssessmentUserDatum::ZEROED) do %> <%= f.radio_button :grade_type, AssessmentUserDatum::ZEROED %> Zero <% end %>

- <%= f.label(:grade_type, :value => AssessmentUserDatum::EXCUSED) do %> + <%= f.label(:grade_type, value: AssessmentUserDatum::EXCUSED) do %> <%= f.radio_button :grade_type, AssessmentUserDatum::EXCUSED %> Excused <% end %>

- <%= f.submit "Save" , {:class=>"btn primary"} %> + <%= f.submit "Save", { class: "btn primary" } %> <% end %>
diff --git a/app/views/attachments/_attachment.html.erb b/app/views/attachments/_attachment.html.erb index 9ef612248..20eb03339 100644 --- a/app/views/attachments/_attachment.html.erb +++ b/app/views/attachments/_attachment.html.erb @@ -2,15 +2,15 @@
  • <% if attachment.assessment.nil? %> - <%= link_to [@course, attachment] do %> + <%= link_to course_attachment_path(@course, attachment) do %> file_download <%= attachment.name %> <% unless attachment.released %> (Not Released) <% end %> <% end %> - <% else %> - <%= link_to [@course, attachment.assessment, attachment] do %> + <% else %> + <%= link_to course_assessment_attachment_path(@course, attachment.assessment, attachment) do %> file_download <%= attachment.name %> <% unless attachment.released %> @@ -26,11 +26,17 @@ <% if @cud.instructor? %> <% if attachment.assessment.nil? %> - <%= link_to 'mode_edit'.html_safe, [:edit, @course, attachment], {class:"small"} %> - <%= link_to 'delete'.html_safe, [@course, attachment], {method: :delete, class:"small"} %> + <%= link_to 'mode_edit'.html_safe, + edit_course_attachment_path(@course, attachment), { class: "small" } %> + <%= link_to 'delete'.html_safe, + course_attachment_path(@course, attachment), { method: :delete, class: "small" } %> <% else %> - <%= link_to 'mode_edit'.html_safe, [:edit, @course, attachment.assessment, attachment], {class:"small"} %> - <%= link_to 'delete'.html_safe, [@course, attachment.assessment, attachment], {method: :delete, class:"small"} %> + <%= link_to 'mode_edit'.html_safe, + edit_course_assessment_attachment_path(@course, attachment.assessment, attachment), + { class: "small" } %> + <%= link_to 'delete'.html_safe, + course_assessment_attachment_path(@course, attachment.assessment, attachment), + { method: :delete, class: "small" } %> <% end %> <% end %> diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index e8246bd9c..2e1c8d5d1 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,32 +1,26 @@ <%= form_for @attachment, as: :attachment, url: path, builder: FormBuilderWithDateTimeInput do |f| %> <%= f.error_messages %> -

    - - + <% end %> diff --git a/app/views/attachments/edit.html.erb b/app/views/attachments/edit.html.erb index 384286acb..dbf983b1d 100755 --- a/app/views/attachments/edit.html.erb +++ b/app/views/attachments/edit.html.erb @@ -6,6 +6,6 @@
    - <%= render partial: "form", locals: {path: path} %> + <%= render partial: "form", locals: { path: path } %>
    diff --git a/app/views/attachments/index.html.erb b/app/views/attachments/index.html.erb index 1713f8fbe..25c9a1301 100755 --- a/app/views/attachments/index.html.erb +++ b/app/views/attachments/index.html.erb @@ -1,7 +1,7 @@ <% if @is_assessment %> -

    Listing <%= link_to @assessment.display_name, [@course, @assessment] %> Attachments

    +

    Listing <%= link_to @assessment.display_name, course_assessment_path(@course, @assessment) %> Attachments

    <% else %> -

    Listing <%= link_to @course.full_name, @course %> Attachments

    +

    Listing <%= link_to @course.full_name, course_path(@course) %> Attachments

    <% end %> - diff --git a/app/views/attachments/new.html.erb b/app/views/attachments/new.html.erb index 6aefd354c..20f08c893 100755 --- a/app/views/attachments/new.html.erb +++ b/app/views/attachments/new.html.erb @@ -1,12 +1,12 @@ <% path = - if @is_assessment - course_assessment_attachments_path(@course, @assessment) - else - course_attachments_path(@course) - end %> + if @is_assessment + course_assessment_attachments_path(@course, @assessment) + else + course_attachments_path(@course) + end %>
    - <%= render partial: "form", locals: {path: path} %> + <%= render partial: "form", locals: { path: path } %>
    From 41f8cf29966d0e8ac1660859f66ae45296904c2a Mon Sep 17 00:00:00 2001 From: Joey Wildman Date: Sun, 17 Sep 2023 11:43:21 -0400 Subject: [PATCH 2/2] add deletion confirmation --- app/views/attachments/_attachment.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/attachments/_attachment.html.erb b/app/views/attachments/_attachment.html.erb index 20eb03339..ddd7fdf49 100644 --- a/app/views/attachments/_attachment.html.erb +++ b/app/views/attachments/_attachment.html.erb @@ -36,7 +36,7 @@ { class: "small" } %> <%= link_to 'delete'.html_safe, course_assessment_attachment_path(@course, attachment.assessment, attachment), - { method: :delete, class: "small" } %> + { method: :delete, class: "small", data: { confirm: "Are you sure you want to delete this attachment?" } } %> <% end %> <% end %>