2013-01-13 09:50:15 +01:00
|
|
|
// Entry object
|
2013-01-13 12:27:42 +01:00
|
|
|
function entry(){
|
|
|
|
this.id=ko.observable();
|
2013-01-26 01:15:07 +01:00
|
|
|
this.pointed=ko.observable();
|
2013-01-13 12:27:42 +01:00
|
|
|
this.operation_date=ko.observable();
|
|
|
|
this.label=ko.observable();
|
|
|
|
this.value=ko.observable();
|
|
|
|
this.account_id=ko.observable();
|
|
|
|
this.sold=ko.observable();
|
|
|
|
this.pointedsold=ko.observable();
|
|
|
|
this.category=ko.observable();
|
2013-01-07 18:42:02 +01:00
|
|
|
}
|
|
|
|
|
2013-01-13 10:14:43 +01:00
|
|
|
// Util function to show a message in message placeholder.
|
2013-01-07 18:42:02 +01:00
|
|
|
function message(alertType, title, message) {
|
|
|
|
$(".alert").alert('close');
|
2013-01-13 20:57:48 +01:00
|
|
|
$("#message-placeholder").append('<div class="alert alert-' + alertType + '"><button type="button" class="close" data-dismiss="alert">×</button><h4>' + title + '</h4>' + message + '</div>');
|
2013-01-07 18:42:02 +01:00
|
|
|
}
|
|
|
|
|
2013-01-13 12:50:11 +01:00
|
|
|
// The ListViewModel used to instanciate viewmodel.
|
2013-02-07 15:00:31 +01:00
|
|
|
var EntryController = function($scope, $http, $rootScope, $filter) {
|
2013-01-13 10:14:43 +01:00
|
|
|
// Entry store and selection
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.entries = [];
|
|
|
|
$scope.selectedItem = null;
|
2013-01-14 00:33:32 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.account = null;
|
2013-01-14 00:33:32 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Placeholder for saved value to cancel entry edition
|
|
|
|
$scope.savedItem = null;
|
2013-01-14 00:33:32 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.entriesLoaded = function(entries) {
|
|
|
|
var entriesReversed = entries.slice().reverse();
|
2013-01-14 00:33:32 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
var categories = [];
|
2013-01-14 00:33:32 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
var chartValues = [];
|
2013-01-25 00:13:03 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
var pieChartValuesTmp = {};
|
|
|
|
var pieChartValues = [];
|
2013-01-25 00:13:03 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
angular.forEach(entriesReversed, function(entry) {
|
|
|
|
var category = entry.category;
|
|
|
|
var value = entry.value ? Number(entry.value) : null;
|
|
|
|
var sold = entry.sold ? Number(entry.sold) : null;
|
|
|
|
var operation_date = entry.operation_date;
|
2013-01-25 00:13:03 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if(operation_date && sold) {
|
|
|
|
chartValues.push([entry.operation_date, sold]);
|
2013-01-25 00:13:03 +01:00
|
|
|
}
|
2013-01-13 13:32:23 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if(category && category != '') {
|
|
|
|
if(categories.indexOf(category) == -1) {
|
|
|
|
categories.push(category);
|
|
|
|
}
|
2013-01-12 22:11:48 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if(value && value < 0.0) {
|
|
|
|
var oldValue = 0.0;
|
2013-01-12 22:11:48 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if(pieChartValuesTmp[category]) {
|
|
|
|
oldValue = pieChartValuesTmp[category];
|
|
|
|
}
|
2013-01-12 22:11:48 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
pieChartValuesTmp[category] = oldValue - value;
|
2013-01-12 22:11:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-01-13 10:14:43 +01:00
|
|
|
// Second pass: transform to an array readable by jqplot.
|
2013-02-07 15:00:31 +01:00
|
|
|
angular.forEach(pieChartValuesTmp, function(value, key) {
|
|
|
|
pieChartValues.push([key, value]);
|
2013-01-12 22:11:48 +01:00
|
|
|
});
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.categories = categories;
|
2013-01-12 13:56:52 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.drawChart({account: $scope.account, entries: chartValues}, "#entries-chart-placeholder");
|
|
|
|
$scope.drawPieChart(pieChartValues, "#expense-categories-chart-placeholder");
|
|
|
|
};
|
2013-01-12 13:56:52 +01:00
|
|
|
|
2013-01-13 10:14:43 +01:00
|
|
|
// Function to load entries from server for a specific account and month.
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.loadEntries = function(account, month) {
|
|
|
|
if(account) {
|
|
|
|
$scope.account = account;
|
|
|
|
}
|
|
|
|
|
2013-01-30 00:32:06 +01:00
|
|
|
// Clean up selected entry.
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.selectedItem = null;
|
|
|
|
$scope.savedItem = null;
|
2013-01-24 21:19:07 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if(account && month) {
|
|
|
|
$http.get("api/entries/" + account.id + "/" + month.year + "/" + month.month).success($scope.loadEntries_success);
|
2013-01-14 00:33:32 +01:00
|
|
|
} else {
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.loadEntries_success(null);
|
2013-01-14 00:33:32 +01:00
|
|
|
}
|
2013-01-09 23:39:26 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Load entries success callback
|
|
|
|
$scope.loadEntries_success = function(data) {
|
|
|
|
var entries = [{
|
|
|
|
id: null,
|
|
|
|
pointed: false,
|
|
|
|
operation_date: null,
|
|
|
|
label: null,
|
|
|
|
value: null,
|
|
|
|
sold: null,
|
|
|
|
pointedsold: null,
|
|
|
|
category: null,
|
|
|
|
account_id: null,
|
|
|
|
state: 'edit'
|
|
|
|
}];
|
|
|
|
|
|
|
|
if(data) {
|
|
|
|
entries = entries.concat(angular.fromJson(data));
|
2013-01-12 13:56:52 +01:00
|
|
|
}
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.entries = entries;
|
2013-01-10 13:10:41 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.$emit("entriesLoadedEvent", {entries: entries});
|
|
|
|
};
|
2013-01-24 20:44:09 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Returns the CSS class for a pointed entry.
|
|
|
|
$scope.pointedEntryClass = function(entry) {
|
|
|
|
if(entry.pointed) {
|
|
|
|
return "active";
|
2013-01-14 00:33:32 +01:00
|
|
|
}
|
2013-01-09 23:39:26 +01:00
|
|
|
};
|
2013-01-07 18:42:02 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Returns the CSS class for an entry row.
|
|
|
|
$scope.entryRowClass = function(sold) {
|
|
|
|
if(sold < $scope.account.authorized_overdraft) {
|
|
|
|
return 'error';
|
2013-02-07 16:46:55 +01:00
|
|
|
} else if (esold < 0) {
|
2013-02-07 15:00:31 +01:00
|
|
|
return 'warning';
|
|
|
|
}
|
|
|
|
};
|
2013-01-24 20:44:09 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Returns the CSS class for an entry sold.
|
|
|
|
$scope.entryValueClass = function(sold) {
|
|
|
|
if(sold < $scope.account.authorized_overdraft) {
|
|
|
|
return 'text-error';
|
|
|
|
} else if (sold < 0) {
|
|
|
|
return 'text-warning';
|
|
|
|
}
|
|
|
|
};
|
2013-01-12 13:56:52 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Starts editing an entry
|
|
|
|
$scope.editEntry = function(entry) {
|
|
|
|
// Cancel previous editing.
|
|
|
|
if($scope.selectedItem) {
|
|
|
|
$scope.cancelEditEntry($scope.selectedItem);
|
2013-01-10 13:10:41 +01:00
|
|
|
}
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Save current entry values.
|
|
|
|
$scope.savedItem = angular.copy(entry);
|
|
|
|
$scope.selectedItem = entry;
|
2013-01-24 20:44:09 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Enter edit state.
|
|
|
|
entry.state='edit';
|
2013-01-07 18:42:02 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Returns true if the entry is a new one.
|
|
|
|
$scope.isNew = function(entry) {
|
|
|
|
return !entry.id;
|
2013-01-07 18:42:02 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Returns true if the entry is in editing state.
|
|
|
|
$scope.isEditing = function(entry) {
|
|
|
|
return entry.state === 'edit';
|
2013-01-07 18:42:02 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Returns true if the entry is in displaying state.
|
|
|
|
$scope.isDisplaying = function(entry) {
|
|
|
|
return entry.id && (!entry.state || entry.state === 'display');
|
2013-01-24 19:31:37 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.iconSaveClass = function(entry) {
|
|
|
|
if($scope.isNew(entry)) {
|
|
|
|
return "icon-plus";
|
|
|
|
} else if ($scope.isEditing(entry)) {
|
|
|
|
return "icon-ok";
|
2013-01-07 18:42:02 +01:00
|
|
|
}
|
2013-02-07 15:00:31 +01:00
|
|
|
};
|
2013-01-07 18:42:02 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.iconCancelClass = function(entry) {
|
|
|
|
if($scope.isNew(entry)) {
|
|
|
|
return "icon-remove";
|
|
|
|
} else if ($scope.isEditing(entry)) {
|
|
|
|
return "icon-ban-circle";
|
2013-01-07 18:42:02 +01:00
|
|
|
}
|
2013-02-07 15:00:31 +01:00
|
|
|
};
|
2013-01-07 18:42:02 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Cancel current editing entry or clears field if a new one.
|
|
|
|
$scope.cancelEditEntry = function(entry) {
|
|
|
|
if ($scope.isNew(entry)) {
|
|
|
|
// We are cancelling the new entry, just reset it.
|
|
|
|
entry.id = null; // id should not change, but just in case...
|
|
|
|
entry.pointed = false;
|
|
|
|
entry.operation_date = null;
|
|
|
|
entry.label = null;
|
|
|
|
entry.value = null;
|
|
|
|
entry.account_id = $scope.account.id; // account_id should not change, but just in case...
|
|
|
|
entry.category = null;
|
|
|
|
} else if($scope.isEditing(entry)) {
|
|
|
|
if($scope.savedItem) {
|
|
|
|
// Reset selected item fields to saved item ones.
|
|
|
|
entry.id = $scope.savedItem.id; // id should not change, but just in case...
|
|
|
|
entry.pointed = $scope.savedItem.pointed;
|
|
|
|
entry.operation_date = $scope.savedItem.operation_date;
|
|
|
|
entry.label = $scope.savedItem.label;
|
|
|
|
entry.value = $scope.savedItem.value;
|
|
|
|
entry.account_id = $scope.savedItem.account_id; // account_id should not change, but just in case...
|
|
|
|
entry.category = $scope.savedItem.category;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset saved and selected items to null.
|
|
|
|
$scope.savedItem = null;
|
|
|
|
$scope.selectedItem = null;
|
|
|
|
|
|
|
|
// Enter display state.
|
|
|
|
entry.state = 'display';
|
|
|
|
}
|
2013-01-07 18:42:02 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Points an entry.
|
|
|
|
$scope.pointEntry = function(entry) {
|
|
|
|
if(entry.pointed) {
|
|
|
|
entry.pointed = false;
|
2013-01-26 01:15:07 +01:00
|
|
|
} else {
|
2013-02-07 15:00:31 +01:00
|
|
|
entry.pointed = true;
|
2013-01-26 01:15:07 +01:00
|
|
|
}
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Save the entry if not new.
|
|
|
|
if(!$scope.isNew(entry)) {
|
|
|
|
$scope.saveEntry(entry);
|
2013-01-26 01:15:07 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Saves an entry.
|
|
|
|
$scope.saveEntry = function(entry) {
|
|
|
|
// Affects the account ID if not (should never happen)
|
|
|
|
if(!entry.account_id) {
|
|
|
|
entry.account_id = $scope.account.id;
|
2013-01-24 19:31:37 +01:00
|
|
|
}
|
2013-01-07 18:42:02 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Prepare the Ajax call to save the entry.
|
2013-01-13 20:57:48 +01:00
|
|
|
var type;
|
2013-01-24 00:01:42 +01:00
|
|
|
var url = "api/entries";
|
2013-01-13 20:57:48 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if(!$scope.isNew(entry)) {
|
|
|
|
url += "/" + entry.id;
|
2013-01-13 20:57:48 +01:00
|
|
|
}
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Ajax call to save an entry
|
|
|
|
$http.put(url, angular.toJson(entry)).success(function(data) {
|
2013-01-13 20:57:48 +01:00
|
|
|
message("success", "Save", data);
|
2013-01-07 18:42:02 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// $scope.savedItem = null;
|
2013-01-13 13:32:23 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Send the "entry saved" event.
|
|
|
|
$scope.$emit("entrySavedEvent", entry);
|
2013-01-07 18:42:02 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Removes an entry.
|
|
|
|
$scope.removeEntry = function(entry, modalScope) {
|
2013-01-13 13:32:23 +01:00
|
|
|
// Cancel current editing.
|
2013-02-07 15:00:31 +01:00
|
|
|
//$scope.cancelEditEntry(entry);
|
2013-01-13 13:32:23 +01:00
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
if (!$scope.isNew(entry)) {
|
|
|
|
$http.delete("api/entries/" + entry.id).success(function (result) {
|
|
|
|
message("success", "Delete", result);
|
|
|
|
|
|
|
|
// Send the "entry removed" event.
|
|
|
|
$scope.$emit("entryRemovedEvent", entry);
|
|
|
|
|
|
|
|
$scope.closeModal(modalScope);
|
|
|
|
}).error(function (data) {
|
|
|
|
message("error", "Delete", data);
|
|
|
|
|
|
|
|
$scope.closeModal(modalScope);
|
|
|
|
});
|
2013-01-07 18:42:02 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.closeModal = function(modalScope) {
|
|
|
|
// Close the modal dialog
|
|
|
|
if(modalScope && modalScope.dismiss) {
|
|
|
|
modalScope.dismiss();
|
|
|
|
}
|
2013-01-12 16:36:33 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
// Function to draw the sold evolution chart.
|
|
|
|
$scope.drawChart = function(data, elementId) {
|
|
|
|
// Clear previous chart
|
|
|
|
var element = angular.element(elementId);
|
|
|
|
element.html("");
|
|
|
|
element.css("height", "0px");
|
|
|
|
|
|
|
|
var entries = data.entries;
|
|
|
|
|
|
|
|
if(entries && entries.length > 1) {
|
|
|
|
// Prepare for today vertical line.
|
|
|
|
var today = new Date();
|
|
|
|
today.setHours(0);
|
|
|
|
today.setMinutes(0);
|
|
|
|
|
|
|
|
// Find first and last days to set limits of the x axis.
|
|
|
|
var day = 24 * 60 * 60 * 1000;
|
|
|
|
var firstDate = $filter('date')(new Date(Date.parse(entries[0][0]).valueOf() - day), 'yyyy-MM-dd');
|
|
|
|
var lastDate = $filter('date')(new Date(Date.parse(entries[entries.length -1][0]).valueOf() + day), 'yyyy-MM-dd');
|
|
|
|
|
|
|
|
// Plot chart, and store it in a window parameter for resize callback (need to be done better than it...)
|
|
|
|
window.chart = $.jqplot(element.prop("id"), [entries], {
|
|
|
|
// Title of the chart
|
|
|
|
title: "Évolution du solde",
|
|
|
|
axes:{
|
|
|
|
// Parameters for the date axis
|
|
|
|
xaxis:{
|
|
|
|
autoscale: true,
|
|
|
|
|
|
|
|
// Date rendere for this axis
|
|
|
|
renderer:$.jqplot.DateAxisRenderer,
|
|
|
|
|
|
|
|
// Limits
|
|
|
|
min: firstDate,
|
|
|
|
max: lastDate,
|
|
|
|
|
|
|
|
// Tick options
|
|
|
|
tickOptions: {
|
|
|
|
// Format date for x axis.
|
|
|
|
formatString: "%F"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// Parameters for the value axis
|
|
|
|
yaxis: {
|
|
|
|
autoscale: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Highlighter parameters
|
|
|
|
highlighter: {
|
|
|
|
show: true,
|
|
|
|
//yvalues: 4,
|
|
|
|
formatString: '<table class="jqplot-highlighter"><tr><td>date:</td><td>%s</td></tr><tr><td>sold:</td><td>%s</td></tr>'
|
|
|
|
},
|
|
|
|
|
|
|
|
// Series parameters
|
|
|
|
series: [{
|
|
|
|
// We use the OHLC (open, high, low, close) rendered.
|
|
|
|
//renderer:$.jqplot.OHLCRenderer,
|
|
|
|
color: "blue",
|
|
|
|
rendererOptions: {
|
|
|
|
smooth: true,
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
|
|
|
|
// To display horizontal (0) and vertical (today) lines
|
|
|
|
canvasOverlay: {
|
|
|
|
show: true,
|
|
|
|
objects: [
|
|
|
|
// Orange horizontal line for 0 limit
|
|
|
|
{dashedHorizontalLine: {
|
|
|
|
name: "zero",
|
|
|
|
y: 0,
|
|
|
|
lineWidth: 1,
|
|
|
|
color: "orange",
|
|
|
|
shadow: false
|
|
|
|
}},
|
|
|
|
// Red horizontal line for authorized overdraft limit
|
|
|
|
{dashedHorizontalLine: {
|
|
|
|
name: "overdraft",
|
|
|
|
y: data.account.authorized_overdraft,
|
|
|
|
lineWidth: 1,
|
|
|
|
color: "red",
|
|
|
|
shadow: false
|
|
|
|
}},
|
|
|
|
// Gray vertical line for today
|
|
|
|
{ dashedVerticalLine: {
|
|
|
|
name: "today",
|
|
|
|
x: today,
|
|
|
|
lineWidth: 1,
|
|
|
|
color: "gray",
|
|
|
|
shadow: false
|
|
|
|
}}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// Reset chart to null to avoid redraw of a non existing chart in resize callback.
|
|
|
|
window.chart = null;
|
2013-01-10 13:10:41 +01:00
|
|
|
}
|
2013-01-08 18:50:47 +01:00
|
|
|
};
|
2013-02-07 15:00:31 +01:00
|
|
|
|
|
|
|
// Function to draw the expense category pie chart.
|
|
|
|
$scope.drawPieChart = function(entries, elementId) {
|
|
|
|
// Clear previous chart
|
|
|
|
var element = angular.element(elementId);
|
|
|
|
element.html("");
|
|
|
|
element.css("height", "0px");
|
|
|
|
|
|
|
|
if(entries && entries.length > 1) {
|
|
|
|
// Plot chart, and store it in a window parameter for resize callback (need to be done better than it...)
|
|
|
|
window.pieChart = $.jqplot(element.attr("id"), [entries], {
|
|
|
|
// Title of the chart
|
|
|
|
title: "Dépenses",
|
|
|
|
|
|
|
|
// Series parameters.
|
|
|
|
seriesDefaults: {
|
|
|
|
// Pie chart renderer
|
|
|
|
renderer: $.jqplot.PieRenderer,
|
|
|
|
rendererOptions: {
|
|
|
|
showDataLabels: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Legend parameters.
|
|
|
|
legend: {
|
|
|
|
show: true,
|
|
|
|
location: 'e',
|
|
|
|
rendererOptions: {
|
|
|
|
numberRows: 9,
|
|
|
|
numberColumns: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Highlighter parameters;
|
|
|
|
highlighter: {
|
|
|
|
show: true,
|
|
|
|
formatString:'%s: %s',
|
|
|
|
tooltipLocation:'sw',
|
|
|
|
useAxesFormatters:false
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// Reset chart to null to avoid redraw of a non existing chart in resize callback.
|
|
|
|
window.pieChart = null;
|
2013-01-10 13:10:41 +01:00
|
|
|
}
|
2013-01-07 18:42:02 +01:00
|
|
|
};
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$rootScope.$on("monthsLoadedEvent", function(event, args){
|
|
|
|
$scope.loadEntries(args.account, args.month);
|
2013-01-12 22:11:48 +01:00
|
|
|
});
|
|
|
|
|
2013-02-07 15:00:31 +01:00
|
|
|
$scope.$on("entriesLoadedEvent", function(event, args) {
|
|
|
|
$scope.entriesLoaded(args.entries);
|
2013-01-12 22:11:48 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2013-01-13 13:47:27 +01:00
|
|
|
// Default AJAX error handler.
|
2013-02-07 15:00:31 +01:00
|
|
|
//$(document).ajaxError(function(event, xhr, settings) {
|
|
|
|
// message("error", xhr.statusText, xhr.responseText);
|
|
|
|
//});
|
2013-01-07 18:42:02 +01:00
|
|
|
|