I have a file field where a user can attach a photo
<%= f.label :photo, "Add a photo of yourself" %>
<%= f.file_field :photo, class: "form-control" %>
I've just downloaded a bootstrap theme.
Here is the html to create a file field with the bootstrap theme:
<div class="fileinput fileinput-new input-group" data-provides="fileinput">
<div class="form-control" data-trigger="fileinput">
<i class="glyphicon glyphicon-file fileinput-exists"></i>
<span class="fileinput-filename"></span>
</div>
<span class="input-group-addon btn btn-default btn-file">
<span class="fileinput-new">Select file</span>
<span class="fileinput-exists">Change</span>
<input type="file" name="..."></span>
<a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
</div>
How would I convert the theme's html to use the above rails form helpers to create the file field?
<span class="fileinput-exists">Change</span>
<input type="file" id="CLASSNAME_photo" name="CLASSNAME[photo]"></span>
e.g.: nested photo looks like this in my code:
<input id="blog_post_blogpostattachment_attributes_attachment" name="blog_post[blogpostattachment_attributes][attachment]" type="file">/</input>
should be something like this, for correct id and name you can check in the browser by inspecting the file field. You know, check the rendered html.
and then instead of the <%file_field%> add what you have.