aboutsummaryrefslogtreecommitdiffhomepage
path: root/main/app/sprinkles/FormGenerator/templates
diff options
context:
space:
mode:
authormarvin-borner@live.com2018-04-16 21:09:05 +0200
committermarvin-borner@live.com2018-04-16 21:09:05 +0200
commitcf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch)
tree86700651aa180026e89a66064b0364b1e4346f3f /main/app/sprinkles/FormGenerator/templates
parent619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff)
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'main/app/sprinkles/FormGenerator/templates')
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig33
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig28
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig5
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig5
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig3
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig5
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig10
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig5
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig3
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig62
-rwxr-xr-xmain/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig15
11 files changed, 174 insertions, 0 deletions
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig
new file mode 100755
index 0000000..c902064
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig
@@ -0,0 +1,33 @@
+{% import "FormGenerator/macros/checkbox.html.twig" as checkbox %}
+{% import "FormGenerator/macros/textarea.html.twig" as textarea %}
+{% import "FormGenerator/macros/select.html.twig" as select %}
+{% import "FormGenerator/macros/text.html.twig" as text %}
+{% import "FormGenerator/macros/hidden.html.twig" as hidden %}
+{% import "FormGenerator/macros/alert.html.twig" as alert %}
+
+{% for name,input in fields %}
+ {% if input.type == "hidden" %}
+ {{ hidden.generate(input) }}
+ {% elseif input.type == "alert" %}
+ {{ alert.generate(input) }}
+ {% else %}
+ {% if not input.hidden %}
+ <div class="form-group has-feedback">
+ {% if formLayout == 'horizontal' %}<label for="{{input.id}}" class="col-sm-2 control-label">{% else %}<label for="{{input.id}}">{% endif %}
+ {% if input.label %}{{translate(input.label)}}{% else %}&nbsp;{% endif %}
+ </label>
+ {% if formLayout == 'horizontal' %}<div class="col-sm-10">{% endif %}
+ {% if input.type == "textarea" %}
+ {{ textarea.generate(input) }}
+ {% elseif input.type == "checkbox" %}
+ {{ checkbox.generate(input) }}
+ {% elseif input.type == "select" %}
+ {{ select.generate(input) }}
+ {% else %}
+ {{ text.generate(input) }}
+ {% endif %}
+ {% if formLayout == 'horizontal' %}</div>{% endif %}
+ </div>
+ {% endif %}
+ {% endif %}
+{% endfor %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig
new file mode 100755
index 0000000..96d0072
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig
@@ -0,0 +1,28 @@
+<div id='{{box_id}}' class='modal fade'>
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class='modal-header'>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ <h4 class='modal-title'>{% if box_title %}{{ translate(box_title) }}{% else %}{{translate("CONFIRM")}}{% endif %}</h4>
+ </div>
+ <div class='modal-body'>
+ <div id="confirmation-alerts"></div>
+ <h4>
+ {% if confirm_message %}{{ translate(confirm_message) }}{% else %}{{translate("CONFIRM.MESSAGE")}}{% endif %}
+ <br />
+ <small>{% if confirm_warning %}{{ translate(confirm_warning) }}{% else %}{{translate("CONFIRM.WARNING")}}{% endif %}</small>
+ </h4>
+ <br>
+ <div class='btn-group-action'>
+ {% include "forms/csrf.html.twig" %}
+ <button type='button' class='btn btn-danger btn-lg btn-block js-confirm'>{% if confirm_button %}{{ translate(confirm_button) }}{% else %}{{translate("CONFIRM.YES")}}{% endif %}</button>
+ <button type='button' class='btn btn-default btn-lg btn-block' data-dismiss='modal'>{% if cancel_button %}{{ translate(cancel_button) }}{% else %}{{translate("CANCEL")}}{% endif %}</button>
+ </div>
+ </div>
+ </div>
+ <!-- /.modal-content -->
+ </div>
+ <!-- /.modal-dialog -->
+</div> \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig
new file mode 100755
index 0000000..21636f0
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig
@@ -0,0 +1,5 @@
+{% macro generate(input) %}
+ <div class="alert {{input.class}}">
+ {% if input.icon %}<i class="icon fa {{input.icon}}"></i> {% endif %}{{ translate(input.value) }}
+ </div>
+{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig
new file mode 100755
index 0000000..9065651
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig
@@ -0,0 +1,5 @@
+{% macro generate(input) %}
+ <div class="checkbox icheck">
+ <input{% for type,value in input %} {{type}}="{{value}}"{% endfor %}></input>
+ </div>
+{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig
new file mode 100755
index 0000000..a30fb7a
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig
@@ -0,0 +1,3 @@
+{% macro generate(input) %}
+ <input{% for type,value in input %} {{type}}="{{value}}"{% endfor %}></input>
+{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig
new file mode 100755
index 0000000..256c3f2
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig
@@ -0,0 +1,5 @@
+{% macro generate(input) %}
+ <select{% for type,value in input %}{% if type != "options" %} {{type}}="{{value}}"{% endif %}{% endfor %}>
+ {% for option, label in input.options %}<option value="{{option}}" {% if (option == input.value) %}selected{% endif %}>{{translate(label)}}</option>{% endfor %}
+ </select>
+{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig
new file mode 100755
index 0000000..30beb5b
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig
@@ -0,0 +1,10 @@
+{% macro generate(input) %}
+ {% if input.icon %}
+ <div class="input-group">
+ <span class="input-group-addon"><i class="fa {{input.icon}} fa-fw"></i></span>
+ {% else %}
+ <div class="form-group">
+ {% endif %}
+ <input{% for type,value in input %} {{type}}="{{value}}"{% endfor %}></input>
+ </div>
+{% endmacro %}
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig
new file mode 100755
index 0000000..ce5e2e7
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig
@@ -0,0 +1,5 @@
+{% macro generate(input) %}
+ {% if input.icon %}<div class="input-group"><span class="input-group-addon"><i class="fa {{input.icon}} fa-fw"></i></span>{% endif %}
+ <textarea{% for type,value in input %} {{type}}="{{value}}"{% endfor %}>{{input.value}}</textarea>
+ {% if input.icon %}</div>{% endif %}
+{% endmacro %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig
new file mode 100755
index 0000000..b2de3f9
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal-large.html.twig
@@ -0,0 +1,3 @@
+{% extends "FormGenerator/modal.html.twig" %}
+
+{% block modal_size %}modal-lg{% endblock %}
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig
new file mode 100755
index 0000000..3c66201
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig
@@ -0,0 +1,62 @@
+{% block modal %}
+<div id='{{box_id}}' class='modal fade'>
+ <div class="modal-dialog {% block modal_size %}{% endblock %}" role="document">
+ <div class="modal-content">
+ <form name="ModalFormGenerator" method="{{ (form_method) ? form_method : 'post' }}" action="{{form_action}}">
+ {% include "forms/csrf.html.twig" %}
+ <div class='modal-header'>
+ <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
+ <h4 class='modal-title'>{% if box_title %}{{ translate(box_title) }}{% endif %}</h4>
+ </div>
+ <div class='modal-body'>
+ <div id="form-alerts"></div>
+ {% block form_content %}
+ {% include 'FormGenerator/FormGenerator.html.twig' %}
+ {% endblock %}
+ </div>
+ <div class='modal-footer'>
+ <div class="row">
+ {% if "submit" not in buttons.hidden %}
+ <div class="col-xs-8 col-sm-4">
+ <div class="vert-pad">
+ <button type="submit" class="btn btn-block btn-lg btn-success js-submit"{% if 'submit' in buttons.disabled %} disabled{% endif %}>
+ {% if submit_button %}{{ translate(submit_button) }}{% else %}{{translate("SUBMIT")}}{% endif %}
+ </button>
+ </div>
+ </div>
+ {% endif %}
+ {% if "cancel" not in buttons.hidden %}
+ <div class="col-xs-4 col-sm-3 pull-right">
+ <div class="vert-pad">
+ <button type="button" class="btn btn-block btn-lg btn-link" data-dismiss="modal"{% if 'cancel' in buttons.disabled %} disabled{% endif %}>
+ {{ translate("CANCEL") }}
+ </button>
+ </div>
+ </div>
+ {% endif %}
+ </div>
+ </div>
+ </form>
+ </div>
+ <!-- /.modal-content -->
+ </div>
+ <!-- /.modal-dialog -->
+</div>
+{% endblock %}
+
+{% block scripts_page %}
+ <!-- Need to reload and reaply those since we're in modal -->
+ <script>
+ // Load the validator rules for this form
+ var validators = {{validators|default('{}')| raw}};
+
+ $(function() {
+ $('#{{box_id}}').iCheck({
+ checkboxClass: 'icheckbox_square-blue',
+ radioClass: 'iradio_square-blue',
+ increaseArea: '20%' // optional
+ });
+ $('#{{box_id}}').find('.js-select2').select2({ minimumResultsForSearch: Infinity, width: '100%' });
+ });
+ </script>
+{% endblock %} \ No newline at end of file
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig
new file mode 100755
index 0000000..150427a
--- /dev/null
+++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig
@@ -0,0 +1,15 @@
+{% extends "FormGenerator/modal.html.twig" %}
+
+{% block scripts_page %}
+{{ parent() }}
+
+<script>
+ $("input[name='{{typeaheadInput}}']").typeahead({
+ source: function(query, process) {
+ return $.getJSON('{{typeaheadUrl}}', { input : query}, function(data) {
+ return process(data);
+ });
+ }
+ });
+</script>
+{% endblock %} \ No newline at end of file