adds asset preview link to repository row modal and to table row item [fixes SCI-2110]

This commit is contained in:
zmagod 2018-04-10 17:06:53 +02:00
parent eca69cfc75
commit 233e73c709
14 changed files with 14 additions and 35 deletions

View file

@ -203,6 +203,7 @@ var RepositoryDatatable = (function(global) {
initRowSelection();
bindExportActions();
disableCheckboxToggleOnAssetDownload();
initPreviewModal();
}
});

View file

@ -16,7 +16,7 @@
$(this).find('.modal-body #repository_row-info-table').DataTable().destroy();
$(this).remove();
});
initPreviewModal();
$('#repository_row-info-table').DataTable({
dom: 'RBltpi',
stateSave: false,

View file

@ -40,8 +40,8 @@ module RepositoryDatatableHelper
def display_cell_value(cell, team)
if cell.value_type == 'RepositoryAssetValue'
render partial: 'repositories/asset_link',
locals: { asset: cell.value.asset },
render partial: 'shared/asset_link',
locals: { asset: cell.value.asset, not_in_repository: false },
formats: :html
else
custom_auto_link(display_tooltip(cell.value.data,

View file

@ -33,7 +33,7 @@
<!-- About us modal -->
<%= render "shared/about_modal" %>
<%= render "shared/file_preview_modal.html.erb" %>
<%= render "shared/navigation" %>
<div id="notifications">

View file

@ -3,5 +3,5 @@
<% elsif result.is_table %>
<%= render partial: "results/result_table.html.erb", locals: {result: result} %>
<% elsif result.is_asset %>
<%= render partial: "shared/asset_link", locals: { asset: result.asset }, formats: :html %>
<%= render partial: "shared/asset_link", locals: { asset: result.asset, not_in_repository: true }, formats: :html %>
<% end %>

View file

@ -43,9 +43,6 @@
<!-- Import protocol elements -->
<%= render partial: "protocols/import_export/import_elements.html.erb" %>
<!-- Image preview modal -->
<%= render partial: "shared/file_preview_modal.html.erb" %>
<!-- Complete task modal -->
<%= render partial: 'my_modules/complete_task_modal.html.erb' %>

View file

@ -41,8 +41,6 @@
<div style="height: 15px;"></div>
<%= render partial: "shared/file_preview_modal.html.erb" %>
<div id="results" data-module-id="<%= @my_module.id %>">
<% ordered_result_of(@my_module).each do |result| %>
<%= render partial: "result", locals: { result: result } %>

View file

@ -10,8 +10,6 @@
<%= render partial: "protocols/steps.html.erb" %>
<%= render partial: "shared/file_preview_modal.html.erb" %>
<div class="hidden" data-role="updated-at-label-url" data-url="<%= updated_at_label_protocol_path(@protocol) %>"></div>
<%= javascript_include_tag "protocols/edit" %>

View file

@ -146,7 +146,6 @@
<%= render partial: "protocols/index/import_results_modal.html.erb" %>
<%= render partial: "protocols/index/linked_children_modal.html.erb" %>
<%= render partial: "protocols/index/protocol_preview_modal.html.erb" %>
<%= render partial: "shared/file_preview_modal.html.erb" %>
<%= render partial: "protocols/import_export/import_elements.html.erb" %>

View file

@ -1,18 +0,0 @@
<% if asset.file_present %>
<% if asset.file.processing? %>
<span data-status='asset-loading'
data-present-url='<%= file_present_asset_path(asset.id) %>'>
<%= image_tag 'medium/processing.gif' %>
</span>
<% else %>
<%= link_to download_asset_path(asset),
class: 'file-preview-link',
id: "modal_link#{asset.id}",
data: { no_turbolink: true, id: true, status: 'asset-present', 'preview-url': asset_file_preview_path(asset) } do %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>
<% end %>
<% else %>
<%= image_tag 'medium/processing.gif' %>
<% end %>

View file

@ -28,10 +28,14 @@
</span>
<% @repository_row.repository_cells.each do |repository_cell| %>
<br>
<% if repository_cell.value_type == 'RepositoryAssetValue' %>
<%= render partial: "shared/asset_link", locals: { asset: repository_cell.value.asset, not_in_repository: false }, formats: :html %>
<% else %>
<span>
<%= t "repository_row.modal_info.custom_field", cf: repository_cell.repository_column.name %>
<%= custom_auto_link(repository_cell.value.formatted, simple_format: false, team: current_team) %>
</span>
<% end %>
<% end %>
</p>
@ -76,7 +80,7 @@
<em><%=t "repository_row.modal_info.no_tasks" %></em>
<% end %>
</div>
<script>window.initPreviewModal()</script>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal"><%= t("general.close")%></button>
</div>

View file

@ -9,7 +9,7 @@
class: 'file-preview-link',
id: "modal_link#{asset.id}",
data: { no_turbolink: true, id: true, status: 'asset-present', 'preview-url': asset_file_preview_path(asset) } do %>
<% if asset.is_image? %>
<% if asset.is_image? && not_in_repository %>
<%= image_tag asset.url(:medium) %>
<% end %>
<p><%= truncate(asset.file_file_name,

View file

@ -11,6 +11,6 @@
</div>
</div>
<div class="panel-body">
<%= render partial: "shared/asset_link", locals: { asset: ff.object }, formats: :html %>
<%= render partial: "shared/asset_link", locals: { asset: ff.object, not_in_repository: true }, formats: :html %>
</div>
</div>

View file

@ -83,7 +83,7 @@
<ul>
<% assets.each do |asset| %>
<li>
<%= render partial: "shared/asset_link", locals: { asset: asset }, formats: :html %>
<%= render partial: "shared/asset_link", locals: { asset: asset, not_in_repository: true }, formats: :html %>
</li>
<% end %>
</ul>