diff --git a/app/assets/javascripts/repositories/repository_datatable.js.erb b/app/assets/javascripts/repositories/repository_datatable.js.erb index 78a571825..0197a09c6 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js.erb +++ b/app/assets/javascripts/repositories/repository_datatable.js.erb @@ -203,6 +203,7 @@ var RepositoryDatatable = (function(global) { initRowSelection(); bindExportActions(); disableCheckboxToggleOnAssetDownload(); + initPreviewModal(); } }); diff --git a/app/assets/javascripts/sitewide/repository_row_info_modal.js b/app/assets/javascripts/sitewide/repository_row_info_modal.js index c9f84ea81..8bb3eb172 100644 --- a/app/assets/javascripts/sitewide/repository_row_info_modal.js +++ b/app/assets/javascripts/sitewide/repository_row_info_modal.js @@ -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, diff --git a/app/helpers/repository_datatable_helper.rb b/app/helpers/repository_datatable_helper.rb index 6638b00ca..f914907a9 100644 --- a/app/helpers/repository_datatable_helper.rb +++ b/app/helpers/repository_datatable_helper.rb @@ -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, diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4ae85ba29..ebad3d034 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -33,7 +33,7 @@ <%= render "shared/about_modal" %> - + <%= render "shared/file_preview_modal.html.erb" %> <%= render "shared/navigation" %>
diff --git a/app/views/my_modules/_result_user_generated.html.erb b/app/views/my_modules/_result_user_generated.html.erb index 5463e5314..c0592e90d 100644 --- a/app/views/my_modules/_result_user_generated.html.erb +++ b/app/views/my_modules/_result_user_generated.html.erb @@ -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 %> diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb index 07012d1f3..a6d057a6c 100644 --- a/app/views/my_modules/protocols.html.erb +++ b/app/views/my_modules/protocols.html.erb @@ -43,9 +43,6 @@ <%= render partial: "protocols/import_export/import_elements.html.erb" %> - -<%= render partial: "shared/file_preview_modal.html.erb" %> - <%= render partial: 'my_modules/complete_task_modal.html.erb' %> diff --git a/app/views/my_modules/results.html.erb b/app/views/my_modules/results.html.erb index 41cca55cd..9ce275075 100644 --- a/app/views/my_modules/results.html.erb +++ b/app/views/my_modules/results.html.erb @@ -41,8 +41,6 @@
-<%= render partial: "shared/file_preview_modal.html.erb" %> -
<% ordered_result_of(@my_module).each do |result| %> <%= render partial: "result", locals: { result: result } %> diff --git a/app/views/protocols/edit.html.erb b/app/views/protocols/edit.html.erb index b57eab3eb..e92d86ca7 100644 --- a/app/views/protocols/edit.html.erb +++ b/app/views/protocols/edit.html.erb @@ -10,8 +10,6 @@ <%= render partial: "protocols/steps.html.erb" %> -<%= render partial: "shared/file_preview_modal.html.erb" %> - <%= javascript_include_tag "protocols/edit" %> diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb index b525aeb7f..35aa4be91 100644 --- a/app/views/protocols/index.html.erb +++ b/app/views/protocols/index.html.erb @@ -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" %> diff --git a/app/views/repositories/_asset_link.html.erb b/app/views/repositories/_asset_link.html.erb deleted file mode 100644 index b34b7d7f3..000000000 --- a/app/views/repositories/_asset_link.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% if asset.file_present %> - <% if asset.file.processing? %> - - <%= image_tag 'medium/processing.gif' %> - - <% 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 %> -

<%= truncate(asset.file_file_name, - length: Constants::FILENAME_TRUNCATION_LENGTH) %>

- <% end %> - <% end %> -<% else %> - <%= image_tag 'medium/processing.gif' %> -<% end %> diff --git a/app/views/repositories/_repository_row_info_modal.html.erb b/app/views/repositories/_repository_row_info_modal.html.erb index bde4d665a..92255b068 100644 --- a/app/views/repositories/_repository_row_info_modal.html.erb +++ b/app/views/repositories/_repository_row_info_modal.html.erb @@ -28,10 +28,14 @@ <% @repository_row.repository_cells.each do |repository_cell| %>
+ <% if repository_cell.value_type == 'RepositoryAssetValue' %> + <%= render partial: "shared/asset_link", locals: { asset: repository_cell.value.asset, not_in_repository: false }, formats: :html %> + <% else %> <%= 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) %> + <% end %> <% end %>

@@ -76,7 +80,7 @@ <%=t "repository_row.modal_info.no_tasks" %> <% end %>
- + diff --git a/app/views/shared/_asset_link.html.erb b/app/views/shared/_asset_link.html.erb index 6fd608195..2f0fe4cf3 100644 --- a/app/views/shared/_asset_link.html.erb +++ b/app/views/shared/_asset_link.html.erb @@ -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 %>

<%= truncate(asset.file_file_name, diff --git a/app/views/steps/_form_assets.html.erb b/app/views/steps/_form_assets.html.erb index 3d8f00e16..4bd7a290b 100644 --- a/app/views/steps/_form_assets.html.erb +++ b/app/views/steps/_form_assets.html.erb @@ -11,6 +11,6 @@

- <%= 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 %>
diff --git a/app/views/steps/_step.html.erb b/app/views/steps/_step.html.erb index 7544e6da7..9e746d622 100644 --- a/app/views/steps/_step.html.erb +++ b/app/views/steps/_step.html.erb @@ -83,7 +83,7 @@