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

50 lines
2.4 KiB
Text
Raw Normal View History

2023-02-17 21:27:20 +08:00
<div class="modal" id="newProtocolModal" tabindex="-1" role="dialog">
<%= form_with model: @protocol || Protocol.new,
url: type == 'new' ? protocols_path : copy_to_repository_protocol_path(@protocol),
method: :post,
html: { data: { action: type, remote: true } } do |f| %>
2023-02-17 21:27:20 +08:00
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
2023-08-17 19:55:17 +08:00
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('general.close') %>"><i class="sn-icon sn-icon-close"></i></button>
2023-02-17 21:27:20 +08:00
<h4 class="modal-title">
<%= t("protocols.new_protocol_modal.title_#{type}") %>
</h4>
</div>
<div class="modal-body">
<div class="sci-input-container">
<%= f.label :name, t("protocols.new_protocol_modal.name_label") %>
<%= f.text_field :name, placeholder: t("protocols.new_protocol_modal.name_placeholder"), class: 'sci-input-field' %>
</div>
<% if type == 'copy' %>
<p class="description">
<%= t("protocols.new_protocol_modal.description") %>
</p>
<% end %>
<div class="default-role-container">
<div class="sci-checkbox-container">
<%= f.check_box :visibility, { class: 'sci-checkbox'},:visible, :hidden %>
<span class="sci-checkbox-label"></span>
</div>
<div class="default-role-description">
<%= t("protocols.new_protocol_modal.access_label") %>
</div>
</div>
<div class="hidden" id="roleSelectWrapper">
<div class="sci-input-container">
<%= f.label :default_public_user_role_id, t("protocols.new_protocol_modal.role_label") %>
<% default_role = UserRole.find_by(name: I18n.t('user_roles.predefined.viewer')).id %>
<%= f.hidden_field :default_public_user_role_id, value: nil, disabled: true %>
<%= f.select :role_selector, options_for_select(team_user_roles_for_select, default_role) %>
2023-02-17 21:27:20 +08:00
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%= t('general.cancel') %></button>
<%= f.submit t("protocols.new_protocol_modal.create_#{type}") , class: "btn btn-primary create-protocol-button" %>
2023-02-17 21:27:20 +08:00
</div>
</div>
</div>
<% end %>
</div>