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">
|
|
|
|
<span class="glyphicon glyphicon-exclamation-sign"></span>
|
|
|
|
<%= 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" %>
|
2017-01-12 23:54:15 +08:00
|
|
|
<%= 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>
|
2017-01-12 18:03:14 +08:00
|
|
|
<% 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" %>
|
2017-01-12 23:54:15 +08:00
|
|
|
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: protocol_str).html_safe %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% else %>
|
2017-01-12 23:54:15 +08:00
|
|
|
<%= 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>
|
2017-01-04 00:27:22 +08:00
|
|
|
</div>
|