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_explanation'|_ }} +
+ {{ ruleGroup.description }} +
+ + {% if ruleGroup.rules.count > 0 %} +{{ 'rule_name'|_ }} | +{{ 'rule_triggers'|_ }} | +{{ 'rule_actions'|_ }} | +|
---|---|---|---|
+ + + | +{{ rule.title }}
+ {% if rule.description != "" %}
+ {{ rule.description }} + {% endif %} + |
+ X | +Y | +
+ {{ 'no_rules_in_group'|_ }} +
+ {% endif %} +
+
+ {{ 'new_rule'|_ }}
+