我正在尝试阻止表单在使用条形码扫描仪时将提交文本输入突出显示的字段.当我按下扫描仪上的按钮时,它会自动尝试使用表单中的更高优先级提交按钮进行提交.我试图在javascript中使用忽略函数,但无法找到扫描仪的密钥代码值.有没有办法设置不同的提交按钮的优先级而不必重新排列它们?这就是我在代码中设置按钮的方法:
<li>
<cfinput type="submit" name="add" value="Enter Package">
<cfinput type="submit" name="search" value="Search">
<cfinput type="submit" name="reset" value="Reset">
</li>
</ul>
</td>
<td>
<center><div id="labelImageDiv">
<img id="labelImage" src="" alt="label preview"/>
</div>
<ul>
<li>
<label for="printersSelect" class="left">Printer:</label>
<select id="printersSelect" class="right"></select>
<button id="printButton">Print</button>
</li>
<li>
<div class="packHead">Package Pickup</div>
<label for="pickup" class="left">Scan Barcode:</label>
<div class="right">
<cfinput type="text" name="pickup">
</div>
</li>
<li>
<div id="pickButton">
<cfinput type="submit" name="pkgPickup" value="PickUp">
</div>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud) 我正在将旧的应用程序从rails 3.0升级到rails 4.1,并且无法设置设计和omniauth的路由.目前路线看起来像这样:
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
devise_for :users, controllers: {
omniauth_callbacks: "users/omniauth_callbacks"
}
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我收到以下错误:
Devise does not support scoping omniauth callbacks under a dynamic segment (RuntimeError)
and you have set "/(:locale)/users". You can work around by passing
`skip: :omniauth_callbacks` and manually defining the routes. Here is an example:
match "/users/auth/:provider",
constraints: { provider: /google|facebook/ },
to: "devise/omniauth_callbacks#passthru",
as: :omniauth_authorize,
via: [:get, :post]
match "/users/auth/:action/callback",
constraints: { action: /google|facebook/ },
to: "devise/omniauth_callbacks",
as: :omniauth_callback,
via: [:get, :post]
Run Code Online (Sandbox Code Playgroud)
我试图通过多种方式手动定义路线,但是当我运行测试时,我的路线都没有工作.有没有人知道用devise_for处理这些动态段的正确方法?
我试图以这种方式在一个rspec测试上设置时区:
zone = ActiveSupport::TimeZone.new('Hawaii')
Time.stub(:now) { Time.now.in_time_zone(zone) }
Run Code Online (Sandbox Code Playgroud)
这给了我一个堆栈级别太深的错误,我在这里缺少什么?