mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Reinstated the help button.
This commit is contained in:
parent
847e05e9a7
commit
428e331b3e
@ -37,10 +37,12 @@ class Help implements HelpInterface
|
||||
*/
|
||||
public function getFromGithub($route)
|
||||
{
|
||||
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/en/' . e($route) . '.md';
|
||||
$content = [
|
||||
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/en/' . e($route) . '.md';
|
||||
$routeIndex = str_replace('.', '-', $route);
|
||||
$title = trans('help.' . $routeIndex);
|
||||
$content = [
|
||||
'text' => '<p>There is no help for this route!</p>',
|
||||
'title' => $route,
|
||||
'title' => $title,
|
||||
];
|
||||
try {
|
||||
$content['text'] = file_get_contents($uri);
|
||||
@ -69,6 +71,18 @@ class Help implements HelpInterface
|
||||
return Route::has($route);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param $route
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function inCache($route)
|
||||
{
|
||||
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
@ -82,16 +96,4 @@ class Help implements HelpInterface
|
||||
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
|
||||
Cache::put('help.' . $route . '.title', $content['title'], 10080);
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param $route
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function inCache($route)
|
||||
{
|
||||
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use FireflyIII\Models\Tag;
|
||||
@ -7,6 +8,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Input;
|
||||
use Preferences;
|
||||
use Redirect;
|
||||
use Route;
|
||||
use Session;
|
||||
use Steam;
|
||||
|
||||
@ -111,4 +113,33 @@ class HomeController extends Controller
|
||||
|
||||
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return \Illuminate\Http\RedirectResponse|string
|
||||
*/
|
||||
public function routes()
|
||||
{
|
||||
if (!Auth::user()->hasRole('owner')) {
|
||||
Session::flash('warning', 'This page is broken.');
|
||||
|
||||
return Redirect::route('index');
|
||||
}
|
||||
|
||||
// get all routes:
|
||||
$routeCollection = Route::getRoutes();
|
||||
/** @var \Illuminate\Routing\Route $value */
|
||||
foreach ($routeCollection as $value) {
|
||||
$name = $value->getName();
|
||||
$methods = $value->getMethods();
|
||||
$isPost = in_array('POST', $methods);
|
||||
$index = str_replace('.', '-', $name);
|
||||
|
||||
if (strlen($name) > 0 && !$isPost) {
|
||||
echo "'" . $index . "' => '" . $name . "',<br />";
|
||||
}
|
||||
}
|
||||
|
||||
return ' ';
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +163,7 @@ Route::group(
|
||||
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
||||
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
||||
Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']);
|
||||
Route::get('/routes', ['uses' => 'HomeController@routes']);
|
||||
/**
|
||||
* Account Controller
|
||||
*/
|
||||
|
@ -37,6 +37,36 @@ class Budget extends Model
|
||||
protected $fillable = ['user_id', 'name', 'active'];
|
||||
protected $hidden = ['encrypted'];
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
public static function firstOrCreateEncrypted(array $fields)
|
||||
{
|
||||
// everything but the name:
|
||||
$query = Budget::orderBy('id');
|
||||
foreach ($fields as $name => $value) {
|
||||
if ($name != 'name') {
|
||||
$query->where($name, $value);
|
||||
}
|
||||
}
|
||||
$set = $query->get(['budgets.*']);
|
||||
/** @var Budget $budget */
|
||||
foreach ($set as $budget) {
|
||||
if ($budget->name == $fields['name']) {
|
||||
return $budget;
|
||||
}
|
||||
}
|
||||
// create it!
|
||||
$budget = Budget::create($fields);
|
||||
|
||||
return $budget;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ class TransactionCurrencySeeder extends Seeder
|
||||
{
|
||||
DB::table('transaction_currencies')->delete();
|
||||
|
||||
TransactionCurrency::create(['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€']);
|
||||
TransactionCurrency::create(['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€']);
|
||||
TransactionCurrency::create(['code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$']);
|
||||
TransactionCurrency::create(['code' => 'HUF', 'name' => 'Hungarian forint', 'symbol' => 'Ft']);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ $(function () {
|
||||
$('#help').click(showHelp);
|
||||
$(function () {
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
//$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
});
|
||||
|
||||
|
72
resources/lang/en/help.php
Normal file
72
resources/lang/en/help.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
return [
|
||||
'register' => 'register',
|
||||
'index' => 'The main index',
|
||||
'home' => 'home',
|
||||
'flush' => 'flush',
|
||||
'accounts-index' => 'accounts.index',
|
||||
'accounts-create' => 'accounts.create',
|
||||
'accounts-edit' => 'accounts.edit',
|
||||
'accounts-delete' => 'accounts.delete',
|
||||
'accounts-show' => 'accounts.show',
|
||||
'bills-index' => 'bills.index',
|
||||
'bills-rescan' => 'bills.rescan',
|
||||
'bills-create' => 'bills.create',
|
||||
'bills-edit' => 'bills.edit',
|
||||
'bills-delete' => 'bills.delete',
|
||||
'bills-show' => 'bills.show',
|
||||
'budgets-index' => 'budgets.index',
|
||||
'budgets-income' => 'budgets.income',
|
||||
'budgets-create' => 'budgets.create',
|
||||
'budgets-edit' => 'budgets.edit',
|
||||
'budgets-delete' => 'budgets.delete',
|
||||
'budgets-show' => 'budgets.show',
|
||||
'budgets-noBudget' => 'budgets.noBudget',
|
||||
'categories-index' => 'categories.index',
|
||||
'categories-create' => 'categories.create',
|
||||
'categories-edit' => 'categories.edit',
|
||||
'categories-delete' => 'categories.delete',
|
||||
'categories-show' => 'categories.show',
|
||||
'categories-noCategory' => 'categories.noCategory',
|
||||
'currency-index' => 'currency.index',
|
||||
'currency-create' => 'currency.create',
|
||||
'currency-edit' => 'currency.edit',
|
||||
'currency-delete' => 'currency.delete',
|
||||
'currency-default' => 'currency.default',
|
||||
'help-show' => 'help.show',
|
||||
'json-expense-accounts' => 'json.expense-accounts',
|
||||
'json-revenue-accounts' => 'json.revenue-accounts',
|
||||
'json-categories' => 'json.categories',
|
||||
'json-tags' => 'json.tags',
|
||||
'json-box-in' => 'json.box.in',
|
||||
'json-box-out' => 'json.box.out',
|
||||
'json-box-paid' => 'json.box.paid',
|
||||
'json-box-unpaid' => 'json.box.unpaid',
|
||||
'new-user-index' => 'new-user.index',
|
||||
'piggy-banks-index' => 'piggy-banks.index',
|
||||
'piggy-banks-addMoney' => 'piggy-banks.addMoney',
|
||||
'piggy-banks-removeMoney' => 'piggy-banks.removeMoney',
|
||||
'piggy-banks-create' => 'piggy-banks.create',
|
||||
'piggy-banks-edit' => 'piggy-banks.edit',
|
||||
'piggy-banks-delete' => 'piggy-banks.delete',
|
||||
'piggy-banks-show' => 'piggy-banks.show',
|
||||
'preferences' => 'preferences',
|
||||
'profile' => 'profile',
|
||||
'profile-change-password' => 'profile.change-password',
|
||||
'profile-delete-account' => 'profile.delete-account',
|
||||
'reports-index' => 'reports.index',
|
||||
'reports-year' => 'reports.year',
|
||||
'reports-month' => 'reports.month',
|
||||
'search' => 'search',
|
||||
'tags-index' => 'tags.index',
|
||||
'tags-create' => 'tags.create',
|
||||
'tags-show' => 'tags.show',
|
||||
'tags-edit' => 'tags.edit',
|
||||
'tags-delete' => 'tags.delete',
|
||||
'transactions-index' => 'transactions.index',
|
||||
'transactions-create' => 'transactions.create',
|
||||
'transactions-edit' => 'transactions.edit',
|
||||
'transactions-delete' => 'transactions.delete',
|
||||
'transactions-show' => 'transactions.show',
|
||||
'logout' => 'logout',
|
||||
];
|
72
resources/lang/nl/help.php
Normal file
72
resources/lang/nl/help.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
return [
|
||||
'register' => 'register',
|
||||
'index' => 'index',
|
||||
'home' => 'home',
|
||||
'flush' => 'flush',
|
||||
'accounts-index' => 'accounts.index',
|
||||
'accounts-create' => 'accounts.create',
|
||||
'accounts-edit' => 'accounts.edit',
|
||||
'accounts-delete' => 'accounts.delete',
|
||||
'accounts-show' => 'accounts.show',
|
||||
'bills-index' => 'bills.index',
|
||||
'bills-rescan' => 'bills.rescan',
|
||||
'bills-create' => 'bills.create',
|
||||
'bills-edit' => 'bills.edit',
|
||||
'bills-delete' => 'bills.delete',
|
||||
'bills-show' => 'bills.show',
|
||||
'budgets-index' => 'budgets.index',
|
||||
'budgets-income' => 'budgets.income',
|
||||
'budgets-create' => 'budgets.create',
|
||||
'budgets-edit' => 'budgets.edit',
|
||||
'budgets-delete' => 'budgets.delete',
|
||||
'budgets-show' => 'budgets.show',
|
||||
'budgets-noBudget' => 'budgets.noBudget',
|
||||
'categories-index' => 'categories.index',
|
||||
'categories-create' => 'categories.create',
|
||||
'categories-edit' => 'categories.edit',
|
||||
'categories-delete' => 'categories.delete',
|
||||
'categories-show' => 'categories.show',
|
||||
'categories-noCategory' => 'categories.noCategory',
|
||||
'currency-index' => 'currency.index',
|
||||
'currency-create' => 'currency.create',
|
||||
'currency-edit' => 'currency.edit',
|
||||
'currency-delete' => 'currency.delete',
|
||||
'currency-default' => 'currency.default',
|
||||
'help-show' => 'help.show',
|
||||
'json-expense-accounts' => 'json.expense-accounts',
|
||||
'json-revenue-accounts' => 'json.revenue-accounts',
|
||||
'json-categories' => 'json.categories',
|
||||
'json-tags' => 'json.tags',
|
||||
'json-box-in' => 'json.box.in',
|
||||
'json-box-out' => 'json.box.out',
|
||||
'json-box-paid' => 'json.box.paid',
|
||||
'json-box-unpaid' => 'json.box.unpaid',
|
||||
'new-user-index' => 'new-user.index',
|
||||
'piggy-banks-index' => 'piggy-banks.index',
|
||||
'piggy-banks-addMoney' => 'piggy-banks.addMoney',
|
||||
'piggy-banks-removeMoney' => 'piggy-banks.removeMoney',
|
||||
'piggy-banks-create' => 'piggy-banks.create',
|
||||
'piggy-banks-edit' => 'piggy-banks.edit',
|
||||
'piggy-banks-delete' => 'piggy-banks.delete',
|
||||
'piggy-banks-show' => 'piggy-banks.show',
|
||||
'preferences' => 'preferences',
|
||||
'profile' => 'profile',
|
||||
'profile-change-password' => 'profile.change-password',
|
||||
'profile-delete-account' => 'profile.delete-account',
|
||||
'reports-index' => 'reports.index',
|
||||
'reports-year' => 'reports.year',
|
||||
'reports-month' => 'reports.month',
|
||||
'search' => 'search',
|
||||
'tags-index' => 'tags.index',
|
||||
'tags-create' => 'tags.create',
|
||||
'tags-show' => 'tags.show',
|
||||
'tags-edit' => 'tags.edit',
|
||||
'tags-delete' => 'tags.delete',
|
||||
'transactions-index' => 'transactions.index',
|
||||
'transactions-create' => 'transactions.create',
|
||||
'transactions-edit' => 'transactions.edit',
|
||||
'transactions-delete' => 'transactions.delete',
|
||||
'transactions-show' => 'transactions.show',
|
||||
'logout' => 'logout',
|
||||
];
|
@ -48,6 +48,13 @@
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<li>
|
||||
<a href="#" id="help" data-route="{{ Route.getCurrentRoute.getName }}">
|
||||
<i class="fa fa-question-circle"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Messages: style can be found in dropdown.less-->
|
||||
<li>
|
||||
<a href="#">
|
||||
@ -127,6 +134,20 @@
|
||||
<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog">
|
||||
</div>
|
||||
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="helpModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="helpTitle"> </h4>
|
||||
</div>
|
||||
<div class="modal-body" id="helpBody"> </div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="js/jquery-2.1.3.min.js" type="text/javascript"></script>
|
||||
<script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
@ -135,6 +156,7 @@
|
||||
<script src="dist/js/app.min.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var start = "{{Session.get('start').format('d-m-Y')}}";
|
||||
var end = "{{Session.get('end').format('d-m-Y')}}";
|
||||
@ -161,6 +183,7 @@
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="js/firefly.js"></script>
|
||||
<script type="text/javascript" src="js/help.js"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
|
||||
<script>
|
||||
|
Loading…
Reference in New Issue
Block a user