mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Some javascript code cleanup. Should make some pages lighter.
This commit is contained in:
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
|
|
||||||
// Return a helper with preserved width of cells
|
// Return a helper with preserved width of cells
|
||||||
var fixHelper = function(e, tr)
|
var fixHelper = function (e, tr) {
|
||||||
{
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var $originals = tr.children();
|
var $originals = tr.children();
|
||||||
var $helper = tr.clone();
|
var $helper = tr.clone();
|
||||||
$helper.children().each(function(index)
|
$helper.children().each(function (index) {
|
||||||
{
|
|
||||||
// Set helper cell sizes to match the original sizes
|
// Set helper cell sizes to match the original sizes
|
||||||
$(this).width($originals.eq(index).width());
|
$(this).width($originals.eq(index).width());
|
||||||
});
|
});
|
||||||
@@ -29,7 +27,23 @@ $(function () {
|
|||||||
helper: fixHelper,
|
helper: fixHelper,
|
||||||
items: 'tr:not(.ignore)',
|
items: 'tr:not(.ignore)',
|
||||||
stop: sortStop,
|
stop: sortStop,
|
||||||
handle: '.handle'
|
handle: '.handle',
|
||||||
|
start: function (event, ui) {
|
||||||
|
// Build a placeholder cell that spans all the cells in the row
|
||||||
|
var cellCount = 0;
|
||||||
|
$('td, th', ui.helper).each(function () {
|
||||||
|
// For each TD or TH try and get it's colspan attribute, and add that or 1 to the total
|
||||||
|
var colspan = 1;
|
||||||
|
var colspanAttr = $(this).attr('colspan');
|
||||||
|
if (colspanAttr > 1) {
|
||||||
|
colspan = colspanAttr;
|
||||||
|
}
|
||||||
|
cellCount += colspan;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the placeholder UI - note that this is the item's content, so TD rather than TR
|
||||||
|
ui.placeholder.html('<td colspan="' + cellCount + '"> </td>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
).disableSelection();
|
).disableSelection();
|
||||||
} else {
|
} else {
|
||||||
@@ -38,7 +52,6 @@ $(function () {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function sortStop(event, ui) {
|
function sortStop(event, ui) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var current = $(ui.item);
|
var current = $(ui.item);
|
||||||
@@ -49,12 +62,8 @@ function sortStop(event, ui) {
|
|||||||
|
|
||||||
if (current.prev().data('date') !== thisDate && current.next().data('date') !== thisDate) {
|
if (current.prev().data('date') !== thisDate && current.next().data('date') !== thisDate) {
|
||||||
// animate something with color:
|
// animate something with color:
|
||||||
current.animate({
|
current.animate({backgroundColor: "#d9534f"}, 200, function () {
|
||||||
backgroundColor: "#d9534f"
|
$(this).animate({backgroundColor: originalBG}, 200);
|
||||||
}, 200, function () {
|
|
||||||
$(this).animate({
|
|
||||||
backgroundColor: originalBG
|
|
||||||
}, 200);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -72,17 +81,7 @@ function sortStop(event, ui) {
|
|||||||
// do extra animation when done?
|
// do extra animation when done?
|
||||||
$.post('/transaction/reorder', {items: submit, date: thisDate, _token: token});
|
$.post('/transaction/reorder', {items: submit, date: thisDate, _token: token});
|
||||||
|
|
||||||
current.animate({
|
current.animate({backgroundColor: "#5cb85c"}, 200, function () {
|
||||||
backgroundColor: "#5cb85c"
|
$(this).animate({backgroundColor: originalBG}, 200);
|
||||||
}, 200, function () {
|
|
||||||
$(this).animate({
|
|
||||||
backgroundColor: originalBG
|
|
||||||
}, 200);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//else update some order thing bla bla.
|
|
||||||
//check if the item above OR under this one have the same date
|
|
||||||
//if not. return false
|
|
||||||
|
|
||||||
}
|
}
|
2
public/js/lib/jquery.color-2.1.2.min.js
vendored
Normal file
2
public/js/lib/jquery.color-2.1.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -49,9 +49,5 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var what = '{{ what }}';
|
var what = '{{ what }}';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript" src="js/Chart.min.js"></script>
|
|
||||||
<script type="text/javascript" src="js/charts.js"></script>
|
|
||||||
<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
|
<script type="text/javascript" src="js/bootstrap-sortable.js"></script>
|
||||||
<script type="text/javascript" src="js/accounts.js"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -54,7 +54,8 @@
|
|||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="js/Chart.min.js"></script>
|
<script type="text/javascript" src="js/Chart.min.js"></script>
|
||||||
<script type="text/javascript" src="js/charts.js"></script>
|
<script type="text/javascript" src="js/charts.js"></script>
|
||||||
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
|
<script src="js/lib/jquery-ui.min.js" type="text/javascript"></script>
|
||||||
<script src="js/accounts.js" type="text/javascript"></script>
|
<script src="js/lib/jquery.color-2.1.2.min.js" type="text/javascript"></script>
|
||||||
|
<script src="js/accounts/show.js" type="text/javascript"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user