Skip to content

Commit

Permalink
Fix scheduler csrf (#1519)
Browse files Browse the repository at this point in the history
* Initial commit

* Replace button_to with link_to
  • Loading branch information
damianhxy committed May 13, 2022
1 parent a0a2412 commit af5eb69
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
14 changes: 0 additions & 14 deletions app/assets/stylesheets/style.css.scss
Expand Up @@ -1078,20 +1078,6 @@ form p:last-child {
padding-left: 14px;
}

.danger-side input {
background: none;
border: none;
padding-left: 14px;
text-decoration: none;
color: #0882af;
font-family: "Source Sans Pro", sans-serif;
font-weight: 300;
font-size: 16px;
text-align: left;
width: 100%;
cursor: pointer;
}

/* Form Tables */

.verticalTable tr {
Expand Down
6 changes: 3 additions & 3 deletions app/views/assessments/show.html.erb
Expand Up @@ -76,10 +76,10 @@
<li class="collection-item red-text danger-bottom no-hover"><h4>Danger Zone</h4></li>

<li class="danger-side">
<%= button_to "Release all grades", { :action => "releaseAllGrades" }, { :title=> "Make all scores for this assessment visible to students", data: {confirm: "Are you sure you want to release all grades?"}} %>
<%= link_to "Release all grades", { :action => "releaseAllGrades" }, { :title=> "Make all scores for this assessment visible to students", data: {confirm: "Are you sure you want to release all grades?", method: "post"}} %>
</li>
<li class="danger-side">
<%= button_to "Withdraw all grades", { :action => "withdrawAllGrades" }, {:title=> "Hide all scores for this assessment from students", data: {confirm: "Are you sure you want to withdraw all grades?"}} %>
<%= link_to "Withdraw all grades", { :action => "withdrawAllGrades" }, {:title=> "Hide all scores for this assessment from students", data: {confirm: "Are you sure you want to withdraw all grades?", method: "post"}} %>
</li>
<li class="danger-side danger-bottom"> <%= link_to "Reload config file", {:action => "reload" }, {:title=> "Reload the assessment config file (provided for backward compatibility with legacy assessments)", data: {confirm: "Are you sure you want to reload the config file?"}} %></li>
</ul>
Expand Down Expand Up @@ -107,7 +107,7 @@
<li class="danger-side"><%= link_to "Reload config file", url_for(:action => 'reload'),
:title=> "Reload the assessment configuration file (provided for backward compatibility with legacy assessments)", data: {confirm: "Are you sure you want to reload the config file?"} %></li>
<li class="danger-side danger-bottom">
<%= button_to "Release section grades", { :action => "releaseSectionGrades" }, { :title=> "Make all scores visible to the students in your section. This will work only if your instructor has assigned you to a lecture and section in your Autolab account.", data: {confirm: "Are you sure you want to release section grades?"}} %>
<%= link_to "Release section grades", { :action => "releaseSectionGrades" }, { :title=> "Make all scores visible to the students in your section. This will work only if your instructor has assigned you to a lecture and section in your Autolab account.", data: {confirm: "Are you sure you want to release section grades?", method: "post"}} %>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/schedulers/index.html.erb
Expand Up @@ -17,7 +17,7 @@
<td><%=h scheduler.action %></td>
<td><%=h scheduler.next %></td>
<td><%=h scheduler.interval %></td>
<td><%= link_to 'Visual Run', {:action=>"run", :scheduler_id=>scheduler.id} %></td>
<td><%= link_to 'Visual Run', {:action=>"run", :scheduler_id=>scheduler.id}, data: { method: "post" } %></td>
<td><%= link_to 'Show', {:action=>"show",:id=>scheduler.id} %>
<%= link_to 'Edit', edit_course_scheduler_path(@course, scheduler) %>
<%= link_to 'Destroy', course_scheduler_path(@course, scheduler), method: "delete", data: {confirm: 'Are you sure?'} %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/schedulers/run.html.erb
@@ -1,7 +1,7 @@
<% content_for :javascripts do %>
<script type="text/javascript">
$(function () {
$.get("visualRun", function (returned) {
$.post("visualRun", function (returned) {
$(".output").html(returned)
})
})
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Expand Up @@ -71,8 +71,8 @@

resources :courses, param: :name do
resources :schedulers do
get "visualRun", action: :visual_run
get "run"
post "visualRun", action: :visual_run
post "run"
end

resource :metrics, only: :index do
Expand Down

0 comments on commit af5eb69

Please sign in to comment.