46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) 2013, Bernhard Posselt <dev@bernhard-posselt.com>
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
* later.
|
|
* See the COPYING file.
|
|
*/
|
|
|
|
app.controller('AppController', function ($scope, $location, is) {
|
|
'use strict';
|
|
|
|
$scope.is = is;
|
|
|
|
$scope.init = function (lastViewedNote, errorMessage) {
|
|
$scope.defaultTitle = document.title;
|
|
|
|
if(lastViewedNote !== 0 && $location.path()==='') {
|
|
$location.path('/notes/' + lastViewedNote);
|
|
}
|
|
if(errorMessage) {
|
|
OC.Notification.showTemporary(errorMessage);
|
|
}
|
|
$scope.initSearch();
|
|
};
|
|
|
|
$scope.search = '';
|
|
$scope.defaultTitle = null;
|
|
|
|
$scope.initSearch = function() {
|
|
new OCA.Search(
|
|
function (query) {
|
|
$scope.search = query;
|
|
$scope.$apply();
|
|
if($('#app-navigation-toggle').css('display')!=='none' &&
|
|
!$('body').hasClass('snapjs-left')) {
|
|
$('#app-navigation-toggle').click();
|
|
}
|
|
},
|
|
function () {
|
|
$scope.search = '';
|
|
$scope.$apply();
|
|
}
|
|
);
|
|
};
|
|
|
|
});
|