From 768508dd4b5fe1c09bc30c417cdc10f460eb9b2e Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 13 Jan 2016 15:59:45 +0100 Subject: [PATCH] First attempt at interface. --- app/Http/Controllers/RuleController.php | 5 +- app/Http/routes.php | 25 +++---- resources/views/rules/index.twig | 89 ++++++++++++++++++++++++- 3 files changed, 104 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index d99ab1f4f6..3c7ce3f31e 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -9,6 +9,7 @@ namespace FireflyIII\Http\Controllers; +use Auth; use FireflyIII\Http\Requests; use View; @@ -35,6 +36,8 @@ class RuleController extends Controller */ public function index() { - return view('rules.index'); + $ruleGroups = Auth::user()->ruleGroups()->with('rules')->get(); + + return view('rules.index', compact('ruleGroups')); } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 8b164a8ec8..1651ee9e1c 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -1,16 +1,4 @@ 'RuleController@index', 'as' => 'rules.index']); + // rules: + Route::get('/rules/rules/create', ['uses' => 'RuleController@createRule', 'as' => 'rules.rule.create']); + Route::get('/rules/rules/up/{rule}', ['uses' => 'RuleController@upRule', 'as' => 'rules.rule.up']); + Route::get('/rules/rules/down/{rule}', ['uses' => 'RuleController@downRule', 'as' => 'rules.rule.down']); + Route::get('/rules/rules/edit/{rule}', ['uses' => 'RuleController@editRule', 'as' => 'rules.rule.edit']); + Route::get('/rules/rules/delete/{rule}', ['uses' => 'RuleController@deleteRule', 'as' => 'rules.rule.delete']); + + // rule groups: + Route::get('/rules/groups/create', ['uses' => 'RuleController@createRuleGroup', 'as' => 'rules.rule-group.create']); + Route::get('/rules/groups/edit/{ruleGroup}', ['uses' => 'RuleController@editRuleGroup', 'as' => 'rules.rule-group.edit']); + Route::get('/rules/groups/delete/{ruleGroup}', ['uses' => 'RuleController@deleteRuleGroup', 'as' => 'rules.rule-group.delete']); + + /** * Search Controller */ diff --git a/resources/views/rules/index.twig b/resources/views/rules/index.twig index 9a934d37b3..9ff1e870bd 100644 --- a/resources/views/rules/index.twig +++ b/resources/views/rules/index.twig @@ -6,15 +6,100 @@
-
+

{{ 'rules'|_ }}

+ +
+ +
- Bla bla bla +

+ {{ 'rules_explanation'|_ }} +

+ {% for ruleGroup in ruleGroups %} +
+
+
+
+

{{ ruleGroup.title }}

+ + + + +
+
+

+ {{ ruleGroup.description }} +

+ + {% if ruleGroup.rules.count > 0 %} + + + + + + + + + + {% for rule in ruleGroup.rules %} + + + + + + + {% endfor %} + +
{{ 'rule_name'|_ }}{{ 'rule_triggers'|_ }}{{ 'rule_actions'|_ }}
+
+ + + + +
+ +
{{ rule.title }} + {% if rule.description != "" %} +
{{ rule.description }}
+ {% endif %} +
XY
+ {% else %} +

+ {{ 'no_rules_in_group'|_ }} +

+ {% endif %} +

+
+ {{ 'new_rule'|_ }} +

+
+
+
+
+ {% endfor %} + + + {% endblock %}