2015-07-27 18:20:20 +08:00
|
|
|
<script>
|
|
|
|
function showPreview(source) {
|
|
|
|
var file = source.files[0];
|
|
|
|
if(window.FileReader) {
|
|
|
|
var fr = new FileReader();
|
|
|
|
fr.onloadend = function(e) {
|
|
|
|
document.getElementById("avatar_image").src = e.target.result;
|
|
|
|
};
|
|
|
|
fr.readAsDataURL(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %>
|
|
|
|
<%#= text_field_tag 'school'%>
|
|
|
|
<div style="margin: 20px;">
|
|
|
|
<input type="hidden" value="<%= @school_name%>" name="school_name">
|
|
|
|
<%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%>
|
|
|
|
<a type="button" onclick="$('#file').click();" style="margin: 90px 0 0 10px;float: left;padding: 2px 5px;border: 1px solid #eaeaea;cursor: pointer;text-decoration: none;width: 55px;">上传图片</a>
|
|
|
|
<%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
|
|
|
|
<div style="clear: both;"></div>
|
|
|
|
<div style="margin-top: 10px;">
|
|
|
|
<%= submit_tag('上传') %>
|
|
|
|
<%= submit_tag('取消') %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2014-04-28 16:13:37 +08:00
|
|
|
<% end %>
|
2015-07-27 18:20:20 +08:00
|
|
|
|