Permalink
Please sign in to comment.
Showing
with
196 additions
and 1 deletion.
| @@ -0,0 +1,82 @@ | ||
| <div id="${field.formid}" class="modal fade" tabindex="-1" role="dialog"> | ||
| <div class="modal-dialog" role="document"> | ||
| <!--- Render form as a modal-content part --> | ||
| <div class="modal-content"> | ||
| <form | ||
| method="${method}" | ||
| enctype="multipart/form-data" | ||
| accept-charset="utf-8" | ||
| tal:define=" | ||
| style style|field.widget.style; | ||
| css_class 'deform'; | ||
| item_template item_template|field.widget.item_template; | ||
| autocomplete autocomplete|field.autocomplete; | ||
| errormsg errormsg|field.errormsg; | ||
| description description|field.description; | ||
| buttons buttons|field.buttons; | ||
| use_ajax use_ajax|field.use_ajax; | ||
| formid formid|field.formid; | ||
| action action|field.action or None; | ||
| method method|field.method;" | ||
| tal:attributes=" | ||
| autocomplete autocomplete; | ||
| style style; | ||
| class css_class; | ||
| action action;" | ||
| > | ||
| <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">${field.title}</h4> | ||
| </div> | ||
| <fieldset class="modal-body deform-form-fieldset"> | ||
| <input type="hidden" name="_charset_"/> | ||
| <input type="hidden" name="__formid__" value="${formid}"/> | ||
| <div class="alert alert-danger" tal:condition="field.error"> | ||
| <div class="error-msg-lbl" i18n:translate="" | ||
| >There was a problem with your submission | ||
| </div> | ||
| <div class="error-msg-detail" i18n:translate="" | ||
| >Errors have been highlighted below | ||
| </div> | ||
| <p class="error-msg">${field.errormsg}</p> | ||
| </div> | ||
| <p class="section first" tal:condition="description"> | ||
| ${description} | ||
| </p> | ||
| <!--- Render all widgets within the form --> | ||
| <div tal:repeat="child field" | ||
| tal:replace="structure child.render_template(item_template)"/> | ||
| </fieldset> | ||
| <div class="modal-footer"> | ||
| <div class="form-group deform-form-buttons"> | ||
| <tal:loop tal:repeat="button buttons"> | ||
| <button | ||
| tal:define="btn_disposition repeat.button.start and 'btn-primary' or 'btn-default'; | ||
| btn_icon button.icon|None" | ||
| tal:attributes="disabled button.disabled if button.disabled else None" | ||
| id="${formid+button.name}" | ||
| name="${button.name}" | ||
| type="${button.type}" | ||
| class="btn ${button.css_class or btn_disposition}" | ||
| value="${button.value}"> | ||
| <i tal:condition="btn_icon" class="${btn_icon}"> </i> | ||
| ${button.title} | ||
| </button> | ||
| </tal:loop> | ||
| </div> | ||
| </div> | ||
| </form><!-- /.modal-content --> | ||
| </div> | ||
| </div><!-- /.modal-dialog --> | ||
| </div><!-- /.modal --> |
| @@ -0,0 +1,65 @@ | ||
| <!DOCTYPE html> | ||
| <div metal:use-macro="view.macros['master']"> | ||
| <div metal:fill-slot="head_end"> | ||
| <style> | ||
| #opener { | ||
| margin: 20px; | ||
| } | ||
| </style> | ||
| </div> | ||
| <div metal:fill-slot="body_end"> | ||
| <!-- We we place our pop up code before closing </body> --> | ||
| <script> | ||
| "use strict"; | ||
| $(document).ready(function() { | ||
| // Automatically show pop up if the form contains validation errors | ||
| if($("#my-pop-up .error-msg-detail").length > 0) { | ||
| $("#my-pop-up").modal("show"); | ||
| } | ||
| }); | ||
| </script> | ||
| </div> | ||
| <div metal:fill-slot="main"> | ||
| <div class="panel panel-primary"> | ||
| <div class="panel-heading"> | ||
| <h3 class="panel-title">Demo: ${title}</h3> | ||
| </div> | ||
| <div id="opener"> | ||
| <button type="button" id="btn-show-pop-up" class="btn btn-primary btn-lg btn-block" data-toggle="modal" data-target="#my-pop-up"> | ||
| Open pop up form | ||
| </button> | ||
| </div> | ||
| <!-- This will render modal.pt --> | ||
| <form tal:replace="structure form"></form> | ||
| </div> | ||
| <div class="panel panel-info"> | ||
| <div class="panel-heading"> | ||
| <h3 class="panel-title">Captured submission</h3> | ||
| </div> | ||
| <div class="panel-body"> | ||
| <pre style="border: none; background-color: #FFF" class="highlight" id="captured" tal:content="structure captured"/> | ||
| </div> | ||
| </div> | ||
| <div class="panel panel-default"> | ||
| <div class="panel-heading"> | ||
| <h3 class="panel-title">Code <a href="${request.resource_url(request.root, 'allcode', query={'start':start, 'end':end}, anchor='line-%s' % start)}"><small> | ||
| (click to show in context)</small></a> | ||
| </h3> | ||
| </div> | ||
| <div class="panel-body highlight"> | ||
| <pre style="border: none; background-color: #FFF" tal:content="structure code"/> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
0 comments on commit
93262be