1- <%= form_for :submission_response_import, url: submission_response_imports_path, multipart: true do |f| %>
2- <div class ="title is-3 "> Submission Response Import</ div >
1+ < h1 class ="title is-3 "> Submission Response Import</ h1 >
32
4- < div id ="file-js-example " class ="file has-name ">
5- < label class ="file-label ">
6- < input class ="file-input " type ="file " name ="submission_response_import ">
7- < span class ="file-cta ">
8- < span class ="file-icon ">
9- < i class ="fas fa-upload "> </ i >
10- </ span >
11- < span class ="file-label ">
12- Choose a file…
13- </ span >
14- </ span >
15- < span class ="file-name " style ="width: 50em; ">
16- No file uploaded
17- <%= f . file_field :file %>
18- </ span >
19- </ label >
20- <%= f . submit "Upload" ,
21- class : "button is-primary" ,
22- name : nil %>
3+ <%= form_with url : submission_response_imports_path , multipart : true , local : true do |f | %>
4+ < div id ="upload ">
235 </ div >
6+
7+ <%= f . submit "Import" , class : "button is-primary" %>
248<% end %>
259
2610< script >
27- const fileInput = document . querySelector ( '#file-js-example input[type=file]' ) ;
28- fileInput . onchange = ( ) => {
29- if ( fileInput . files . length > 0 ) {
30- const fileName = document . querySelector ( '#file-js-example .file-name' ) ;
31- fileName . textContent = fileInput . files [ 0 ] . name ;
32- }
33- }
34- </ script >
11+ document . addEventListener ( 'DOMContentLoaded' , ( ) => {
12+ EntryPoints . fileUpload ( '#upload' , {
13+ fieldName : 'submission_response_import[file]' ,
14+ } )
15+ } )
16+ </ script >
0 commit comments