First attempt at create rule form.

This commit is contained in:
James Cole
2016-01-14 12:37:49 +01:00
parent 81b9d5da09
commit c352eb0c74
6 changed files with 132 additions and 5 deletions

View File

@@ -105,16 +105,26 @@
</td>
<td>{{ rule.title }}
{% if rule.stop_processing %}
<i class="fa fa-stop-circle-o"></i>
{% endif %}
{% if rule.description != "" %}
<small><br/>{{ rule.description }}</small>
{% endif %}
</td>
<td>
{% if rule.ruleTriggers.count > 0 %}
<ul class="small rule-triggers" data-id="{{ rule.id }}">
{% for trigger in rule.ruleTriggers %}
{% if trigger.trigger_type != "user_action" %}
<li data-id="{{ trigger.id }}">{{ trans(('firefly.rule_trigger_' ~ trigger.trigger_type), {trigger_value: trigger.trigger_value}) }}</li>
<li data-id="{{ trigger.id }}">{{ trans(('firefly.rule_trigger_' ~ trigger.trigger_type), {trigger_value: trigger.trigger_value}) }}
{% if trigger.stop_processing %}
<i class="fa fa-stop-circle-o"></i>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
@@ -124,7 +134,11 @@
{% if rule.ruleActions.count > 0 %}
<ul class="small rule-actions" data-id="{{ rule.id }}">
{% for action in rule.ruleActions %}
<li data-id="{{ action.id }}">{{ trans(('firefly.rule_action_' ~ action.action_type), {action_value: action.action_value}) }}</li>
<li data-id="{{ action.id }}">{{ trans(('firefly.rule_action_' ~ action.action_type), {action_value: action.action_value}) }}
{% if action.stop_processing %}
<i class="fa fa-stop-circle-o"></i>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
@@ -140,7 +154,7 @@
{% endif %}
<p>
<br/>
<a href="{{ route('rules.rule.create') }}" class="btn btn-success">{{ 'new_rule'|_ }}</a>
<a href="{{ route('rules.rule.create', ruleGroup.id) }}" class="btn btn-success">{{ 'new_rule'|_ }}</a>
</p>
</div>
</div>

View File

@@ -0,0 +1,85 @@
{% extends "./layout/default.twig" %}
{% block breadcrumbs %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
{% endblock %}
{% block content %}
{{ Form.open({'class' : 'form-horizontal','id' : 'store','url' : route('rules.rule.store', ruleGroup.id)}) }}
<input type="hidden" name="rule_group_id" value="{{ ruleGroup.id }}"/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.text('title') }}
{{ ExpandedForm.checkbox('stop_processing',1,null, {helpText: trans('firefly.rule_help_stop_processing')}) }}
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<!-- optional fields -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.textarea('description') }}
</div>
</div>
</div>
</div>
<!-- RULE TRIGGERS -->
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'rule_triggers'|_ }}</h3>
</div>
<div class="box-body">
Here
</div>
</div>
</div>
</div>
<!-- RULE ACTIONS -->
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'rule_actions'|_ }}</h3>
</div>
<div class="box-body">
Here
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-lg-offset-6 col-md-offset-6 col-md-6 col-sm-12">
<!-- panel for options -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'options'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.optionsList('create','rule-group') }}
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">{{ 'store_new_rule_group'|_ }}</button>
</div>
</div>
</div>
</div>
{{ Form.close|raw }}
{% endblock %}