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

117 lines
5.8 KiB
Text
Raw Normal View History

2020-04-17 01:13:18 +08:00
<div class="dropdown my-module-protocol-status">
<% if @protocol.linked? %>
<span class="status-label linked">
[<%= t("my_modules.protocols.protocol_status_bar.linked") %>]
2020-04-17 01:13:18 +08:00
</span>
<% else %>
<span class="status-label">
[<%= t("my_modules.protocols.protocol_status_bar.unlinked") %>]
</span>
<% end %>
2020-05-02 02:45:09 +08:00
<a href="#" id="my-module-protocol-info-button" class="status-info
<%= 'parent-newer' if @protocol.parent_newer? || @protocol.parent_and_self_newer? %>
<%= 'protocol-newer' if @protocol.newer_than_parent? %>
" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2020-04-17 01:13:18 +08:00
<i class="fas fa-info-circle"></i>
</a>
<div class="dropdown-menu status-info-dropdown" aria-labelledby="my-module-protocol-info-button">
<div class="dropdown-header">
<h2 class="protocol-name">
<%= @protocol.parent&.name || @protocol.name %>
</h2>
<div class="protocol-header-info">
<span>ID: <%= @protocol.parent&.code || @protocol.code %></span>
</div>
</div>
2020-04-17 01:13:18 +08:00
<div class="dropdown-body">
<div class="info-line">
<div class="description"><%= t("my_modules.protocols.protocol_status_bar.protocol_created") %></div>
<div class="value"><%= I18n.l(@protocol.created_at, format: :full) %></div>
</div>
<% if @protocol.linked? && can_read_protocol_in_repository?(@protocol.parent) %>
<div class="info-line <%= "new-parent-version" if @protocol.parent_newer? || @protocol.parent_and_self_newer? %>">
<div class="description"><%= t("my_modules.protocols.protocol_status_bar.template_updated") %></div>
<% if @protocol.parent_newer? || @protocol.parent_and_self_newer? %>
<% end %>
<div class="value"><%= I18n.l(@protocol.parent.updated_at, format: :full) %></div>
</div>
<% end %>
<div class="info-line">
<div class="description"><%= t("my_modules.protocols.protocol_status_bar.protocol_updated") %></div>
<div class="value"><%= I18n.l(@protocol.updated_at, format: :full) %></div>
</div>
<% if @protocol.parent_newer? || @protocol.parent_and_self_newer? %>
<div class="notification-line new-parent-version">
<i class="fas fa-sync-alt"></i>
<div class="description"><%= t("my_modules.protocols.protocol_status_bar.messages.template_updated_html") %></div>
</div>
<% end %>
<% if @protocol.newer_than_parent? || @protocol.parent_and_self_newer? %>
<div class="notification-line new-protocol-version">
<i class="fas fa-info-circle"></i>
<div class="description"><%= t("my_modules.protocols.protocol_status_bar.messages.protocol_updated") %></div>
</div>
<% end %>
<% if @protocol.unlinked? %>
<div class="notification-line">
<i class="fas fa-unlink"></i>
<div class="description"><%= t("my_modules.protocols.protocol_status_bar.messages.unlinked") %></div>
</div>
<% end %>
</div>
<div class="dropdown-footer">
<div class="button-container no-padding">
2020-04-17 01:13:18 +08:00
<% if @protocol.linked? && can_manage_protocol_in_module?(@protocol) %>
<%= link_to unlink_modal_protocol_path(@protocol, format: :json), remote: true,
title: t("my_modules.protocols.protocol_status_bar.btns.unlink_title"),
data: { action: "unlink" },
class: "btn btn-light" do %>
<i class="fas fa-unlink"></i>
<%= t("my_modules.protocols.protocol_status_bar.btns.unlink") %>
<% end %>
<% end %>
</div>
<div class="button-container no-padding">
2020-05-06 18:20:20 +08:00
<% if can_read_protocol_in_module?(@protocol) && can_create_protocols_in_repository?(@protocol.team) && (@protocol.newer_than_parent? || @protocol.parent_and_self_newer? || @protocol.unlinked?) %>
2020-04-17 01:13:18 +08:00
<%= link_to copy_to_repository_modal_protocol_path(@protocol, format: :json), remote: true,
title: t("my_modules.protocols.protocol_status_bar.btns.save_to_repository_title"),
class: "btn btn-light btn-block",
data: {
action: "copy-to-repository",
hook: "protocol-copy-to-repository"
} do %>
<i class="fas fa-save"></i>
<% if @protocol.newer_than_parent? || @protocol.parent_and_self_newer? %>
<%= t("my_modules.protocols.protocol_status_bar.btns.save_a_copy_to_repository") %>
<% else %>
<%= t("my_modules.protocols.protocol_status_bar.btns.save_to_repository") %>
<% end %>
2020-04-17 01:13:18 +08:00
<% end %>
<% end %>
</div>
<div class="button-container no-padding">
2020-04-17 01:13:18 +08:00
<% if @protocol.linked? && can_manage_protocol_in_module?(@protocol) %>
<% if @protocol.parent_newer? || @protocol.parent_and_self_newer? %>
<%= link_to update_from_parent_modal_protocol_path(@protocol, format: :json), remote: true,
title: t("my_modules.protocols.protocol_status_bar.btns.update_self_title"),
class: "btn btn-light pull-right",
data: { action: "update-self" } do %>
<i class="fas fa-sync-alt"></i>
<%= t("my_modules.protocols.protocol_status_bar.btns.update_self") %>
<% end %>
<% elsif @protocol.newer_than_parent? %>
<%= link_to revert_modal_protocol_path(@protocol, format: :json), remote: true,
title: t("my_modules.protocols.protocol_status_bar.btns.revert_title"),
class: "btn btn-light pull-right",
data: { action: "revert" } do %>
<i class="fas fa-undo"></i>
<%= t("my_modules.protocols.protocol_status_bar.btns.revert") %>
<% end %>
<% end %>
<% end %>
</div>
</div>
2016-07-21 19:11:15 +08:00
</div>
</div>
2016-08-12 22:31:40 +08:00
<%= javascript_include_tag("my_modules/protocols/protocol_status_bar") %>