All kinds of new stuff.

This commit is contained in:
James Cole 2015-02-06 19:33:31 +01:00
parent a92efbc55f
commit 1b54b14671
9 changed files with 188 additions and 96 deletions

View File

@ -1,5 +1,6 @@
<?php namespace FireflyIII\Http\Controllers;
class HomeController extends Controller
{
@ -22,6 +23,7 @@ class HomeController extends Controller
public function __construct()
{
$this->middleware('auth');
$this->middleware('range');
//$this->middleware('guest');
}
@ -33,12 +35,13 @@ class HomeController extends Controller
public function index()
{
// count is fake
$count = 0;
$count = \Auth::user()->accounts()->accountTypeIn(['Asset account', 'Default account'])->count();
$title = 'Firefly';
$subTitle = 'What\'s playing?';
$mainTitleIcon = 'fa-fire';
$transactions = [];
return view('index', compact('count', 'title', 'subTitle', 'mainTitleIcon'));
return view('index', compact('count', 'title', 'subTitle', 'mainTitleIcon','transactions'));
}
}

View File

@ -2,14 +2,16 @@
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
protected $middleware
= [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
@ -23,10 +25,12 @@ class Kernel extends HttpKernel {
*
* @var array
*/
protected $routeMiddleware = [
protected $routeMiddleware
= [
'auth' => 'FireflyIII\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'FireflyIII\Http\Middleware\RedirectIfAuthenticated',
'range' => 'FireflyIII\Http\Middleware\Range',
];
}

View File

@ -1,6 +1,12 @@
<?php
/*
* Home Controller
*/
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index']);
Route::get('/prev', ['uses' => 'HomeController@sessionPrev', 'as' => 'sessionPrev']);
Route::get('/next', ['uses' => 'HomeController@sessionNext', 'as' => 'sessionNext']);
Route::get('/jump/{range}', ['uses' => 'HomeController@rangeJump', 'as' => 'rangeJump']);
/*
* Account Controller

View File

@ -1,7 +1,7 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
/**
* Class Account
*
@ -25,5 +25,13 @@ class Account extends Model
return $this->belongsTo('FireflyIII\User');
}
public function scopeAccountTypeIn(EloquentBuilder $query, array $types)
{
if (is_null($this->joinedAccountTypes)) {
$query->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id');
$this->joinedAccountTypes = true;
}
$query->whereIn('account_types.type', $types);
}
}

View File

@ -1,9 +1,11 @@
<?php namespace FireflyIII\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Routing\Router;
class RouteServiceProvider extends ServiceProvider {
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
@ -18,27 +20,45 @@ class RouteServiceProvider extends ServiceProvider {
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function boot(Router $router)
{
parent::boot($router);
//
$router->before(
function (Request $request) {
// put IP in session if not already there.
$reminders = [];
if ($request->user()) {
//Filter::setSessionDateRange();
//Reminders::updateReminders();
//Steam::removeEmptyBudgetLimits();
//$reminders = Reminders::getReminders();
}
// View::share('reminders', $reminders);
}
);
}
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function($router)
{
$router->group(
['namespace' => $this->namespace], function ($router) {
require app_path('Http/routes.php');
});
}
);
}
}

View File

@ -146,6 +146,7 @@ return [
'FireflyIII\Providers\ConfigServiceProvider',
'FireflyIII\Providers\EventServiceProvider',
'FireflyIII\Providers\RouteServiceProvider',
'FireflyIII\Providers\FireflyServiceProvider',
],
@ -196,6 +197,7 @@ return [
'View' => 'Illuminate\Support\Facades\View',
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
'Preferences' => 'FireflyIII\Support\Facades\Preferences',
],

49
config/firefly.php Normal file
View File

@ -0,0 +1,49 @@
<?php
return [
'index_periods' => ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'],
'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
'piggy_bank_periods' => [
'week' => 'Week',
'month' => 'Month',
'quarter' => 'Quarter',
'year' => 'Year'
],
'periods_to_text' => [
'weekly' => 'A week',
'monthly' => 'A month',
'quarterly' => 'A quarter',
'half-year' => 'Six months',
'yearly' => 'A year',
],
'accountRoles' => [
'defaultExpense' => 'Default expense account',
'sharedExpense' => 'Shared expense account'
],
'range_to_text' => [
'1D' => 'day',
'1W' => 'week',
'1M' => 'month',
'3M' => 'three months',
'6M' => 'half year',
'custom' => '(custom)'
],
'range_to_name' => [
'1D' => 'one day',
'1W' => 'one week',
'1M' => 'one month',
'3M' => 'three months',
'6M' => 'six months',
'1Y' => 'one year',
],
'range_to_repeat_freq' => [
'1D' => 'weekly',
'1W' => 'weekly',
'1M' => 'monthly',
'3M' => 'quarterly',
'6M' => 'half-year',
'custom' => 'monthly'
],
];

View File

@ -10,7 +10,7 @@ body {
.google-chart-error {
height:30px;
background:url('../../images/error.png') no-repeat center center
background:url('../images/error.png') no-repeat center center
}
.google-visualization-table-tr-head td:first-child {width:100px;}

BIN
public/images/error.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B