mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-09 06:35:37 +08:00
fix protocol preview
This commit is contained in:
parent
356edba1b3
commit
4e7e261225
4 changed files with 18 additions and 6 deletions
|
@ -191,7 +191,9 @@ function initKeywordFiltering() {
|
|||
function initProtocolPreviewModal() {
|
||||
// Only do this if the repository is public/private
|
||||
if (repositoryType !== "archive") {
|
||||
// If you are in protocol repository
|
||||
var protocolsEl = protocolsTableEl;
|
||||
// If you are in search results
|
||||
if (document.getElementById("search-content")) {
|
||||
protocolsEl = $("#search-content");
|
||||
}
|
||||
|
|
|
@ -17,4 +17,16 @@ module SearchHelper
|
|||
link_to text, path
|
||||
end
|
||||
end
|
||||
|
||||
def route_to_other_org_btn(path, search_org, text)
|
||||
if search_org != current_organization
|
||||
link_to text,
|
||||
path,
|
||||
:class => 'btn btn-primary',
|
||||
data: { confirm: t('users.settings.changed_org_in_search',
|
||||
team: search_org.name) }
|
||||
else
|
||||
link_to text, path, :class => 'btn btn-primary'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<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" %>
|
||||
<%= route_to_other_org_btn edit_protocol_path(protocol),
|
||||
protocol.organization,
|
||||
t("general.edit") %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<% query ||= nil %>
|
||||
<% text = query.present? ? highlight(protocol.name, query.strip.split(/\s+/)) : (protocol.name.empty? ? t("search.index.no_name") : protocol.name) %>
|
||||
|
||||
|
||||
<% if protocol.in_repository_public? %>
|
||||
<span class="label label-info">
|
||||
<%=t "search.index.public" %>
|
||||
|
@ -18,10 +17,7 @@
|
|||
</span>
|
||||
|
||||
<% end %>
|
||||
<% if can_edit_protocol(protocol) %>
|
||||
<%= route_to_other_org edit_protocol_path(protocol),
|
||||
protocol.organization,
|
||||
text %>
|
||||
<% if can_view_protocol(protocol) %>
|
||||
<%= link_to text, '#', 'data-action' => 'protocol-preview', 'data-url' => preview_protocol_path(protocol) %>
|
||||
<% else %>
|
||||
<%= text %>
|
||||
|
|
Loading…
Add table
Reference in a new issue