style="display:none;margin-left:5em">
+ Manageable by <%= item.managers.empty? ? "None".html_safe : item.managers.collect { |m| link_to(h(m.title), m) }.join(", ").html_safe -%>
+
+
+ <% end %>
+
diff --git a/test/functional/publishing/batch_publishing_test.rb b/test/functional/publishing/batch_publishing_test.rb
index b90cdd2993..aeac3eb6ab 100644
--- a/test/functional/publishing/batch_publishing_test.rb
+++ b/test/functional/publishing/batch_publishing_test.rb
@@ -59,7 +59,7 @@ def setup
assert_select '.type_and_title img[src*=?][title=?]', 'lock.png', 'Private', count: total_asset_count
end
- assert_select '.parent-btn-checkbox', text: /Publish/, count: total_asset_count do
+ assert_select '.parent-btn-checkbox', count: total_asset_count do
publish_immediately_assets.each do |a|
assert_select "input[type='checkbox'][id=?]", "publish_#{a.class.name}_#{a.id}"
end
diff --git a/test/functional/publishing/single_publishing_test.rb b/test/functional/publishing/single_publishing_test.rb
index 8f77468a73..4638c54f76 100644
--- a/test/functional/publishing/single_publishing_test.rb
+++ b/test/functional/publishing/single_publishing_test.rb
@@ -109,21 +109,21 @@ def setup
assert_select '.type_and_title', text: /Investigation/, count: 1 do
assert_select 'a[href=?]', investigation_path(investigation), text: /#{investigation.title}/
end
- assert_select '.parent-btn-checkbox', text: /Publish/ do
+ assert_select '.parent-btn-checkbox' do
assert_select "input[type='checkbox'][id=?]", "publish_Investigation_#{investigation.id}"
end
assert_select '.type_and_title', text: /Study/, count: 1 do
assert_select 'a[href=?]', study_path(study), text: /#{study.title}/
end
- assert_select '.parent-btn-checkbox', text: /Publish/ do
+ assert_select '.parent-btn-checkbox' do
assert_select "input[type='checkbox'][id=?]", "publish_Study_#{study.id}"
end
assert_select '.type_and_title', text: /Assay/, count: 1 do
assert_select 'a[href=?]', assay_path(assay), text: /#{assay.title}/
end
- assert_select '.parent-btn-checkbox', text: /Publish/ do
+ assert_select '.parent-btn-checkbox' do
assert_select "input[type='checkbox'][id=?]", "publish_Assay_#{assay.id}"
end
@@ -133,12 +133,12 @@ def setup
assert_select 'a[href=?]', data_file_path(request_publishing_df), text: /#{request_publishing_df.title}/
assert_select 'a[href=?]', data_file_path(notifying_df), text: /#{notifying_df.title}/
end
- assert_select '.parent-btn-checkbox', text: /Publish/ do
+ assert_select '.parent-btn-checkbox' do
assert_select "input[type='checkbox'][id=?]", "publish_DataFile_#{publishing_df.id}"
assert_select "input[type='checkbox'][id=?]", "publish_DataFile_#{request_publishing_df.id}"
end
- assert_select 'span.label-warning', text: "Can't publish", count: 1
+ assert_select 'span.label-warning[data-tooltip=?]', 'You do not have permission to publish this item.', count: 1
end
test 'split-button recursive selection' do
From 8741deae0f554bf257b501bc8dda9e7eb460c7aa Mon Sep 17 00:00:00 2001
From: fherreazcue
Date: Wed, 19 Jul 2023 17:26:39 +0100
Subject: [PATCH 02/47] Refactored batch publishing preview - options for
sorting and js
---
app/assets/javascripts/checkbox.js | 54 ++++++-
.../_isa_publishing_preview.html.erb | 1 +
.../batch_publishing_preview.html.erb | 148 +++++++++++++++---
lib/seek/publishing/publishing_common.rb | 19 ++-
4 files changed, 194 insertions(+), 28 deletions(-)
diff --git a/app/assets/javascripts/checkbox.js b/app/assets/javascripts/checkbox.js
index 9c060735a9..cfaecfd5d3 100644
--- a/app/assets/javascripts/checkbox.js
+++ b/app/assets/javascripts/checkbox.js
@@ -24,6 +24,22 @@ $j(document).ready(function () {
$j("div.isa-tree-toggle-close").click(function () {
isaTreeHide(this,$j(this).data("cb_parent_selector"))
})
+ $j("a.collapseChildren").click(function (event) {
+ event.preventDefault();
+ collapseRecursively($j(this).data("cb_parent_selector"))
+ })
+ $j("a.expandChildren").click(function (event) {
+ event.preventDefault();
+ expandRecursively($j(this).data("cb_parent_selector"))
+ })
+ $j(".hideBlocked").click(function (event) {
+ event.preventDefault();
+ hideBlocked($j(this).data("cb_parent_selector"),$j(this).data("blocked_selector"))
+ })
+ $j(".showBlocked").click(function (event) {
+ event.preventDefault();
+ showBlocked($j(this).data("cb_parent_selector"),$j(this).data("blocked_selector"))
+ })
})
function selectChildren(select_all_element,cb_parent_selector){
@@ -56,7 +72,9 @@ function toggleManagers(item,managed_by_selector) {
function isaTreeShow(item,cb_parent_selector) {
let children_assets = $j('.isa-tree', $j(item).parents(cb_parent_selector))
- children_assets.splice(0, 1);
+ if(cb_parent_selector.includes('split_button_parent')){
+ children_assets.splice(0, 1);
+ }
let keep_closed = []
for (let asset of children_assets) {
$j(asset).show()
@@ -75,10 +93,40 @@ function isaTreeShow(item,cb_parent_selector) {
}
function isaTreeHide(item,cb_parent_selector){
let children_assets = $j('.isa-tree', $j(item).parents(cb_parent_selector))
- children_assets.splice(0, 1);
+ if(cb_parent_selector.includes('split_button_parent')){
+ children_assets.splice(0, 1);
+ }
for (let asset of children_assets) {
$j(asset).hide()
}
$j($j('.isa-tree-toggle-open', $j(item).parents(cb_parent_selector))[0]).show()
$j($j('.isa-tree-toggle-close', $j(item).parents(cb_parent_selector))[0]).hide()
-}
\ No newline at end of file
+}
+
+function collapseRecursively(cb_parent_selector){
+ let children_assets = $j('[class^=isa-tree-toggle]', $j(cb_parent_selector))
+ for (let asset of children_assets) {
+ isaTreeHide(asset,$j(asset).data("cb_parent_selector"))
+ }
+}
+
+function expandRecursively(cb_parent_selector){
+ let children_assets = $j('[class^=isa-tree-toggle]', $j(cb_parent_selector))
+ for (let asset of children_assets) {
+ isaTreeShow(asset,$j(asset).data("cb_parent_selector"))
+ }
+}
+
+function hideBlocked(cb_parent_selector,blocked_selector){
+ let children_assets = $j(blocked_selector, $j(cb_parent_selector))
+ for (let asset of children_assets) {
+ $j($j(asset).parents('div.split_button_parent')[0]).hide()
+ }
+}
+
+function showBlocked(cb_parent_selector,blocked_selector){
+ let children_assets = $j(blocked_selector, $j(cb_parent_selector))
+ for (let asset of children_assets) {
+ $j($j(asset).parents('div.split_button_parent')[0]).show()
+ }
+}
diff --git a/app/views/assets/publishing/_isa_publishing_preview.html.erb b/app/views/assets/publishing/_isa_publishing_preview.html.erb
index 53779ae75a..5e22c36ac8 100644
--- a/app/views/assets/publishing/_isa_publishing_preview.html.erb
+++ b/app/views/assets/publishing/_isa_publishing_preview.html.erb
@@ -1,5 +1,6 @@
<%
item = isa_publishing_preview
+ preselected ||=[]
case item
when Investigation
diff --git a/app/views/assets/publishing/batch_publishing_preview.html.erb b/app/views/assets/publishing/batch_publishing_preview.html.erb
index 625fca6bae..cc9055d779 100644
--- a/app/views/assets/publishing/batch_publishing_preview.html.erb
+++ b/app/views/assets/publishing/batch_publishing_preview.html.erb
@@ -11,17 +11,10 @@
- You can select an item to be published by checking the Publish
- checkbox beside that item.
+ You can select an item to be published by checking the checkbox beside that item.
\ No newline at end of file
diff --git a/app/views/assets/publishing/_isa_publishing_preview.html.erb b/app/views/assets/publishing/_isa_publishing_preview.html.erb
deleted file mode 100644
index ca8e354963..0000000000
--- a/app/views/assets/publishing/_isa_publishing_preview.html.erb
+++ /dev/null
@@ -1,36 +0,0 @@
-<%
- item = isa_publishing_preview
- preselected ||=[]
- publishing ||= false
-
- case item
- when Investigation
- children = item.studies
- when Study
- children = item.assays
- when Assay
- children = item.assets
- else
- children = []
- end
--%>
-