我有一堆按钮,总共3个。
这些按钮让我头疼,按钮按照奇怪的顺序禁用。如果我按下按钮2,它将禁用(它禁用,因为它向数据库提交数据)一旦禁用我可以点击按钮3提交数据,但它不会禁用。然而。按钮一会。
对于其他方法来说,它有点相同。如果你按下按钮3它将禁用,我可以禁用其他两个。如果我点击第一个按钮,我无法禁用其他两个,但数据提交正常。
在解释这个时你会温柔吗?我刚刚开始使用rails哈哈!
继承代码;
<div id="a" style="margin-right: 5px; float: left;">
<% if @conference_status.cross_charged_user_id.present? %>
<button id="a" class="btn btn-primary" disabled="disabled">Disabled</button>
<% else %>
<%= link_to 'Cross charged to Client', admin_conference_status_path(@conference_status, status_name: 'cross_charged_use'), class: "btn btn-primary", method: :put, remote: true, prompt: 'Are you sure?' %>
<% end %>
</div>
<div id="b" style="margin-right: 5px; float: left;">
<% if @conference_status.payment_received_comm_user_id.present? %>
<button class="btn btn-primary" disabled="disabled">Disabled</button>
<% else %>
<%= link_to 'Payment received Commission', admin_conference_status_path(@conference_status, status_name: 'payment_received_comm'), class: "btn btn-primary", method: :put, remote: true %>
<% end %>
</div>
<div id="c" style="margin-right: 5px; float: left;">
<% if @conference_status.payment_received_client_user_id.present? %>
<button class="btn btn-primary" disabled="disabled">Disabled</button>
<% else %>
<%= link_to 'Payment Received', admin_conference_status_path(@conference_status, status_name: 'payment_received'), class: "btn btn-primary", method: :put, remote: true %>
<% end %>
</div>
继承人js.erb
<% if @conference_status.cross_charged_datetime.present? %>
$('#a').html('<button class="btn btn-primary" disabled="disabled">Disabled</button>');
<% elsif @conference_status.payment_received_comm_user_id.present? %>
$('#b').html('<button class="btn btn-primary" disabled="disabled">Disabled</button>');
<% else @conference_status.payment_received_client_datetime.present? %>
$('#c').html('<button class="btn btn-primary" disabled="disabled">Disabled</button>');
<% end %>
答案 0 :(得分:0)
好,
我使用If命令重复修复了这个问题。 elsif和其他人似乎搞砸了。所以只需将它们全部更改为如果在Js.erb中并添加location /style/ {
deny all;
}
location /js/ {
deny all;
}
就可以正常工作
萨姆