Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mtill committed May 26, 2018
1 parent 457111e commit 18aa272
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
13 changes: 2 additions & 11 deletions static/categorize.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ function categorize(theid, successFunction) {
insertCategories();
}

$("#button-" + theid).hide();
$("#button-" + theid).addClass("dontshow");
$.ajax({
type: "POST",
url: "/categorize",
data: JSON.stringify({itemId: theid, thecategory: theValue}),
success: function(data) {
$("#button-" + theid).hide();
$("#item-" + theid).attr("origValue", theValue);
onItemCategorized(theid);
},
contentType: "application/json; charset=utf-8"
Expand All @@ -42,13 +40,6 @@ function isConfirmed(event, theid) {
return false;
}

var theItem = $("#item-" + theid);
var theButton = $("#button-" + theid);
if (theItem.attr("origValue") != theItem.val()) {
theButton.show();
} else {
theButton.hide();
}

$("#button-" + theid).removeClass("dontshow");
return true;
}
4 changes: 4 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ tr:nth-child(odd){
tr:hover {
background-color: #ddd;
}

.dontshow {
visibility: hidden;
}
4 changes: 2 additions & 2 deletions views/categorize.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<td title="{{title}}">{{shorttitle}}</td>
<td>{{amountcurrency}}</td>
<td>
<input type="text" id="item-{{theid}}" origValue="{{thecategory}}" list="catlist" value="{{thecategory}}" onkeyup="isConfirmed(event, '{{theid}}')">
<img src="/static/ok.png" id="button-{{theid}}" style="display:none" onclick="categorize('{{theid}}')">
<input type="text" id="item-{{theid}}" list="catlist" value="{{thecategory}}" onkeyup="isConfirmed(event, '{{theid}}')">
<img src="/static/ok.png" id="button-{{theid}}" class="dontshow" onclick="categorize('{{theid}}')">
</td>
</tr>
%end
Expand Down
6 changes: 4 additions & 2 deletions views/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ function doPlot() {
// items.push($(this).val());
//});
$('#duplicates').html("").hide();
$('#duplicates').html("");
$("#inout").html("<h2>Lade Daten ...</h2>");
$.ajax({
type: "POST",
url: "/getConsolidated",
Expand All @@ -101,6 +102,7 @@ function doPlot() {
data: JSON.stringify({byCategory: "{{byCategory}}", traces: {{! tracesJSON}}}),
% end
success: function(thedata) {
$("#inout").html("");
plotData = thedata;
if (plotData["foundDuplicates"].length != 0) {
$("#duplicates").html("<h2>Mögliche Duplikate gefunden:</h2>\n" + plotData["foundDuplicates"].join('<br>\n')).show();
Expand All @@ -113,7 +115,7 @@ function doPlot() {
}
function showDetails(theX) {
$("#details").html("");
$("#details").html("<h2>Lade Details ...</h2>");
$.ajax({
type: "POST",
url: "/getDetails",
Expand Down

0 comments on commit 18aa272

Please sign in to comment.