/*
This file is part of rhizi, a collaborative knowledge graph editor.
Copyright (C) 2014-2015 Rhizi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
"use strict"
define(['jquery', 'rz_core', 'rz_api_backend', 'view/selection', 'view/cmd_bar'],
function ($, rz_core, rz_api_backend, selection, view__cmd_bar) {
$('.tutorial').click(function(){});
var key="#47989379";
var logout_button = $('#top-bar__logout-btn');
logout_button.click(function() {
$.ajax({
type: "POST",
url: '/logout',
success: function () {
document.location = "/login";
},
error: function () {
console.log("failed to logout");
document.location = "/login";
},
}); // server should redirect back to /login
});
$('a.save-history').click(function () {
if (rz_core.main_graph.history === undefined) {
throw "History is undefined";
}
rz_core.main_graph.history.save_to_file();
});
$('#menu-bar__rzdoc-open').click(function() {
var cmd_bar;
cmd_bar = $('#cmd-bar__rzdoc-search');
if (cmd_bar.length > 0) { // cmd bar present
cmd_bar.remove();
return;
}
rz_core.rzdoc__search(''); // this should match all existing documents
});
$('#menu-bar__rzdoc-new').click(function() {
var cmd_bar,
cmd_bar_body,
e_input,
submit_btn;
cmd_bar = $('#cmd-bar__rzdoc-new');
if (cmd_bar.length > 0) { // cmd bar present
cmd_bar.remove();
return;
}
cmd_bar = view__cmd_bar.new_cmdbar("rzdoc-new");
cmd_bar_body = $('