2016-12-23 07:02:45 +01:00
|
|
|
/*
|
|
|
|
* help.js
|
2017-10-21 08:40:00 +02:00
|
|
|
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
2016-12-23 07:02:45 +01:00
|
|
|
*
|
2017-10-21 08:40:00 +02:00
|
|
|
* This file is part of Firefly III.
|
2016-12-23 07:02:45 +01:00
|
|
|
*
|
2017-10-21 08:40:00 +02:00
|
|
|
* Firefly III is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Firefly III 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2017-12-17 14:43:13 +01:00
|
|
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
2016-12-23 07:02:45 +01:00
|
|
|
*/
|
|
|
|
|
2015-02-06 07:23:26 +01:00
|
|
|
$(function () {
|
2015-05-24 18:22:41 +02:00
|
|
|
"use strict";
|
2015-02-06 07:23:26 +01:00
|
|
|
$('#help').click(showHelp);
|
2015-05-24 18:22:41 +02:00
|
|
|
|
2015-02-06 07:23:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
function showHelp(e) {
|
2015-05-24 18:22:41 +02:00
|
|
|
"use strict";
|
|
|
|
var target = $(e.target);
|
|
|
|
var route = target.data('route');
|
2017-07-23 07:30:05 +02:00
|
|
|
var specialPage = target.data('extra');
|
|
|
|
|
|
|
|
if (typeof specialPage === 'undefined') {
|
|
|
|
specialPage = '';
|
|
|
|
}
|
2015-02-06 07:23:26 +01:00
|
|
|
$('#helpBody').html('<i class="fa fa-refresh fa-spin"></i>');
|
|
|
|
$('#helpModal').modal('show');
|
2016-10-23 17:33:53 +02:00
|
|
|
$('#helpTitle').html('Help for this page');
|
2016-02-04 07:30:12 +01:00
|
|
|
$.getJSON('help/' + encodeURI(route)).done(function (data) {
|
2017-07-23 07:30:05 +02:00
|
|
|
$('#helpBody').html(data.html);
|
2015-02-06 07:23:26 +01:00
|
|
|
}).fail(function () {
|
|
|
|
$('#helpBody').html('<p class="text-danger">No help text could be found.</p>');
|
2016-10-23 17:33:53 +02:00
|
|
|
$('#helpTitle').html('Apologies');
|
2015-02-06 07:23:26 +01:00
|
|
|
});
|
2017-07-23 07:30:05 +02:00
|
|
|
$('#reenableGuidance').unbind('click').click(function () {
|
|
|
|
enableGuidance(route, specialPage);
|
2017-07-23 07:32:06 +02:00
|
|
|
return false;
|
2017-07-23 07:30:05 +02:00
|
|
|
});
|
2015-02-06 07:23:26 +01:00
|
|
|
return false;
|
|
|
|
}
|
2017-07-23 07:30:05 +02:00
|
|
|
|
|
|
|
function enableGuidance(route, specialPage) {
|
2017-12-20 20:07:57 +01:00
|
|
|
$.post('json/intro/enable/' + route + '/' + specialPage, {_token: token}).done(function (data) {
|
2017-07-23 07:30:05 +02:00
|
|
|
alert(data.message);
|
|
|
|
}).fail(function () {
|
|
|
|
alert('Could not re-enable introduction.');
|
2017-07-23 07:32:06 +02:00
|
|
|
});
|
2017-07-23 07:30:05 +02:00
|
|
|
}
|
|
|
|
|