diff --git a/app/controllers/data_files_controller.rb b/app/controllers/data_files_controller.rb index de751f1388..b0f5ff67c2 100644 --- a/app/controllers/data_files_controller.rb +++ b/app/controllers/data_files_controller.rb @@ -145,12 +145,19 @@ def filter end end - def samples_table + def extracted_samples + @samples = @data_file.extracted_samples.includes(:sample_type) + respond_to do |format| + format.html + end + end + + def extracted_samples_table respond_to do |format| format.html do render(partial: 'samples/table_view', locals: { samples: @data_file.extracted_samples.includes(:sample_type), - source_url: samples_table_data_file_path(@data_file) + source_url: extracted_samples_table_data_file_path(@data_file) }) end format.json { @samples = @data_file.extracted_samples.select([:id, :title, :json_metadata]) } diff --git a/app/views/assets/_asset_buttons.html.erb b/app/views/assets/_asset_buttons.html.erb index 4138e3b706..697f78c874 100644 --- a/app/views/assets/_asset_buttons.html.erb +++ b/app/views/assets/_asset_buttons.html.erb @@ -20,7 +20,7 @@ <% end %> <% if asset.extracted_samples.any? %> - <%= button_link_to("View samples", 'view_samples', data_file_samples_path(asset)) %> + <%= button_link_to("View extracted samples", 'view_samples', extracted_samples_data_file_path(asset)) %> <% end %> <% if attempt_to_show_extract_samples_button?(asset, display_asset) %> diff --git a/app/views/data_files/_sample_persistence_status.html.erb b/app/views/data_files/_sample_persistence_status.html.erb index 44bc8f12be..093e078339 100644 --- a/app/views/data_files/_sample_persistence_status.html.erb +++ b/app/views/data_files/_sample_persistence_status.html.erb @@ -42,7 +42,7 @@

You can view the new samples by clicking the button below.

- <%= link_to('View Created Samples', data_file_samples_path(data_file), + <%= link_to('View Created Samples', extracted_samples_data_file_path(data_file), class: 'btn btn-primary') %> <% end %> <% end %> diff --git a/app/views/data_files/extracted_samples.html.erb b/app/views/data_files/extracted_samples.html.erb new file mode 100644 index 0000000000..849b9eff92 --- /dev/null +++ b/app/views/data_files/extracted_samples.html.erb @@ -0,0 +1,14 @@ +<% if @samples.any? %> +
+ <%= render partial: "samples/table_view", locals: { samples: @samples, link: true }%> +
+ +<% else %> +
+ There are no Samples available to be displayed +
+<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 71874821da..179c4a7514 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -492,7 +492,8 @@ post :create_metadata end member do - get :samples_table + get :extracted_samples_table + get :extracted_samples get :select_sample_type get :confirm_extraction get :extraction_status diff --git a/lib/seek/permissions/translator.rb b/lib/seek/permissions/translator.rb index 69fbafc771..aa749b8b39 100644 --- a/lib/seek/permissions/translator.rb +++ b/lib/seek/permissions/translator.rb @@ -6,7 +6,7 @@ class Translator view: Set.new(%i[ view show index search favourite favourite_delete comment comment_delete comments comments_timeline rate tag items statistics tag_suggestions preview runs - new_object_based_on_existing_one samples_table current diagram + new_object_based_on_existing_one extracted_samples extracted_samples_table current diagram ]).freeze, download: Set.new(%i[