diff options
Diffstat (limited to 'main/app/sprinkles/FormGenerator/templates')
10 files changed, 119 insertions, 109 deletions
diff --git a/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig index c902064..688c96c 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/FormGenerator.html.twig @@ -12,22 +12,24 @@ {{ 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 %} {% 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> + <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 %} {% 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 index 96d0072..67ba757 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/confirm.html.twig @@ -1,28 +1,30 @@ -<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 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-content --> - </div> - <!-- /.modal-dialog --> + <!-- /.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 index 21636f0..03409b5 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/alert.html.twig @@ -1,5 +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 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 index 9065651..95855c2 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/checkbox.html.twig @@ -1,5 +1,5 @@ {% macro generate(input) %} <div class="checkbox icheck"> - <input{% for type,value in input %} {{type}}="{{value}}"{% endfor %}></input> + <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 index a30fb7a..34c2d9d 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/hidden.html.twig @@ -1,3 +1,3 @@ {% macro generate(input) %} - <input{% for type,value in input %} {{type}}="{{value}}"{% endfor %}></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 index 256c3f2..152947b 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/select.html.twig @@ -1,5 +1,7 @@ {% 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{% 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 index 30beb5b..8551fbb 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/text.html.twig @@ -1,10 +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> +<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> + {% endif %} + <input{% for type,value in input %} {{ type }}="{{ value }}"{% endfor %}></input> </div> -{% endmacro %} + {% 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 index ce5e2e7..d924be4 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/macros/textarea.html.twig @@ -1,5 +1,6 @@ {% 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 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.html.twig b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig index 3c66201..82d3ea0 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/modal.html.twig @@ -1,62 +1,65 @@ {% 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'>×</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 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'>×</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> - {% 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 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> - {% endif %} - </div> + </form> </div> - </form> + <!-- /.modal-content --> + </div> + <!-- /.modal-dialog --> </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}}; + var validators = {{ validators|default('{}')| raw }}; - $(function() { - $('#{{box_id}}').iCheck({ - checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_square-blue', - increaseArea: '20%' // optional + $(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%' }); + $('#{{ 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 index 150427a..3e5c079 100644 --- a/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig +++ b/main/app/sprinkles/FormGenerator/templates/FormGenerator/typehead.html.twig @@ -1,15 +1,15 @@ {% extends "FormGenerator/modal.html.twig" %} {% block scripts_page %} -{{ parent() }} + {{ parent() }} -<script> - $("input[name='{{typeaheadInput}}']").typeahead({ - source: function(query, process) { - return $.getJSON('{{typeaheadUrl}}', { input : query}, function(data) { - return process(data); - }); - } - }); -</script> + <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 |