Skip to content

Commit

Permalink
lint views/schedulers, views/metrics, views/lti_nrps, views/lti_confi…
Browse files Browse the repository at this point in the history
…g, views/extensions (autolab#1977)

* lint views/schedulers, views/metrics, views/lti_nrps, views/lti_config, views/extensions

* fixed student selection

(cherry picked from commit 14bc1f4)
  • Loading branch information
20wildmanj authored and NicholasMy committed Jan 5, 2024
1 parent 068e24e commit 58b3cdb
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 59 deletions.
18 changes: 9 additions & 9 deletions app/views/extensions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<% end %>
<% content_for :javascripts do %>
<%= javascript_include_tag "materialize-autocomplete" %>
<script type="application/javascript">
<script type="text/javascript">
jQuery(function() {
/* set up dates */
const $dueDate = moment("<%= @assessment.due_at.to_s %>", "YYYY-MM-DD hh:mm:ss ZZ").startOf('day');
Expand Down Expand Up @@ -172,11 +172,11 @@
<% else %>
<% @extensions.each do |ext| %>
<tr>
<td><a class="clickable student-select" data-cud=<%= ext.course_user_datum_id %>><%= ext.course_user_datum.email %></a></td>
<td style="padding: 0 5px"><%= ext.infinite? ? "Infinite" : "#{pluralize(ext.days, "day")}" %></td>
<td style="padding: 0 5px"><%= ext.infinite? ? "-" : "#{(@assessment.due_at + ext.days.days).strftime('%b %d %Y')}" %></td>
<td><%= link_to '<i class="material-icons">delete</i>'.html_safe, [@course, @assessment, ext],
data: { confirm: 'Are you sure you want to delete the extension for user ' + ext.course_user_datum.email + '?' },
<td><a class="clickable student-select" data-cud="<%= ext.course_user_datum_id %>"><%= ext.course_user_datum.email %></a></td>
<td style="padding: 0 5px"><%= ext.infinite? ? "Infinite" : pluralize(ext.days, "day").to_s %></td>
<td style="padding: 0 5px"><%= ext.infinite? ? "-" : (@assessment.due_at + ext.days.days).strftime('%b %d %Y').to_s %></td>
<td><%= link_to '<i class="material-icons">delete</i>'.html_safe, course_assessment_extension_path(@course, @assessment, ext),
data: { confirm: "Are you sure you want to delete the extension for user #{ext.course_user_datum.email}?" },
method: :delete %></td>
</tr>
<% end %>
Expand All @@ -190,7 +190,7 @@

<div class="col s12 m6">
<h4>Create Extension</h4>
<%= form_for @new_extension, :url=>{:action=>"create"}, builder: FormBuilderWithDateTimeInput do |f| %>
<%= form_for @new_extension, url: { action: "create" }, builder: FormBuilderWithDateTimeInput do |f| %>
<div class="input-field">
<div id="ac-users"></div>
<input type="text" id="ac-input" placeholder="Start typing student names or emails" data-target="ac-dropdown" data-beloworigin="true" autocomplete="off">
Expand All @@ -200,11 +200,11 @@
<h6>Select a new due date</h6>
<p>Original assessment due date: <span class="moment-date-time" data-format="MMM D YYYY h:mm:ssa Z"><%= @assessment.due_at.to_s %></span></p>
<%= f.date_select :due_at, greater_than: @assessment.due_at, id: "extension_due_at" %>
<%= f.number_field :days, :size=>3, :placeholder=>0, :value=>0, :min=>0, :id=>"extension_days" %>
<%= f.number_field :days, size: 3, placeholder: 0, value: 0, min: 0, id: "extension_days" %>
<%= f.check_box :infinite, display_name: "Infinite Extension", id: "extension_infinite" %>
<%= hidden_field_tag :course_user_data, nil, autocomplete: "off" %>
<%= f.hidden_field :assessment_id %>
<%= f.submit "Create" , {:class=>"btn primary"} %>
<%= f.submit "Create", { class: "btn primary" } %>
<% end %>
</div>
</div>
24 changes: 15 additions & 9 deletions app/views/lti_config/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,33 @@

<%= form_with url: lti_config_update_config_path do |form| %>
<div class="input-field">
<%= form.url_field :iss, value: @lti_config_hash.nil? ? "" : @lti_config_hash["iss"], required: true %>
<%= form.url_field :iss, value: @lti_config_hash.nil? ? "" : @lti_config_hash["iss"], required: true %>
<%= form.label :iss, "iss URL" %>
<span class="helper-text">Find issuer identifier from the LTI platform's documentation</span>
</div>
<div class="input-field">
<%= form.text_field :developer_key, value: @lti_config_hash.nil? ? "" : @lti_config_hash["developer_key"], required: true %>
<%= form.label :developer_key, "Developer Key"%>
<%= form.text_field :developer_key, value: @lti_config_hash.nil? ? "" : @lti_config_hash["developer_key"],
required: true %>
<%= form.label :developer_key, "Developer Key" %>
<span class="helper-text">also known as client_id, obtained from the LTI platform</span>
</div>
<div class="input-field">
<%= form.url_field :auth_url, value: @lti_config_hash.nil? ? "" : @lti_config_hash["auth_url"], required: true %>
<%= form.url_field :auth_url, value: @lti_config_hash.nil? ? "" : @lti_config_hash["auth_url"],
required: true %>
<%= form.label :auth_url, "LTI Launch Auth URL" %>
<span class="helper-text"> LTI Platform's Launch Authentication URL, obtained from the platform </span>
</div>
<div class="input-field">
<%= form.url_field :platform_public_jwks_url, value: @lti_config_hash.nil? ? "" : @lti_config_hash["platform_public_jwks_url"], required: false %>
<%= form.url_field :platform_public_jwks_url,
value: @lti_config_hash.nil? ? "" : @lti_config_hash["platform_public_jwks_url"],
required: false %>
<%= form.label :platform_public_jwks_url, "LTI platform public JWK URL" %>
<span class="helper-text"> LTI platform endpoint URL to obtain JWKs </span>
</div>
<div class="input-field">
<%= form.url_field :oauth2_access_token_url, value: @lti_config_hash.nil? ? "" : @lti_config_hash["oauth2_access_token_url"], required: true %>
<%= form.url_field :oauth2_access_token_url,
value: @lti_config_hash.nil? ? "" : @lti_config_hash["oauth2_access_token_url"],
required: true %>
<%= form.label :oauth2_access_token_url, "Platform OAuth2 Endpoint" %>
<span class="helper-text"> LTI platform's Oauth2 Access Token Endpoint URL </span>
</div>
Expand All @@ -37,7 +43,7 @@
<% if File.exist?("config/lti_tool_jwk.json") %>
<p> File already uploaded. Uploading will rewrite the previous JWK </p>
<% end %>
<%= form.file_field :tool_jwk, accept:'text/json', required: !File.exist?("config/lti_tool_jwk.json") %>
<%= form.file_field :tool_jwk, accept: 'text/json', required: !File.exist?("config/lti_tool_jwk.json") %>
</div>
<div class="lti-upload-container">
<h5>
Expand All @@ -46,7 +52,7 @@
<% if File.exist?("config/lti_platform_jwk.json") %>
<p> File already uploaded. Uploading will rewrite the previous JWK </p>
<% end %>
<%= form.file_field :platform_public_jwk_json, accept:'text/json', required: false %>
<%= form.file_field :platform_public_jwk_json, accept: 'text/json', required: false %>
</div>
<%= form.submit "Update Configuration", {:class=>"btn primary"}%>
<%= form.submit "Update Configuration", { class: "btn primary" } %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/lti_nrps/sync_roster.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h2>Sync Course Roster</h2>
<%= render partial: 'courses/updateRosterPreview', locals: { cuds: @cuds, sorted_cuds: @sorted_cuds} %>
<%= render partial: 'courses/updateRosterPreview', locals: { cuds: @cuds, sorted_cuds: @sorted_cuds } %>
66 changes: 33 additions & 33 deletions app/views/metrics/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% @title = "Student Metrics"%>
<% @title = "Student Metrics" %>
<% content_for :stylesheets do %>
<%= stylesheet_link_tag "metrics" %>
<% end %>
Expand All @@ -7,7 +7,7 @@
<%= external_javascript_include_tag "lodash" %>
<%= javascript_include_tag "watchlist" %>
<%= javascript_include_tag "metrics" %>
<%= javascript_include_tag "metrics_config"%>
<%= javascript_include_tag "metrics_config" %>
<% end %>

<div id="message_area">
Expand All @@ -22,7 +22,7 @@
<span class="select-all-chip" id="select_all_checkbox">
<!-- hacky way to get checkbox aligned perfectly vertically, spaced -->
<div class="ui checkbox select_all">
<input type="checkbox"/>
<input type="checkbox">
</div>
Select All
</span>
Expand Down Expand Up @@ -62,7 +62,7 @@
<div class="ui secondary segment" id="pending_header" hidden>
<div class="ui right aligned scrolling search" id="pending_search">
<div class="ui icon input">
<input class="prompt" type="text" placeholder="Search students...">
<input class="prompt" type="text" placeholder="Search students..." autocomplete="off">
<i class="search icon"></i>
</div>
<div class="results"></div>
Expand All @@ -75,7 +75,7 @@
<div class="ui secondary segment" id="contacted_header" hidden>
<div class="ui right aligned scrolling search" id="contacted_search">
<div class="ui icon input">
<input class="prompt" type="text" placeholder="Search students...">
<input class="prompt" type="text" placeholder="Search students..." autocomplete="off">
<i class="search icon"></i>
</div>
<div class="results"></div>
Expand All @@ -88,7 +88,7 @@
<div class="ui secondary segment" id="resolved_header" hidden>
<div class="ui right aligned scrolling search" id="resolved_search">
<div class="ui icon input">
<input class="prompt" type="text" placeholder="Search students...">
<input class="prompt" type="text" placeholder="Search students..." autocomplete="off">
<i class="search icon"></i>
</div>
<div class="results"></div>
Expand All @@ -101,7 +101,7 @@
<div class="ui secondary segment" id="archived_header" hidden>
<div class="ui right aligned scrolling search" id="archived_search">
<div class="ui icon input">
<input class="prompt" type="text" placeholder="Search students...">
<input class="prompt" type="text" placeholder="Search students..." autocomplete="off">
<i class="search icon"></i>
</div>
<div class="results"></div>
Expand All @@ -113,7 +113,7 @@
</div>
<div class="ui tab segments active" id="undefined_metrics" style="display:none">
<center>
<i class="huge inbox icon"></i>
<i class="huge inbox icon"></i>
<h3> You have not defined your student metrics </h3>
You can define metrics to identify students in need of attention using the <b>Student Metrics</b> tab. <br>
</center>
Expand All @@ -122,7 +122,7 @@
</div>
</div>
<div class="ui tab" data-tab="student metrics">
<h6>
<h6>
Select one or more of the following metrics that you want to use to identify students in need of attention.
</h6>
<br>
Expand All @@ -139,8 +139,8 @@
<i class="dropdown icon"></i>
<div class="default text">0</div>
<div class="menu">
<% for i in 1..@course_grace_days do%>
<div class="item" data-value="<%=i%>"><%=i%></div>
<% for i in 1..@course_grace_days do %>
<div class="item" data-value="<%= i %>"><%= i %></div>
<% end %>
</div>
</div>
Expand All @@ -150,7 +150,7 @@
<div class="ui calendar" id="grace_days_by_date">
<div class="ui input left icon">
<i class="calendar icon"></i>
<input type="text" placeholder="Date">
<input type="text" placeholder="Date" autocomplete="off">
</div>
</div>
</span>
Expand All @@ -165,7 +165,7 @@
</div>
Students whose grades have dropped by
<span class="padded-span">
<input type="text" placeholder="0" id='grade_drop_percentage'>
<input type="text" placeholder="0" id='grade_drop_percentage' autocomplete="off">
</span>
percent within
<span class="padded-span">
Expand All @@ -174,8 +174,8 @@
<i class="dropdown icon"></i>
<div class="default text">0</div>
<div class="menu">
<% for i in 2..@max_consecutive_assessments do%>
<div class="item" data-value="<%=i%>"><%=i%></div>
<% for i in 2..@max_consecutive_assessments do %>
<div class="item" data-value="<%= i %>"><%= i %></div>
<% end %>
</div>
</div>
Expand All @@ -196,9 +196,9 @@
<input type="hidden" name="number">
<i class="dropdown icon"></i>
<div class="default text">0</div>
<div class="menu" >
<% for i in 1..@num_assessments do%>
<div class="item" data-value="<%=i%>"><%=i%></div>
<div class="menu">
<% for i in 1..@num_assessments do %>
<div class="item" data-value="<%= i %>"><%= i %></div>
<% end %>
</div>
</div>
Expand All @@ -220,15 +220,15 @@
<i class="dropdown icon"></i>
<div class="default text">0</div>
<div class="menu">
<% for i in 1..@num_assessments do%>
<div class="item" data-value="<%=i%>"><%=i%></div>
<% for i in 1..@num_assessments do %>
<div class="item" data-value="<%= i %>"><%= i %></div>
<% end %>
</div>
</div>
</span>
submitted assignment(s) below a percentage of
<span class="padded-span">
<input type="text" placeholder="0" id='low_grades_percentage'>
<input type="text" placeholder="0" id='low_grades_percentage' autocomplete="off">
</span>
</div>
</div>
Expand All @@ -241,7 +241,7 @@
</div>
Students who have greater than or equal to
<span class="padded-span">
<input type="text" placeholder="1" id='extension_requests_count'>
<input type="text" placeholder="1" id='extension_requests_count' autocomplete="off">
</span>
extensions.
</div>
Expand All @@ -251,7 +251,7 @@
<% if @cud.instructor? %>
<button class="ui disabled submit button" id="save">SAVE</button>
<% else %>
<button class= "ui disabled submit button">SAVE</button>
<button class="ui disabled submit button">SAVE</button>
<label> You do not have permission to edit student metrics </label>
<% end %>
</div>
Expand All @@ -265,22 +265,22 @@
<div class="five wide column">
<h3> Included </h3>
<div id="included_categories">
<% for category in @course_assessment_categories do%>
<div class="item" id="included_<%=category%>" style="visibility: hidden;"><%=category%></div><br />
<% for category in @course_assessment_categories do %>
<div class="item" id="included_<%= category %>" style="visibility: hidden;"><%= category %></div><br>
<% end %>
</div>
</div>
<div class="four wide column">
<h3><br /></h3>
<% for category in @course_assessment_categories do%>
<i class="exchange alternate icon" data-value="<%=category%>"></i><br /><br />
<h3><br></h3>
<% for category in @course_assessment_categories do %>
<i class="exchange alternate icon" data-value="<%= category %>"></i><br><br>
<% end %>
</div>
<div class="five wide column">
<h3> Excluded </h3>
<div id="excluded_categories">
<% for category in @course_assessment_categories do%>
<div class="item" id="excluded_<%=category%>" style="visibility: hidden;"><%=category%></div><br />
<% for category in @course_assessment_categories do %>
<div class="item" id="excluded_<%= category %>" style="visibility: hidden;"><%= category %></div><br>
<% end %>
</div>
</div>
Expand All @@ -291,15 +291,15 @@
</h6>
<div>
<div class="ui checkbox" id="allow_ca">
<input type="checkbox" />
<input type="checkbox">
<label>Allow CAs to access the watchlist</label>
</div>
</div>
<br/>
<br>
<% if @cud.instructor? %>
<button class="ui disabled submit button" id="save_configs_btn">SAVE</button>
<% else %>
<button class= "ui disabled submit button">SAVE</button>
<button class="ui disabled submit button">SAVE</button>
<label> You do not have permission to edit metrics configurations </label>
<% end %>
</div>
6 changes: 4 additions & 2 deletions app/views/schedulers/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
<% end %>
<h4>Editing scheduler</h4>

<%= form_for @scheduler, url: course_scheduler_path(@course, @scheduler), method: "patch", builder: FormBuilderWithDateTimeInput do |f| %>
<%= form_for @scheduler, url: course_scheduler_path(@course, @scheduler),
method: "patch", builder: FormBuilderWithDateTimeInput do |f| %>
<%= f.error_messages %>
<%= f.text_field :action, help_text: "Path to scheduler file relative to Autolab root", placeholder: "(scheduler action)" %>
<%= f.text_field :action, help_text: "Path to scheduler file relative to Autolab root",
placeholder: "(scheduler action)" %>
<%= f.datetime_select :next, help_text: "Time of next run" %>
<%= f.datetime_select :until, help_text: "Don't run after this time" %>
<%= f.number_field :interval, min: 1, help_text: "Minimum interval between each run (in seconds)" %>
Expand Down
7 changes: 4 additions & 3 deletions app/views/schedulers/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h4>Manage Schedulers</h4>
<p>It is currently <span class="moment-date-time" data-format="MMM D YYYY h:mm:ssa Z"><%= Time.now %></span></p>
<p>It is currently <span class="moment-date-time" data-format="MMM D YYYY h:mm:ssa Z"><%= Time.zone.now %></span></p>

<%= link_to 'New Scheduler', new_course_scheduler_path(@course), { class: "btn" } %>
<table class="prettyBorder">
Expand Down Expand Up @@ -31,7 +31,8 @@
{ title: "View scheduler details", class: "btn" } %>
<%= link_to "<i class='material-icons'>edit</i>".html_safe, edit_course_scheduler_path(@course, scheduler),
{ title: "Edit this scheduler", class: "btn" } %>
<%= link_to "<i class='material-icons'>play_circle_filled</i>".html_safe, course_scheduler_run_path(@course, scheduler),
<%= link_to "<i class='material-icons'>play_circle_filled</i>".html_safe,
course_scheduler_run_path(@course, scheduler),
{ method: "post", title: "Run this scheduler",
data: { confirm: "Are you sure you want to run this scheduler?" }, class: "btn" } %>
<%= link_to "<i class='material-icons'>delete</i>".html_safe, course_scheduler_path(@course, scheduler),
Expand All @@ -44,4 +45,4 @@
</tbody>
</table>

<br />
<br>
6 changes: 4 additions & 2 deletions app/views/schedulers/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

<%= form_for :scheduler, url: course_schedulers_path(@course), builder: FormBuilderWithDateTimeInput do |f| %>
<%= f.error_messages %>
<%= f.text_field :action, help_text: "Path to scheduler file relative to Autolab root", placeholder: "(scheduler action)" %>
<%= f.text_field :action, help_text: "Path to scheduler file relative to Autolab root",
placeholder: "(scheduler action)" %>
<%= f.datetime_select :next, help_text: "Time of next run" %>
<%= f.datetime_select :until, help_text: "Don't run after this time" %>
<%= f.number_field :interval, min: 1, help_text: "Minimum interval between each run (in seconds)", value: 600 %>
<%= f.number_field :interval, min: 1, help_text: "Minimum interval between each run (in seconds)",
value: 600 %>
<%= f.check_box :disabled %>
<div class="action_buttons">
<%= link_to 'Back', course_schedulers_path(@course), { class: "btn" } %>
Expand Down

0 comments on commit 58b3cdb

Please sign in to comment.