Merge pull request #1078 from vicmosin/issues/509

Introduced bulk edit endpoint for bulk edit of categories and tags
This commit is contained in:
James Cole
2017-12-30 11:54:06 +01:00
committed by GitHub
14 changed files with 328 additions and 3 deletions

View File

@@ -18,7 +18,7 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: edit_selected_txt, delete_selected_txt, token */
/** global: edit_selected_txt, edit_bulk_selected_txt, delete_selected_txt, token */
/**
*
@@ -45,6 +45,8 @@ $(document).ready(function () {
// click the edit button:
$('.mass_edit').click(goToMassEdit);
// click the edit button:
$('.mass_edit_bulk').click(goToMassBulkEdit);
// click the delete button:
$('.mass_delete').click(goToMassDelete);
// click reconcile button
@@ -100,6 +102,26 @@ function goToMassEdit() {
return false;
}
/**
*
* @returns {boolean}
*/
function goToMassBulkEdit() {
"use strict";
var checkedArray = getCheckboxes();
// go to specially crafted URL:
var bases = document.getElementsByTagName('base');
var baseHref = null;
if (bases.length > 0) {
baseHref = bases[0].href;
}
window.location.href = baseHref + '/transactions/mass/edit/bulk/' + checkedArray;
return false;
}
/**
*
* @returns {boolean}
@@ -144,6 +166,7 @@ function countChecked() {
var checked = $('.select_all_single:checked').length;
if (checked > 0) {
$('.mass_edit span').text(edit_selected_txt + ' (' + checked + ')');
$('.mass_edit_bulk span').text(edit_bulk_selected_txt + ' (' + checked + ')');
$('.mass_delete span').text(delete_selected_txt + ' (' + checked + ')');
// get amount for the transactions:

View File

@@ -0,0 +1,43 @@
/*
* edit.js
* Copyright (c) 2017 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
/** global: what */
$(document).ready(function () {
"use strict";
$.getJSON('json/categories').done(function (data) {
$('input[name="category"]').typeahead({source: data});
});
$.getJSON('json/tags').done(function (data) {
var opt = {
typeahead: {
source: data,
afterSelect: function () {
this.$element.val("");
}
}
};
$('input[name="tags"]').tagsinput(
opt
);
});
});