scinote-web/app/views/protocols/index/_results_modal_body.html.erb

56 lines
2 KiB
Text
Raw Normal View History

2016-07-21 19:11:15 +08:00
<% nr_successful = results.count { |r| r[:success] } %>
<% failed = results.select { |r| !r[:success] } %>
<% unchanged = results.select { |r| r[:success] && r[:name] == r[:new_name] } %>
<% renamed = results.select { |r| r[:success] && r[:name] != r[:new_name] } %>
<% if failed.count > 0 %>
<div class="alert alert-danger" style="margin-bottom: 15px;" role="alert">
2020-01-21 22:21:40 +08:00
<span class="fas fa-exclamation-triangle"></span>
2016-07-21 19:11:15 +08:00
<%= t("protocols.index.#{en_action}.message_failed", nr: failed.count) %>
</div>
<% end %>
<% if nr_successful > 0 %>
<div>
<%= t("protocols.index.#{en_action}.message_ok", nr: nr_successful) %>
</div>
<% end %>
<div class="well well-sm well-protocols-results">
<ul>
<% if unchanged.count > 0 %>
<% unchanged.each do |r| %>
<li>
<span class="label label-success"><%= t("protocols.index.#{en_action}.row_success") %></span>
<% if en_action == "restore_results" %>
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: h(r[:name])).html_safe %>
2016-07-21 19:11:15 +08:00
<% else %>
<%= r[:name] %>
<% end %>
</li>
<% end %>
<% end %>
<% if renamed.count > 0 %>
<% renamed.each do |r| %>
<li>
<span class="label label-warning"><%= t("protocols.index.#{en_action}.row_renamed") %></span>
<% protocol_str = t("protocols.index.row_renamed_html", old_name: h(r[:name]), new_name: h(r[:new_name])) %>
2016-07-21 19:11:15 +08:00
<% if en_action == "restore_results" %>
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: protocol_str).html_safe %>
2016-07-21 19:11:15 +08:00
<% else %>
<%= protocol_str.html_safe %>
2016-07-21 19:11:15 +08:00
<% end %>
</li>
<% end %>
<% end %>
<% if failed.count > 0 %>
<% failed.each do |r| %>
<li>
<span class="label label-danger"><%= t("protocols.index.#{en_action}.row_failed") %></span>
<%= r[:name] %>
</li>
<% end %>
<% end %>
</ul>
</div>