javascript - HTML/JS Integration with Ruby -


i have script; trying functional takes images , renders selections on page before user hits submit upload them. script calls input html using ruby code generate input/form submission/uploads. there way can tweak script grab ruby input?

script:

$(function() {   // multiple images preview in browser   var imagespreview = function(input, placetoinsertimagepreview) {        if (input.files) {           var filesamount = input.files.length;            (i = 0; < filesamount; i++) {               var reader = new filereader();                reader.onload = function(event) {                   $($.parsehtml('<img>')).attr('src', event.target.result).appendto(placetoinsertimagepreview);               }                reader.readasdataurl(input.files[i]);           }       }    };    $('#gallery-photo-add').on('change', function() {       imagespreview(this, 'div.gallery');   }); }); 

ruby:

<!-- image upload form -->       <div class="gallery">         <img />       </div>         <%= t.label :pictures %>         <span class="file" multiple id="gallery-photo-add" type="file">           <%= t.file_field :image, multiple: true %><br/>         </span>       </p>       <p>         <%= t.submit 'update', class: 'btn btn-default' %>       </p> 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -