Skip to content

Commit

Permalink
Yet cleaner version of teacher routes that just use :id
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed May 5, 2021
1 parent 84a6a1f commit 3d94da0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/views/main/_deny_modal.html.erb
Expand Up @@ -6,7 +6,7 @@
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<%= form_tag teacher_deny_path(:id => 0), method: :post, :class => "form-horizontal" do %>
<%= form_tag deny_teacher_path(0), method: :post, :class => "form-horizontal" do %>
<%= label_tag 'reason', 'Reason for Denial', :class => 'control-label' %>
<%= text_field_tag :reason, params[:reason], :class => "form-control", :id => nil %>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/views/main/dashboard.html.erb
Expand Up @@ -14,14 +14,14 @@
<%= render 'teachers/teacher', teacher: teacher %>
<td>
<div class="btn-group" role="group" aria-label="Validate or Remove Teacher">
<%= button_to("✔️", teacher_validate_path(teacher_id: teacher.id),
<%= button_to("✔️", validate_teacher_path(teacher.id),
class: 'btn btn-outline-success', type: 'button') %>
<span>
<button class="btn btn-outline-danger" type="button" data-toggle="modal" data-target=".js-denialModal" data-teacherid="<%= teacher.id %>" data-teachername="<%= teacher.full_name %>">
<button class="btn btn-outline-danger" type="button" data-toggle="modal" data-target=".js-denialModal" data-teacher-id="<%= teacher.id %>" data-teachername="<%= teacher.full_name %>">
</button>
</span>
<%# <%= button_to("Delete", teacher_delete_path(teacher_id: teacher.id),
<%# <%= button_to("Delete", teacher_delete_path(teacher.id),
data: {confirm: "Are you sure you wish to delete this form?"},
class: 'btn btn-danger', type: 'button') %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/schools/statistics.html.erb
Expand Up @@ -41,7 +41,7 @@
</a>
<% end %>
</td>
<td> <%= button_to("Validate", teacher_validate_path(:id => teacher.id), {class: 'btn btn-success'}) %> </td>
<td> <%= button_to("Validate", validate_teacher_path(:id => teacher.id), {class: 'btn btn-success'}) %> </td>
<td> <%= button_to("Delete", teacher_delete_path(:id => teacher.id), data: {confirm: "Are you sure you wish to delete this form?"}, class: 'btn btn-danger') %> </td>
</tr>
<% end %>
Expand Down
11 changes: 6 additions & 5 deletions config/routes.rb
@@ -1,15 +1,16 @@
Rails.application.routes.draw do
mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development?
mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)

# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

resources :teachers do
post :resend_welcome_email
post :validate
post :delete
post :deny
member do
post :resend_welcome_email
post :validate
post :delete
post :deny
end
end
resources :schools
resources :email_templates, only: [:index, :update, :edit]
Expand Down

0 comments on commit 3d94da0

Please sign in to comment.