diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 8c89dda1f8..3d442b503d 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -229,13 +229,16 @@ class AccountController extends BaseController case 'Asset account': case 'Default account': $subTitleIcon = 'fa-money'; + $what = 'asset'; break; case 'Expense account': case 'Beneficiary account': $subTitleIcon = 'fa-shopping-cart'; + $what = 'expense'; break; case 'Revenue account': $subTitleIcon = 'fa-download'; + $what = 'revenue'; break; } @@ -254,7 +257,7 @@ class AccountController extends BaseController } - return View::make('accounts.show', compact('account', 'view', 'subTitleIcon', 'journals'))->with('account', $account)->with( + return View::make('accounts.show', compact('account', 'what', 'view', 'subTitleIcon', 'journals'))->with('account', $account)->with( 'subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"' ); } diff --git a/app/controllers/HelpController.php b/app/controllers/HelpController.php new file mode 100644 index 0000000000..4fee5b9c3a --- /dev/null +++ b/app/controllers/HelpController.php @@ -0,0 +1,46 @@ +There is no help for this route!
'; + $helpTitle = 'Help'; + + return Response::json(['title' => $helpTitle, 'text' => $helpText]); + } + + // content in cache + if (Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text')) { + $helpText = Cache::get('help.' . $route . '.text'); + $helpTitle = Cache::get('help.' . $route . '.title'); + + return Response::json(['title' => $helpTitle, 'text' => $helpText]); + } + + // get the help-content from Github: + $URL = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/' . e($route) . '.md'; + try { + $content = file_get_contents($URL); + } catch (ErrorException $e) { + $content = 'There is no help for this route.
'; + } + if (strlen($content) > 0) { + $helpText = \Michelf\Markdown::defaultTransform($content); + $helpTitle = $route; + + Cache::put('help.' . $route . '.text', $helpText, 10080); // a week. + Cache::put('help.' . $route . '.title', $helpTitle, 10080); + + return Response::json(['title' => $helpTitle, 'text' => $helpText]); + } + + $helpText = 'There is no help for this route!
'; + $helpTitle = 'Help'; + + return Response::json(['title' => $helpTitle, 'text' => $helpText]); + + } +} \ No newline at end of file diff --git a/app/routes.php b/app/routes.php index 3c10a8f1a5..52899b07cc 100644 --- a/app/routes.php +++ b/app/routes.php @@ -23,6 +23,7 @@ Route::bind( 'user_id', Auth::user()->id )->first(); } + return null; } ); @@ -34,6 +35,7 @@ Route::bind( return RecurringTransaction:: where('id', $value)->where('user_id', Auth::user()->id)->first(); } + return null; } ); @@ -43,6 +45,7 @@ Route::bind( return Budget:: where('id', $value)->where('user_id', Auth::user()->id)->first(); } + return null; } ); @@ -53,6 +56,7 @@ Route::bind( return Component:: where('id', $value)->where('user_id', Auth::user()->id)->first(); } + return null; } ); @@ -63,6 +67,7 @@ Route::bind( return Reminder:: where('id', $value)->where('user_id', Auth::user()->id)->first(); } + return null; } ); @@ -73,6 +78,7 @@ Route::bind( return Category:: where('id', $value)->where('user_id', Auth::user()->id)->first(); } + return null; } ); @@ -83,6 +89,7 @@ Route::bind( return TransactionJournal:: where('id', $value)->where('user_id', Auth::user()->id)->first(); } + return null; } ); @@ -95,6 +102,7 @@ Route::bind( 'components', 'components.id', '=', 'limits.component_id' )->where('components.class', 'Budget')->where('components.user_id', Auth::user()->id)->first(['limit_repetitions.*']); } + return null; } ); @@ -104,10 +112,11 @@ Route::bind( if (Auth::check()) { return Piggybank:: where('piggybanks.id', $value) - ->leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id') - ->where('accounts.user_id', Auth::user()->id) - ->where('repeats',0)->first(['piggybanks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id') + ->where('accounts.user_id', Auth::user()->id) + ->where('repeats', 0)->first(['piggybanks.*']); } + return null; } ); @@ -119,8 +128,9 @@ Route::bind( where('piggybanks.id', $value) ->leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id') ->where('accounts.user_id', Auth::user()->id) - ->where('repeats',1)->first(['piggybanks.*']); + ->where('repeats', 1)->first(['piggybanks.*']); } + return null; } ); @@ -172,11 +182,14 @@ Route::group( Route::get('/chart/recurring/{recurring}', ['uses' => 'GoogleChartController@recurringOverview']); Route::get('/chart/reports/budgets/{year}', ['uses' => 'GoogleChartController@budgetsReportChart']); Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'GoogleChartController@budgetLimitSpending']); - Route::get('/chart/piggyhistory/{piggybank}',['uses' => 'GoogleChartController@piggyBankHistory']); + Route::get('/chart/piggyhistory/{piggybank}', ['uses' => 'GoogleChartController@piggyBankHistory']); // google chart for components (categories + budgets combined) Route::get('/chart/component/{component}/spending/{year}', ['uses' => 'GoogleChartController@componentsAndSpending']); + // help controller + Route::get('/help/{route}', ['uses' => 'HelpController@show', 'as' => 'help.show']); + // home controller Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']); Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']); # even though nothing is cached. @@ -224,10 +237,10 @@ Route::group( Route::get('/reports/unbalanced/{year}/{month}', ['uses' => 'ReportController@unbalanced', 'as' => 'reports.unbalanced']); // reminder controller - Route::get('/reminders/{reminder}',['uses' => 'ReminderController@show','as' => 'reminders.show']); - Route::get('/reminders/{reminder}/dismiss',['uses' => 'ReminderController@dismiss','as' => 'reminders.dismiss']); - Route::get('/reminders/{reminder}/notnow',['uses' => 'ReminderController@notnow','as' => 'reminders.notnow']); - Route::get('/reminders/{reminder}/act',['uses' => 'ReminderController@act','as' => 'reminders.act']); + Route::get('/reminders/{reminder}', ['uses' => 'ReminderController@show', 'as' => 'reminders.show']); + Route::get('/reminders/{reminder}/dismiss', ['uses' => 'ReminderController@dismiss', 'as' => 'reminders.dismiss']); + Route::get('/reminders/{reminder}/notnow', ['uses' => 'ReminderController@notnow', 'as' => 'reminders.notnow']); + Route::get('/reminders/{reminder}/act', ['uses' => 'ReminderController@act', 'as' => 'reminders.act']); // search controller: Route::get('/search', ['uses' => 'SearchController@index', 'as' => 'search']); diff --git a/app/views/accounts/index.blade.php b/app/views/accounts/index.blade.php index 54a5734050..c98c6e38b1 100644 --- a/app/views/accounts/index.blade.php +++ b/app/views/accounts/index.blade.php @@ -1,5 +1,6 @@ @extends('layouts.default') @section('content') +{{ Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) }}- @if($view == 'all') Stick to date-range @else diff --git a/app/views/budgets/index.blade.php b/app/views/budgets/index.blade.php index b8e580300e..214adc82ec 100644 --- a/app/views/budgets/index.blade.php +++ b/app/views/budgets/index.blade.php @@ -130,55 +130,6 @@