Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
First attempt at implementing Twig.
James Colea0e501f9fdf1
diff --git a/.env.backup b/.env.backupnew file mode 100755index 0000000000..6e6fd0fa1a--- /dev/null+++ b/.env.backup@@ -0,0 +1,18 @@+APP_ENV=local+APP_DEBUG=true+APP_KEY=SomeRandomString++DB_CONNECTION=mysql+DB_HOST=localhost+DB_DATABASE=homestead+DB_USERNAME=homestead+DB_PASSWORD=secret++CACHE_DRIVER=file+SESSION_DRIVER=file++EMAIL_SMTP=+EMAIL_DRIVER=smtp+EMAIL_USERNAME=+EMAIL_PASSWORD=+ANALYTICS_ID=\ No newline at end of filediff --git a/.env.local b/.env.localnew file mode 100755index 0000000000..6e6fd0fa1a--- /dev/null+++ b/.env.local@@ -0,0 +1,18 @@+APP_ENV=local+APP_DEBUG=true+APP_KEY=SomeRandomString++DB_CONNECTION=mysql+DB_HOST=localhost+DB_DATABASE=homestead+DB_USERNAME=homestead+DB_PASSWORD=secret++CACHE_DRIVER=file+SESSION_DRIVER=file++EMAIL_SMTP=+EMAIL_DRIVER=smtp+EMAIL_USERNAME=+EMAIL_PASSWORD=+ANALYTICS_ID=\ No newline at end of filediff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.phpindex 97bb5bc4b1..079ec4dcf3 100644--- a/app/Http/Controllers/Auth/AuthController.php+++ b/app/Http/Controllers/Auth/AuthController.php@@ -8,6 +8,7 @@ use Illuminate\Http\Request;use Illuminate\Mail\Message;use Mail;use Session;+use Twig;/*** Class AuthController@@ -47,6 +48,16 @@ class AuthController extends Controller$this->middleware('guest', ['except' => 'getLogout']);}+ /**+ * Show the application login form.+ *+ * @return \Illuminate\Http\Response+ */+ public function getLogin()+ {+ return Twig::render('auth.login');+ }+/*** Handle a registration request for the application.*diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.phpindex 542475d282..1b57c3508e 100644--- a/app/Providers/FireflyServiceProvider.php+++ b/app/Providers/FireflyServiceProvider.php@@ -2,6 +2,7 @@namespace FireflyIII\Providers;+use App;use FireflyIII\Support\Amount;use FireflyIII\Support\ExpandedForm;use FireflyIII\Support\Navigation;@@ -9,6 +10,8 @@ use FireflyIII\Support\Preferences;use FireflyIII\Support\Steam;use FireflyIII\Validation\FireflyValidator;use Illuminate\Support\ServiceProvider;+use Twig;+use TwigBridge\Extension\Loader\Functions;use Validator;/**@@ -25,10 +28,15 @@ class FireflyServiceProvider extends ServiceProviderreturn new FireflyValidator($translator, $data, $rules, $messages);});+}public function register(){++ $config = App::make('config');+ Twig::addExtension(new Functions($config));+$this->app->bind('preferences', function () {return new Preferences;@@ -72,6 +80,7 @@ class FireflyServiceProvider extends ServiceProvider$this->app->bind('FireflyIII\Helpers\Report\ReportHelperInterface', 'FireflyIII\Helpers\Report\ReportHelper');$this->app->bind('FireflyIII\Helpers\Report\ReportQueryInterface', 'FireflyIII\Helpers\Report\ReportQuery');+}}diff --git a/bootstrap/app.php b/bootstrap/app.phpindex e3ec5b5519..5b299a9c83 100644--- a/bootstrap/app.php+++ b/bootstrap/app.php@@ -11,6 +11,7 @@|*/+$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));@@ -26,6 +27,8 @@ $app = new Illuminate\Foundation\Application(|*/++$app->singleton('Illuminate\Contracts\Http\Kernel','FireflyIII\Http\Kernel'@@ -41,6 +44,9 @@ $app->singleton('FireflyIII\Exceptions\Handler');+++/*|--------------------------------------------------------------------------| Return The Applicationdiff --git a/composer.json b/composer.jsonindex c9459d4f3f..5bbf617f3b 100644--- a/composer.json+++ b/composer.json@@ -26,7 +26,9 @@"watson/validating": "~1.0","doctrine/dbal": "~2.5","illuminate/html": "~5.0",- "league/commonmark": "0.7.*"+ "league/commonmark": "0.7.*",+ "rcrowe/twigbridge": "0.7.x@dev",+ "twig/extensions": "~1.2"},"require-dev": {"barryvdh/laravel-debugbar": "@stable",diff --git a/composer.lock b/composer.lockindex 394312ec5e..bce1a9507c 100644--- a/composer.lock+++ b/composer.lock@@ -4,7 +4,7 @@"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file","This file is @generated automatically"],- "hash": "0d43c4c85607c5cdc901cde2d18b75d5",+ "hash": "e3e90dd365b74f4878cf3b5b4a1c4007","packages": [{"name": "classpreloader/classpreloader",@@ -1527,6 +1527,70 @@],"time": "2015-03-26 18:43:54"},+ {+ "name": "rcrowe/twigbridge",+ "version": "0.7.x-dev",+ "source": {+ "type": "git",+ "url": "https://github.com/rcrowe/TwigBridge.git",+ "reference": "ac0bfb5bcdb4fcd0cd01ab8425620ff07f6af026"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/ac0bfb5bcdb4fcd0cd01ab8425620ff07f6af026",+ "reference": "ac0bfb5bcdb4fcd0cd01ab8425620ff07f6af026",+ "shasum": ""+ },+ "require": {+ "illuminate/support": "5.0.*",+ "illuminate/view": "5.0.*",+ "php": ">=5.4.0",+ "twig/twig": "~1.15"+ },+ "require-dev": {+ "laravel/framework": "5.0.*",+ "mockery/mockery": "0.9.*",+ "phpunit/phpunit": "~4.0",+ "satooshi/php-coveralls": "~0.6",+ "squizlabs/php_codesniffer": "~1.5"+ },+ "suggest": {+ "laravelcollective/html": "For bringing back html/form in Laravel 5.x",+ "twig/extensions": "~1.0"+ },+ "type": "library",+ "extra": {+ "branch-alias": {+ "dev-master": "0.7-dev"+ }+ },+ "autoload": {+ "psr-4": {+ "TwigBridge\\": "src",+ "TwigBridge\\Tests\\": "tests"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "MIT"+ ],+ "authors": [+ {+ "name": "Barry vd. Heuvel",+ "email": "[email protected]"+ },+ {+ "name": "Rob Crowe",+ "email": "[email protected]"+ }+ ],+ "description": "Adds the power of Twig to Laravel",+ "keywords": [+ "laravel",+ "twig"+ ],+ "time": "2015-04-22 09:19:03"+ },{"name": "swiftmailer/swiftmailer","version": "v5.4.0",@@ -2291,6 +2355,115 @@],"time": "2015-03-31 08:12:29"},+ {+ "name": "twig/extensions",+ "version": "v1.2.0",+ "source": {+ "type": "git",+ "url": "https://github.com/twigphp/Twig-extensions.git",+ "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/8cf4b9fe04077bd54fc73f4fde83347040c3b8cd",+ "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd",+ "shasum": ""+ },+ "require": {+ "twig/twig": "~1.12"+ },+ "require-dev": {+ "symfony/translation": "~2.3"+ },+ "suggest": {+ "symfony/translation": "Allow the time_diff output to be translated"+ },+ "type": "library",+ "extra": {+ "branch-alias": {+ "dev-master": "1.2.x-dev"+ }+ },+ "autoload": {+ "psr-0": {+ "Twig_Extensions_": "lib/"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "MIT"+ ],+ "authors": [+ {+ "name": "Fabien Potencier",+ "email": "[email protected]"+ }+ ],+ "description": "Common additional features for Twig that do not directly belong in core",+ "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html",+ "keywords": [+ "i18n",+ "text"+ ],+ "time": "2014-10-30 14:30:03"+ },+ {+ "name": "twig/twig",+ "version": "v1.18.1",+ "source": {+ "type": "git",+ "url": "https://github.com/twigphp/Twig.git",+ "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/9f70492f44398e276d1b81c1b43adfe6751c7b7f",+ "reference": "9f70492f44398e276d1b81c1b43adfe6751c7b7f",+ "shasum": ""+ },+ "require": {+ "php": ">=5.2.7"+ },+ "type": "library",+ "extra": {+ "branch-alias": {+ "dev-master": "1.18-dev"+ }+ },+ "autoload": {+ "psr-0": {+ "Twig_": "lib/"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "BSD-3-Clause"+ ],+ "authors": [+ {+ "name": "Fabien Potencier",+ "email": "[email protected]",+ "homepage": "http://fabien.potencier.org",+ "role": "Lead Developer"+ },+ {+ "name": "Armin Ronacher",+ "email": "[email protected]",+ "role": "Project Founder"+ },+ {+ "name": "Twig Team",+ "homepage": "http://twig.sensiolabs.org/contributors",+ "role": "Contributors"+ }+ ],+ "description": "Twig, the flexible, fast, and secure template language for PHP",+ "homepage": "http://twig.sensiolabs.org",+ "keywords": [+ "templating"+ ],+ "time": "2015-04-19 08:30:27"+ },{"name": "vlucas/phpdotenv","version": "v1.1.0",@@ -4179,6 +4352,7 @@"aliases": [],"minimum-stability": "stable","stability-flags": {+ "rcrowe/twigbridge": 20,"barryvdh/laravel-debugbar": 0},"prefer-stable": false,diff --git a/config/app.php b/config/app.phpindex 17bf91779e..f0b8a7a614 100644--- a/config/app.php+++ b/config/app.php@@ -136,11 +136,12 @@ return ['Illuminate\Validation\ValidationServiceProvider','Illuminate\View\ViewServiceProvider','Illuminate\Html\HtmlServiceProvider',+ 'TwigBridge\ServiceProvider',+'DaveJamesMiller\Breadcrumbs\ServiceProvider','Barryvdh\Debugbar\ServiceProvider','Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',-/** Application Service Providers...*/@@ -152,6 +153,7 @@ return ['FireflyIII\Providers\FireflyServiceProvider','FireflyIII\Providers\TestingServiceProvider',+],/*@@ -201,13 +203,14 @@ return ['View' => 'Illuminate\Support\Facades\View','Form' => 'Illuminate\Html\FormFacade','Html' => 'Illuminate\Html\HtmlFacade',- 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade',-+ 'Breadcrumbs' => 'DaveJamesMiller\Breadcrumbs\Facade','Preferences' => 'FireflyIII\Support\Facades\Preferences','Navigation' => 'FireflyIII\Support\Facades\Navigation','Amount' => 'FireflyIII\Support\Facades\Amount','Steam' => 'FireflyIII\Support\Facades\Steam','ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',+ 'Twig' => 'TwigBridge\Facade\Twig',+],diff --git a/config/view.php b/config/view.phpindex 88fc534aeb..6e1a698a10 100644--- a/config/view.php+++ b/config/view.php@@ -14,7 +14,7 @@ return [*/'paths' => [- realpath(base_path('resources/views'))+ realpath(base_path('resources/twig'))],/*diff --git a/resources/twig/auth/login.twig b/resources/twig/auth/login.twignew file mode 100644index 0000000000..6853a7f764--- /dev/null+++ b/resources/twig/auth/login.twig@@ -0,0 +1,57 @@+{% extends "./layout/guest.twig" %}++{% block content %}++{% if errors.has('email') %}+<div class="row">+ <div class="col-lg-12">+ <div class="alert alert-danger alert-dismissible" role="alert">+ <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>+ <strong>Error!</strong> {{ errors.get('email')[0] }}+ </div>+ </div>+</div>+{% endif %}+++<div class="row">+ <div class="col-md-4 col-md-offset-4">+ <div class="login-panel panel panel-default">+ <div class="panel-heading">+ <h3 class="panel-title">Firefly III — Sign In</h3>+ </div>+ <div class="panel-body">+ <form role="form" method="POST" id="login" action="/auth/login">+ <input type="hidden" name="_token" value="{{ csrf_token }}">+ <div class="form-group">+ <label class="control-label">E-Mail</label>+ <input type="email" class="form-control" id="inputEmail" name="email" placeholder="E-Mail">+ </div>++ <div class="form-group">+ <label class="control-label">Password</label>+ <input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password">+ </div>+++ <div class="checkbox">+ <label>+ <input type="checkbox" name="remember" value="1"> Remember me+ </label>+ </div>+ <p>+ <button type="submit" class="btn btn-lg btn-success btn-block">Login</button>+ </p>+ <div class="btn-group btn-group-justified btn-group-sm">+ {% if Config.get('auth.allow_register') %}+ <a href="{{ route('register') }}" class="btn btn-default">Register</a>+ {% endif %}+ <a href="/password/email" class="btn btn-default">Forgot your password?</a>+ </div>+ </form>+ </div>+</div>+</div>+</div>+{% endblock %}+diff --git a/resources/twig/layout/guest.twig b/resources/twig/layout/guest.twignew file mode 100644index 0000000000..1d81e22141--- /dev/null+++ b/resources/twig/layout/guest.twig@@ -0,0 +1,62 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="utf-8">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ <meta name="viewport" content="width=device-width, initial-scale=1">+ <base href="{{ route('index') }}/">+ <title>Firefly III</title>++ <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="all" />+ <!-- <link rel="stylesheet" href="css/metisMenu.min.css" type="text/css" media="all" /> -->+ <!-- new css for SB admin -->+ <link rel="stylesheet" href="css/metisMenu.min.css" type="text/css" media="all" />+ <link rel="stylesheet" href="css/sb-admin-2.css" type="text/css" media="all" />+ <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css" media="all" />++ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->+ <!--[if lt IE 9]>+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>+ <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>+ <![endif]-->++ <!-- favicons -->+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png?v=Lb54KlrQnz">+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png?v=Lb54KlrQnz">+ <link rel="icon" type="image/png" href="/favicon-32x32.png?v=Lb54KlrQnz" sizes="32x32">+ <link rel="icon" type="image/png" href="/android-chrome-192x192.png?v=Lb54KlrQnz" sizes="192x192">+ <link rel="icon" type="image/png" href="/favicon-96x96.png?v=Lb54KlrQnz" sizes="96x96">+ <link rel="icon" type="image/png" href="/favicon-16x16.png?v=Lb54KlrQnz" sizes="16x16">+ <link rel="manifest" href="/manifest.json?v=Lb54KlrQnz">+ <link rel="shortcut icon" href="/favicon.ico?v=Lb54KlrQnz">+ <meta name="msapplication-TileColor" content="#2d89ef">+ <meta name="msapplication-TileImage" content="/mstile-144x144.png?v=Lb54KlrQnz">+ <meta name="theme-color" content="#ffffff">+++</head>+<body>+<div class="container">++ <!-- include "partials/flashes.twig" -->++++ {% block content %}{% endblock %}+</div>+<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>+<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>+<!-- new js for sb admin -->+<script type="text/javascript" src="js/metisMenu.min.js"></script>+<script type="text/javascript" src="js/sb-admin-2.js"></script>++</body>+</html>