Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint views/admins, views/application, views/assessment_user_data, views/attachments #1967

Merged
merged 2 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions app/views/application/maintenance.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<div class="container">
<div class="col-md-10">
<h1>Whoa there.</h1>
<p class="lead">
<b>Autolab is currently down for regular maintenance.</b> Nothing in
particular is wrong; we just need some time to make the site better
for you.
</p>
<p>
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!
</p>
<img src="/assets/donkeyKongTheBuilder.png" width=400px />
<p class="lead">
<br>
<b>Thanks!</b>
</p>
</div>
<div class="col-md-10">
<h1>Whoa there.</h1>
<p class="lead">
<b>Autolab is currently down for regular maintenance.</b> Nothing in
particular is wrong; we just need some time to make the site better
for you.
</p>
<p>
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!
</p>
<img src="/assets/donkeyKongTheBuilder.png" width=400px>
<p class="lead">
<br>
<b>Thanks!</b>
</p>
</div>
</div>
12 changes: 6 additions & 6 deletions app/views/assessment_user_data/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<div class="container">
<h5>Grade type for <%= @aud.course_user_datum.user.email %> on <%= @aud.assessment.display_name %></h5>

<%= form_for @aud, :url => { :action => :update } do |f| %>
<%= form_for @aud, url: { action: :update } do |f| %>
<%= f.error_messages %>

<p>
<%= f.label(:grade_type, :value => AssessmentUserDatum::NORMAL) do %>
<%= f.label(:grade_type, value: AssessmentUserDatum::NORMAL) do %>
<%= f.radio_button :grade_type, AssessmentUserDatum::NORMAL %>
<span>Normal</span>
<% end %>
</p>

<p>
<%= f.label(:grade_type, :value => AssessmentUserDatum::ZEROED) do %>
<%= f.label(:grade_type, value: AssessmentUserDatum::ZEROED) do %>
<%= f.radio_button :grade_type, AssessmentUserDatum::ZEROED %>
<span>Zero</span>
<% end %>
</p>

<p>
<%= f.label(:grade_type, :value => AssessmentUserDatum::EXCUSED) do %>
<%= f.label(:grade_type, value: AssessmentUserDatum::EXCUSED) do %>
<%= f.radio_button :grade_type, AssessmentUserDatum::EXCUSED %>
<span>Excused</span>
<% end %>
</p>

<%= f.submit "Save" , {:class=>"btn primary"} %>
<%= f.submit "Save", { class: "btn primary" } %>
<% end %>
</div>
20 changes: 13 additions & 7 deletions app/views/attachments/_attachment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<li class="collection-item">
<p>
<% if attachment.assessment.nil? %>
<%= link_to [@course, attachment] do %>
<%= link_to course_attachment_path(@course, attachment) do %>
<i class="material-icons left">file_download</i>
<%= attachment.name %>
<% unless attachment.released %>
<b>(Not Released)</b>
<% end %>
<% end %>
<% else %>
<%= link_to [@course, attachment.assessment, attachment] do %>
<% else %>
<%= link_to course_assessment_attachment_path(@course, attachment.assessment, attachment) do %>
<i class="material-icons left">file_download</i>
<%= attachment.name %>
<% unless attachment.released %>
Expand All @@ -26,11 +26,17 @@
<span class="secondary-content">
<% if @cud.instructor? %>
<% if attachment.assessment.nil? %>
<%= link_to '<i class="material-icons left">mode_edit</i>'.html_safe, [:edit, @course, attachment], {class:"small"} %>
<%= link_to '<i class="material-icons left">delete</i>'.html_safe, [@course, attachment], {method: :delete, class:"small"} %>
<%= link_to '<i class="material-icons left">mode_edit</i>'.html_safe,
edit_course_attachment_path(@course, attachment), { class: "small" } %>
<%= link_to '<i class="material-icons left">delete</i>'.html_safe,
course_attachment_path(@course, attachment), { method: :delete, class: "small" } %>
<% else %>
<%= link_to '<i class="material-icons left">mode_edit</i>'.html_safe, [:edit, @course, attachment.assessment, attachment], {class:"small"} %>
<%= link_to '<i class="material-icons left">delete</i>'.html_safe, [@course, attachment.assessment, attachment], {method: :delete, class:"small"} %>
<%= link_to '<i class="material-icons left">mode_edit</i>'.html_safe,
edit_course_assessment_attachment_path(@course, attachment.assessment, attachment),
{ class: "small" } %>
<%= link_to '<i class="material-icons left">delete</i>'.html_safe,
course_assessment_attachment_path(@course, attachment.assessment, attachment),
{ method: :delete, class: "small" } %>
<% end %>
<% end %>
</span>
Expand Down
48 changes: 21 additions & 27 deletions app/views/attachments/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
<%= form_for @attachment, as: :attachment, url: path, builder: FormBuilderWithDateTimeInput do |f| %>
<%= f.error_messages %>

<ul>
<li>
<%= f.text_field :name, :required => true %>
</li>
<li>
<% if @attachment.new_record? %>
<%= f.file_field :file, button_text: "Upload Attachment" %>
<% else %>
<%= f.text_field :mime_type,
help_text: "Note: If you change the Mime type of a file, you might need to clear your browser's cache in order for you to see the change." %>
<% end %>
</li>
<li>
<div>
<%= f.check_box :released, help_text: "Checking this box will release the attachment to students" %>
</div>
</li>
<li>
<%= f.submit(@attachment.new_record? ? "Create New Attachment" : "Save Changes", class: "btn primary") %>
</li>
</ul>

<script>
document.getElementById("attachment_file").onchange = function(e) {
document.getElementById("upload_file").value = document.getElementById("attachment_file").value.split(/(\\|\/)/g).pop();
}
</script>
<ul>
<li>
<%= f.text_field :name, required: true %>
</li>
<li>
<% if @attachment.new_record? %>
<%= f.file_field :file, button_text: "Upload Attachment" %>
<% else %>
<%= f.text_field :mime_type,
help_text: "Note: If you change the Mime type of a file, you might need to clear your browser's cache in order for you to see the change." %>
<% end %>
</li>
<li>
<div>
<%= f.check_box :released, help_text: "Checking this box will release the attachment to students" %>
</div>
</li>
<li>
<%= f.submit(@attachment.new_record? ? "Create New Attachment" : "Save Changes", class: "btn primary") %>
</li>
</ul>

<% end %>
2 changes: 1 addition & 1 deletion app/views/attachments/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

<div class="row">
<div class="col-md-6">
<%= render partial: "form", locals: {path: path} %>
<%= render partial: "form", locals: { path: path } %>
</div>
</div>
5 changes: 2 additions & 3 deletions app/views/attachments/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if @is_assessment %>
<h2>Listing <%= link_to @assessment.display_name, [@course, @assessment] %> Attachments</h2>
<h2>Listing <%= link_to @assessment.display_name, course_assessment_path(@course, @assessment) %> Attachments</h2>
<% else %>
<h2>Listing <%= link_to @course.full_name, @course %> Attachments</h2>
<h2>Listing <%= link_to @course.full_name, course_path(@course) %> Attachments</h2>
<% end %>

<ul class="collection with-header attachments">
Expand All @@ -20,4 +20,3 @@
</li>
<%= render @attachments %>
</ul>

12 changes: 6 additions & 6 deletions app/views/attachments/new.html.erb
Original file line number Diff line number Diff line change
@@ -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 %>

<div class="row">
<div class="col-md-6">
<%= render partial: "form", locals: {path: path} %>
<%= render partial: "form", locals: { path: path } %>
</div>
</div>