Commit c03f28c3 authored by Liam's avatar Liam Committed by Robert Lyon

Bug #1528117: Collection export needs bulk options

behatnotneeded

Change-Id: Id82b367fc0da1b935efbcdf43a892eff9114a9a8
parent c9280d5a
......@@ -12,6 +12,7 @@
jQuery(function($) {
$('#whatviewsselection').removeClass('hidden');
$('#whatcollectionsselection').removeClass('hidden');
var containers = {
'views': {'container': $('#whatviews'), 'visible': false},
......@@ -84,6 +85,19 @@ jQuery(function($) {
sendjsonrequest(config['wwwroot'] + 'view/viewcontent.json.php', params, 'POST', showPreview.bind(null, 'big'));
});
});
$(containers.collections.container).find('a.viewlink').each(function() {
$(this).off();
$(this).prop('title', 'Click to preview');
$(this).on('click', function (event) {
event.preventDefault();
var href = $(this).prop('href');
var params = {
'id': getUrlParameter('id', href) || '',
'export': 1
};
sendjsonrequest(config['wwwroot'] + 'collection/viewcontent.json.php', params, 'POST', showPreview.bind(null, 'big'));
});
});
// Checkbox helpers
var checkboxes = $('#whatviews input.checkbox');
......@@ -105,5 +119,24 @@ jQuery(function($) {
});
});
var checkboxesCollection = $('#whatcollections input.checkbox');
var checkboxHelperDivCollection = $('<div>');
var checkboxSelectAllCollection = $('#selection_all_collections');
$(checkboxSelectAllCollection).on('click', function(e) {
e.preventDefault();
checkboxesCollection.each(function() {
$(this).prop('checked', true);
});
});
var checkboxReverseSelectionCollection = $('#selection_reverse_collections');
checkboxReverseSelectionCollection.on('click', function(e) {
e.preventDefault();
checkboxesCollection.each(function() {
$(this).prop('checked', !$(this).prop('checked'));
});
});
checkboxHelperDiv.insertBefore($(containers.views.container).find('div:first'));
});
......@@ -84,6 +84,9 @@ foreach ($elements as $key => $element) {
if ($body) {
echo '<div id="whatcollections" class="js-hidden exportable-artefacts"><div class="exportable-artefact-container"><h3 class="heading-exportable-pages">' . get_string('collectionstoexport', 'export') . "</h3>";
echo '<div id="whatcollectionsselection" class="hidden btn-group"><a href="" id="selection_all_collections" class="btn btn-default btn-xs">'
. get_string('selectall') . '</a><a href="" id="selection_reverse_collections" class="btn btn-default btn-xs">'
. get_string('reverseselection', 'export') . '</a></div>';
echo display_artefacts($body, $itemsinrow);
echo '</div></div>';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment