scinote-web/app/views/my_modules/protocols/_protocol_buttons.html.erb

39 lines
2.8 KiB
Text
Raw Normal View History

2016-07-21 19:11:15 +08:00
<div class="btn-group" role="group" aria-label="" style="margin-left: 15px;">
<div class="btn-group">
2016-09-08 18:37:06 +08:00
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#"><span class="glyphicon glyphicon-import"></span><span class="hidden-xs-custom">&nbsp;<%= t("my_modules.protocols.buttons.load_protocol") %></span></a>
2016-07-21 19:11:15 +08:00
<ul class="dropdown-menu">
<% if can_load_protocol_into_module(@my_module) %>
<li>
<%= link_to load_from_repository_modal_protocol_path(@protocol, format: :json), remote: true, data: { action: "load-from-repository" } do %>
<span class="glyphicon glyphicon-book"></span>&nbsp;<%= t("my_modules.protocols.buttons.load_protocol_from_repository") %>
<% end %>
</li>
<% else %>
<li class="disabled"><a href="#"><span class="glyphicon glyphicon-book"></span>&nbsp;<%= t("my_modules.protocols.buttons.load_protocol_from_repository") %></a></li>
<% end %>
<% if can_load_protocol_into_module(@my_module) %>
<li>
<a class="btn-open-file" href="#" data-action="load-from-file" data-import-url="<%= load_from_file_protocol_path(@protocol, format: :json) %>">
<span class="glyphicon glyphicon-file"></span>&nbsp;<%= t("my_modules.protocols.buttons.load_protocol_from_file") %>
<input type="file" value="" accept=".eln">
</a>
</li>
<% else %>
<li class="disabled"><a href="#"><span class="glyphicon glyphicon-file"></span>&nbsp;<%= t("my_modules.protocols.buttons.load_protocol_from_file") %></a></li>
<% end %>
</ul>
</div>
<% if can_export_protocol_from_module(@my_module) %>
<%= link_to raw("<span class=\"glyphicon glyphicon-export\"></span><span class=\"hidden-xs-custom\">&nbsp;" + t('my_modules.protocols.buttons.export') + "</span>"), export_protocols_path(protocol_ids: @protocol.id), class: "btn btn-default", data: {no_turbolink: true} %>
2016-07-21 19:11:15 +08:00
<% else %>
2016-09-08 18:37:06 +08:00
<a href="#" class="btn btn-default disabled"><span class="glyphicon glyphicon-export"></span><span class="hidden-xs-custom">&nbsp;<%= t("my_modules.protocols.buttons.export") %></span></a>
2016-07-21 19:11:15 +08:00
<% end %>
<% if can_copy_protocol_to_repository(@my_module) %>
<%= link_to copy_to_repository_modal_protocol_path(@protocol, format: :json), id: "protocol-copy-to-repository", class: "btn btn-default", remote: true, data: { action: "copy-to-repository" } do %>
2016-09-08 18:37:06 +08:00
<span class="glyphicon glyphicon-saved"></span><span class="hidden-xs-custom">&nbsp;<%= t("my_modules.protocols.buttons.copy_to_repository") %></span>
2016-07-21 19:11:15 +08:00
<% end %>
<% else %>
2016-09-08 18:37:06 +08:00
<a href="#" class="btn btn-default disabled"><span class="glyphicon glyphicon-saved"></span><span class="hidden-xs-custom">&nbsp;<%= t("my_modules.protocols.buttons.copy_to_repository") %></span></a>
2016-07-21 19:11:15 +08:00
<% end %>
</div>