mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 03:53:37 +00:00
Some improvements in tour
This commit is contained in:
@@ -6,12 +6,12 @@ use Config;
|
|||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use Input;
|
use Input;
|
||||||
|
use Log;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Route;
|
use Route;
|
||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
|
|
||||||
use Log;
|
|
||||||
/**
|
/**
|
||||||
* Class HomeController
|
* Class HomeController
|
||||||
*
|
*
|
||||||
@@ -84,6 +84,7 @@ class HomeController extends Controller
|
|||||||
$frontPage = Preferences::get('frontPageAccounts', []);
|
$frontPage = Preferences::get('frontPageAccounts', []);
|
||||||
$start = Session::get('start', Carbon::now()->startOfMonth());
|
$start = Session::get('start', Carbon::now()->startOfMonth());
|
||||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||||
|
$showTour = Preferences::get('tour', true)->data;
|
||||||
|
|
||||||
$accounts = $repository->getFrontpageAccounts($frontPage);
|
$accounts = $repository->getFrontpageAccounts($frontPage);
|
||||||
$savings = $repository->getSavingsAccounts();
|
$savings = $repository->getSavingsAccounts();
|
||||||
@@ -114,7 +115,9 @@ class HomeController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
|
return view(
|
||||||
|
'index', compact('count', 'showTour', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -12,6 +12,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Preferences;
|
||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
use Steam;
|
use Steam;
|
||||||
@@ -24,21 +25,23 @@ use Steam;
|
|||||||
class JsonController extends Controller
|
class JsonController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function endTour()
|
||||||
|
{
|
||||||
|
Preferences::set('tour', false);
|
||||||
|
|
||||||
|
return Response::json(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function tour()
|
public function tour()
|
||||||
{
|
{
|
||||||
$headers = [
|
$pref = Preferences::get('tour', true);
|
||||||
'main-content',
|
if (!$pref) {
|
||||||
'sidebar-toggle',
|
abort(404);
|
||||||
'account-menu',
|
}
|
||||||
'budget-menu',
|
$headers = ['main-content', 'sidebar-toggle', 'account-menu', 'budget-menu', 'report-menu', 'transaction-menu', 'option-menu', 'main-content-end'];
|
||||||
'report-menu',
|
|
||||||
'transaction-menu',
|
|
||||||
'option-menu',
|
|
||||||
'main-content-end'
|
|
||||||
];
|
|
||||||
$steps = [];
|
$steps = [];
|
||||||
foreach ($headers as $header) {
|
foreach ($headers as $header) {
|
||||||
$steps[] = [
|
$steps[] = [
|
||||||
@@ -59,20 +62,21 @@ class JsonController extends Controller
|
|||||||
$steps[7]['orphan'] = true;
|
$steps[7]['orphan'] = true;
|
||||||
$steps[7]['backdrop'] = true;
|
$steps[7]['backdrop'] = true;
|
||||||
|
|
||||||
$template ='<div class="popover" role="tooltip">
|
$template
|
||||||
|
= '<div class="popover" role="tooltip">
|
||||||
<div class="arrow"></div>
|
<div class="arrow"></div>
|
||||||
<h3 class="popover-title"></h3>
|
<h3 class="popover-title"></h3>
|
||||||
<div class="popover-content"></div>
|
<div class="popover-content"></div>
|
||||||
<div class="popover-navigation">
|
<div class="popover-navigation">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-sm btn-default" data-role="prev">« '.trans('firefly.prev').'</button>
|
<button class="btn btn-sm btn-default" data-role="prev">« ' . trans('firefly.prev') . '</button>
|
||||||
<button class="btn btn-sm btn-default" data-role="next">'.trans('firefly.next').' »</button>
|
<button class="btn btn-sm btn-default" data-role="next">' . trans('firefly.next') . ' »</button>
|
||||||
<button class="btn btn-sm btn-default"
|
<button class="btn btn-sm btn-default"
|
||||||
data-role="pause-resume"
|
data-role="pause-resume"
|
||||||
data-pause-text="Pause"
|
data-pause-text="Pause"
|
||||||
data-resume-text="Resume">'.trans('firefly.pause').'</button>
|
data-resume-text="Resume">' . trans('firefly.pause') . '</button>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-sm btn-default" data-role="end">'.trans('firefly.end-tour').'</button>
|
<button class="btn btn-sm btn-default" data-role="end">' . trans('firefly.end-tour') . '</button>
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
|
@@ -297,6 +297,8 @@ Route::group(
|
|||||||
Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']);
|
Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']);
|
||||||
Route::get('/json/tags', ['uses' => 'JsonController@tags', 'as' => 'json.tags']);
|
Route::get('/json/tags', ['uses' => 'JsonController@tags', 'as' => 'json.tags']);
|
||||||
Route::get('/json/tour', ['uses' => 'JsonController@tour', 'as' => 'json.tour']);
|
Route::get('/json/tour', ['uses' => 'JsonController@tour', 'as' => 'json.tour']);
|
||||||
|
Route::post('/json/end-tour', ['uses' => 'JsonController@endTour']);
|
||||||
|
|
||||||
Route::get('/json/box/in', ['uses' => 'JsonController@boxIn', 'as' => 'json.box.in']);
|
Route::get('/json/box/in', ['uses' => 'JsonController@boxIn', 'as' => 'json.box.in']);
|
||||||
Route::get('/json/box/out', ['uses' => 'JsonController@boxOut', 'as' => 'json.box.out']);
|
Route::get('/json/box/out', ['uses' => 'JsonController@boxOut', 'as' => 'json.box.out']);
|
||||||
Route::get('/json/box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'json.box.paid']);
|
Route::get('/json/box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'json.box.paid']);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* globals $, columnChart, google, lineChart, pieChart, stackedColumnChart, areaChart */
|
/* globals $, columnChart,showTour, Tour, google, lineChart, pieChart, stackedColumnChart, areaChart */
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -9,18 +9,32 @@ $(function () {
|
|||||||
// do chart JS stuff.
|
// do chart JS stuff.
|
||||||
drawChart();
|
drawChart();
|
||||||
}
|
}
|
||||||
|
if (showTour) {
|
||||||
$.getJSON('json/tour').success(function (data) {
|
$.getJSON('json/tour').success(function (data) {
|
||||||
var tour = new Tour({steps: data.steps, template: data.template});
|
var tour = new Tour(
|
||||||
|
{
|
||||||
|
steps: data.steps,
|
||||||
|
template: data.template,
|
||||||
|
onEnd: endTheTour
|
||||||
|
});
|
||||||
// Initialize the tour
|
// Initialize the tour
|
||||||
tour.init();
|
tour.init();
|
||||||
// Start the tour
|
// Start the tour
|
||||||
tour.start();
|
tour.start();
|
||||||
|
}).fail(function () {
|
||||||
|
console.log('Already had tour.');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function endTheTour() {
|
||||||
|
"use strict";
|
||||||
|
$.post('json/end-tour', {_token: token});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function drawChart() {
|
function drawChart() {
|
||||||
"use strict";
|
"use strict";
|
||||||
areaChart('chart/account/frontpage', 'accounts-chart');
|
areaChart('chart/account/frontpage', 'accounts-chart');
|
||||||
|
@@ -241,6 +241,16 @@
|
|||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
<!-- show tour? -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
{% if showTour %}
|
||||||
|
var showTour = true;
|
||||||
|
{% else %}
|
||||||
|
var showTour = false;
|
||||||
|
{% endif %}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!-- load the libraries and scripts necessary for Google Charts: -->
|
<!-- load the libraries and scripts necessary for Google Charts: -->
|
||||||
{% if Config.get('firefly.chart') == 'google' %}
|
{% if Config.get('firefly.chart') == 'google' %}
|
||||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||||
|
Reference in New Issue
Block a user