2017-05-25

2017-05-25  本文已影响9人  飞翔不能的翔哥
<link href="//cdn.bootcss.com/dropzone/4.3.0/min/dropzone.min.css" rel="stylesheet">
  <div class="row">
  <div class="col-xs-8 col-xs-offset-2">
    <h2>上传图片:</h2>
  </div>

  <div class="col-xs-8 col-xs-offset-2">
    <%= form_tag({action: :save_pic}, multipart: true ,class: "dropzone",id: "dz_save_pic") do %>
    <div class="fallback">
      <%= file_field_tag 'picture' ,accept:'image/*'%>
    </div>
    <% end %>
  </div>

  <div class="col-xs-8 col-xs-offset-2">
    <h1></h1>
  </div>

  <div class="col-xs-6 col-xs-offset-2">
    <%= link_to '完成' ,fixed_asset_path ,class: "btn btn-primary"  %>
    <!-- <%= link_to '完成' ,{action: "show"} ,class: "btn"%> -->
  </div>
</div>
<% content_for :script do %>
<script src="//cdn.bootcss.com/dropzone/4.3.0/min/dropzone.min.js"></script>
<%= javascript_include_tag "fixed_assets.js" %>
<script type="text/javascript">
  Dropzone.prototype.defaultOptions.dictDefaultMessage = "点击此处上传图片,或将需要上传的图片拖拽到此处!";
  Dropzone.prototype.defaultOptions.acceptedFiles = "image/*";
</script>
<% end %>
link_to "WRONG!", controller: "articles", id: "news", class: "article"
# => <a href="/articles/index/news?class=article">WRONG!</a>

正确的写法:

link_to "Articles", articles_path, id: "news", class: "article"
# => <a href="/articles" class="article" id="news">Articles</a>
上一篇下一篇

猜你喜欢

热点阅读