mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-12 16:14:58 +08:00
add edit button to protocol preview modal
This commit is contained in:
parent
40e3240a99
commit
e555535dfb
5 changed files with 12 additions and 4 deletions
|
@ -201,8 +201,10 @@ function initProtocolPreviewModal() {
|
||||||
var modal = $("#protocol-preview-modal");
|
var modal = $("#protocol-preview-modal");
|
||||||
var modalTitle = modal.find(".modal-title");
|
var modalTitle = modal.find(".modal-title");
|
||||||
var modalBody = modal.find(".modal-body");
|
var modalBody = modal.find(".modal-body");
|
||||||
|
var modalFooter = modal.find(".modal-footer");
|
||||||
modalTitle.html(data.title);
|
modalTitle.html(data.title);
|
||||||
modalBody.html(data.html);
|
modalBody.html(data.html);
|
||||||
|
modalFooter.html(data.footer);
|
||||||
modal.modal("show");
|
modal.modal("show");
|
||||||
initHandsOnTable($(document));
|
initHandsOnTable($(document));
|
||||||
},
|
},
|
||||||
|
|
|
@ -91,6 +91,10 @@ class ProtocolsController < ApplicationController
|
||||||
html: render_to_string(
|
html: render_to_string(
|
||||||
partial: 'protocols/index/protocol_preview_modal_body.html.erb',
|
partial: 'protocols/index/protocol_preview_modal_body.html.erb',
|
||||||
locals: { protocol: @protocol }
|
locals: { protocol: @protocol }
|
||||||
|
),
|
||||||
|
footer: render_to_string(
|
||||||
|
partial: 'protocols/index/protocol_preview_modal_footer.html.erb',
|
||||||
|
locals: { protocol: @protocol }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -95,7 +95,7 @@ class ProtocolsDatatable < AjaxDatatablesRails::Base
|
||||||
"DT_CanArchive": can_archive_protocol(protocol),
|
"DT_CanArchive": can_archive_protocol(protocol),
|
||||||
"DT_CanRestore": can_restore_protocol(protocol),
|
"DT_CanRestore": can_restore_protocol(protocol),
|
||||||
"DT_CanExport": can_export_protocol(protocol),
|
"DT_CanExport": can_export_protocol(protocol),
|
||||||
"1": name_html(record),
|
"1": protocol.in_repository_archived? ? record.name : name_html(record),
|
||||||
"2": keywords_html(record),
|
"2": keywords_html(record),
|
||||||
"3": modules_html(record),
|
"3": modules_html(record),
|
||||||
"4": record.full_username_str,
|
"4": record.full_username_str,
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body"></div>
|
<div class="modal-body"></div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer"></div>
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.close" %></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.close" %></button>
|
||||||
|
<% if can_edit_protocol(@protocol) %>
|
||||||
|
<%= link_to t("general.edit"), edit_protocol_path(@protocol), :class => "btn btn-primary" %>
|
||||||
|
<% end %>
|
Loading…
Add table
Reference in a new issue