【发布时间】:2018-07-23 13:53:42
【问题描述】:
我对简单表单 gem 很陌生,我想使用 SVG 插件自定义输入,例如将电子邮件图片放入输入字段“电子邮件”
这里是svg代码:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve" width="24" height="24"><title>email 84</title><g class="nc-icon-wrapper" stroke-linecap="square" stroke-linejoin="miter" stroke-width="2" fill="#111111" stroke="#111111"><polyline data-cap="butt" data-color="color-2" fill="none" stroke-miterlimit="10" points="1,3 12,13 23,3 " stroke-linecap="butt"/> <rect x="1" y="3" fill="none" stroke="#111111" stroke-miterlimit="10" width="22" height="18"/></g></svg>
这是我的简单表单代码:
<div class="col-xs-12 col-sm-4 col-sm-offset-4">
<div class="form-login">
<p>Welcome !!</p>
<div class="hr">
</div>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :first_name, required: true, autofocus: true, placeholder: "First name" %>
<%= f.input :last_name, required: true, autofocus: true, placeholder: "Last name" %>
<%= f.input :email, required: true, autofocus: true, placeholder: "Email Address" %>
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), placeholder: "Password" %>
<%= f.input :password_confirmation, required: true, placeholder: "Password" %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up", class: "btn btn-danger small-btn width-login" %>
</div>
<% end %>
</div>
</div>
我应该把 SVG 代码放在哪里?
谢谢!!
【问题讨论】:
-
你的意思是用户上传了图片,或者你只是想在表单的某个地方显示它?在后一种情况下,具体在哪里?
-
我只想在表格中显示!我希望图像在输入中,贴在右边框上。
标签: ruby-on-rails simple-form erb