Skip to content

Commit

Permalink
aligned code
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushC committed Apr 21, 2024
1 parent 9eeb816 commit 44777d5
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions app/views/teachers/_files_display.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@

<div class="col-sm-8">
<% if teacher.files.attached? %>
<% teacher.files.each do |file| %>
<div class='form-group row'>
<%= link_to file.filename.to_s, rails_blob_path(file), target: "_blank", class: "box-link" %>
<% if show_delete_file %>
<%= button_to "❌", remove_file_teacher_path(teacher, file_id: file.id), method: :delete, data: { confirm: "Are you sure you want to remove this file?" }, style: "width: 40px;", class: "box-link" %>
<% end %>
</div>
<% end %>
<% else %>
<p>No files attached yet.</p>
<% end %>
<!-- Add file button -->
<% if show_add_file %>
<%= form_tag(upload_file_teacher_path(teacher), method: :post, multipart: true, id: "file-upload-form") do %>
<%= file_field_tag :file, id: "file-upload-field", style: "display: none;" %>
<label for="file-upload-field" class="btn btn-primary btn-purple mr-2">Add a File</label>
<% end %>
<div class="col-sm-8">
<% if teacher.files.attached? %>
<% teacher.files.each do |file| %>
<div class='form-group row'>
<%= link_to file.filename.to_s, rails_blob_path(file), target: "_blank", class: "box-link" %>
<% if show_delete_file %>
<%= button_to "❌", remove_file_teacher_path(teacher, file_id: file.id), method: :delete, data: { confirm: "Are you sure you want to remove this file?" }, style: "width: 40px;", class: "box-link" %>
<% end %>
</div>
<% end %>
<% else %>
<p>No files attached yet.</p>
<% end %>

<!-- Add file button -->
<% if show_add_file %>
<%= form_tag(upload_file_teacher_path(teacher), method: :post, multipart: true, id: "file-upload-form") do %>
<%= file_field_tag :file, id: "file-upload-field", style: "display: none;" %>
<label for="file-upload-field" class="btn btn-primary btn-purple mr-2">Add a File</label>
<% end %>
<% end %>
</div>

<% if show_add_file %>
Expand Down

0 comments on commit 44777d5

Please sign in to comment.