prepare for multi actions
This commit is contained in:
parent
20a11b62b7
commit
3b5ee97008
|
@ -139,6 +139,7 @@ div.table {
|
|||
}
|
||||
|
||||
#content div.table div.table-top,
|
||||
div.multi-actions,
|
||||
#content div.table p {
|
||||
margin: 0 0;
|
||||
padding: 5px 1ex;
|
||||
|
@ -611,24 +612,39 @@ dl.portletFolderLinks dd {
|
|||
margin-top: 0;
|
||||
}
|
||||
|
||||
#portal-body td.colour-column { width: 1px; padding: 0; }
|
||||
#content .portletItem table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#portal-body tr.row-state-published td.colour-column { background: #b54040; }
|
||||
#portal-body tr.row-state-abandoned td.colour-column { background: #aaaaaa; }
|
||||
#portal-body table.listing th,
|
||||
#portal-body table.listing td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#portal-body th span.colour-column-head { display: block; width: 2rem; height: 2rem; padding: 0; }
|
||||
#portal-body td.colour-column { width: 1ex; height: 1ex; padding: 0; }
|
||||
#portal-body td.colour-column label { padding: 0.8rem; display: block; }
|
||||
#portal-body td.colour-column input { }
|
||||
|
||||
#portal-body tr.row-state-published td.colour-column { background: #b54040 !important; }
|
||||
#portal-body tr.row-state-abandoned td.colour-column { background: #aaaaaa !important; }
|
||||
#portal-body tr.row-state-attributed td.colour-column { }
|
||||
#portal-body tr.row-state-done td.colour-column { background: #62ae17; }
|
||||
#portal-body tr.row-state-in-progress td.colour-column { background: #e38623; }
|
||||
#portal-body tr.row-state-done td.colour-column { background: #62ae17 !important; }
|
||||
#portal-body tr.row-state-in-progress td.colour-column { background: #e38623 !important; }
|
||||
#portal-body tr.row-state-refusal-requested td.colour-column { }
|
||||
#portal-body tr.row-state-todo td.colour-column { background: #de0707; }
|
||||
#portal-body tr.row-state-refused td.colour-column { background: #fe2707; }
|
||||
#portal-body tr.row-state-answered td.colour-column { background: #62ae17; }
|
||||
#portal-body tr.row-state-todo td.colour-column { background: #de0707 !important; }
|
||||
#portal-body tr.row-state-refused td.colour-column { background: #fe2707 !important; }
|
||||
#portal-body tr.row-state-answered td.colour-column { background: #62ae17 !important; }
|
||||
#portal-body tr.row-state-assigning td.colour-column.colour-column { background: #de0707;}
|
||||
#portal-body tr.row-state-noaction td.colour-column { background: #aaaaaa; }
|
||||
#portal-body tr.row-state-processing td.colour-column { background: #ff6600; }
|
||||
#portal-body tr.row-state-noaction td.colour-column { background: #aaaaaa !important; }
|
||||
#portal-body tr.row-state-processing td.colour-column { background: #ff6600 !important; }
|
||||
#portal-body tr.row-state-registering td.colour-column { }
|
||||
#portal-body tr.row-state-ready_to_sent td.colour-column { }
|
||||
#portal-body tr.row-state-sent td.colour-column { background: #62ae17; }
|
||||
#portal-body tr.row-state-writing td.colour-column { background: #e38623; }
|
||||
#portal-body tr.row-state-sent td.colour-column { background: #62ae17 !important; }
|
||||
#portal-body tr.row-state-writing td.colour-column { background: #e38623 !important; }
|
||||
|
||||
#portal-body tr.selected td { background: #bbb; }
|
||||
#portal-body tr.selected:hover td { background: #bbb; }
|
||||
|
||||
|
||||
#portal-advanced-search {
|
||||
|
@ -928,3 +944,18 @@ table.listing td.icon-column {
|
|||
padding: 5px;
|
||||
border: 1px solid #666;
|
||||
}
|
||||
|
||||
div.multi-actions button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#portal-body div.ResultsOpinionsTable table th span.colour-column-head,
|
||||
#portal-body div.ResultsOpinionsTable table td.colour-column label,
|
||||
div#document-viewlets table th span.colour-column-head,
|
||||
div#document-viewlets table td.colour-column label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#portal-body div table tr.row-state-done td.colour-column label {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
|
||||
$.pfwbged.prepareLinearNavigation = function () {
|
||||
/* prepare for linear navigation from document page to document page */
|
||||
var doc_links = $('table.listing:first').parent('.ResultsTasksTable, .ResultsTable').find('tr a').map(
|
||||
var doc_links = $('table.listing:first').parent('.ResultsTasksTable, .ResultsTable, .ResultsDocumentsTable').find('tr a').map(
|
||||
function(a, b) { return $(b).attr('href'); });
|
||||
var doc_tables = $('table.listing');
|
||||
var i=0;
|
||||
for (i; i<doc_tables.length; i++) {
|
||||
var doc_table = doc_tables[i];
|
||||
var links = $(doc_table).parent('.ResultsTasksTable, .ResultsTable').find('tr a').map(
|
||||
var links = $(doc_table).parent('.ResultsTasksTable, .ResultsTable, .ResultsDocumentsTable').find('tr a').map(
|
||||
function(a, b) { return $(b).attr('href'); });
|
||||
if (links.length > 0) {
|
||||
doc_links.push.apply(doc_links, links);
|
||||
|
@ -63,6 +63,56 @@
|
|||
}
|
||||
};
|
||||
|
||||
$.pfwbged.prepareMultiActions = function () {
|
||||
$('th span.colour-column-head').click(function(e) {
|
||||
var $table = $(this).parents('table');
|
||||
$table.find('td.colour-column input').click();
|
||||
});
|
||||
$('td.colour-column input').change(function(e) {
|
||||
if ($(this).prop('checked')) {
|
||||
$(this).parents('tr').addClass('selected');
|
||||
} else {
|
||||
$(this).parents('tr').removeClass('selected');
|
||||
}
|
||||
$(this).parents('.portletItem').find('.multi-actions button').each(function(idx, elem) {
|
||||
var action_status = $(elem).data('status');
|
||||
var action_type = $(elem).data('type');
|
||||
var selector = 'tr.selected.row-state-' + action_status;
|
||||
if (action_type) {
|
||||
selector = selector + '.row-type-' + action_type;
|
||||
}
|
||||
if ($(this).parents('.portletItem').find(selector).length) {
|
||||
$(elem).show();
|
||||
} else {
|
||||
$(elem).hide();
|
||||
}
|
||||
});
|
||||
e.stopPropagation();
|
||||
return true;
|
||||
});
|
||||
$('.multi-actions button').on('click', function() {
|
||||
var $div = $(this).parent();
|
||||
var url = $(this).parent().data('actions-url');
|
||||
var action = $(this).data('action');
|
||||
var action_status = $(this).data('status');
|
||||
var documents = Array();
|
||||
$(this).parents('.ResultsTasksTable, .ResultsDocumentsTable, .ResultsTable').find('tr.selected.row-state-' + action_status + ' input').each(function(idx, elem) {
|
||||
documents.push($(elem).data('value'));
|
||||
});
|
||||
$div.find('button').prop('disabled', true);
|
||||
$.post(url, {'action': action, 'documents': documents }
|
||||
).done(function() {
|
||||
console.log('success');
|
||||
window.location.reload(true);
|
||||
}).fail(function() {
|
||||
console.log('fail');
|
||||
}).always(function() {
|
||||
$div.find('button').prop('disabled', false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).on('form-submit-validate', function(e, data, form) {
|
||||
/* before the form gets submitted to the server, we disable form buttons */
|
||||
$(form).find('.button-field').prop('disabled', 'disabled');
|
||||
|
@ -112,7 +162,7 @@ $(function() {
|
|||
return false;
|
||||
});
|
||||
var xhr_preview = null;
|
||||
$('.ResultsTasksTable tr a, .ResultsTable tr a').hover(function() {
|
||||
$('.ResultsTasksTable tr a, .ResultsDocumentsTable tr a, .ResultsTable tr a').hover(function() {
|
||||
$('#preview-doc').remove();
|
||||
xhr_preview = $.getJSON($(this).attr('href') + '/@@preview',
|
||||
function (data) {
|
||||
|
@ -131,5 +181,6 @@ $(function() {
|
|||
|
||||
$.pfwbged.prepareLinearNavigation();
|
||||
$.pfwbged.doLinearNavigation();
|
||||
$.pfwbged.prepareMultiActions();
|
||||
|
||||
});
|
||||
|
|
Reference in New Issue