src/pyams_form/templates/widget-form.pt
changeset 0 7a0b409fd4b8
child 2 0f135e3c84b1
equal deleted inserted replaced
-1:000000000000 0:7a0b409fd4b8
       
     1 <div class="ams-widget">
       
     2 	<header>
       
     3 		<span tal:condition="view.widget_icon_class | nothing"
       
     4 			  class="widget-icon"><i tal:attributes="class view.widget_icon_class"></i>
       
     5 		</span>
       
     6 		<h2 tal:content="view.legend"></h2>
       
     7 		<tal:var content="structure provider:pyams.toolbar" />
       
     8 	</header>
       
     9 	<div class="widget-body no-padding">
       
    10 		<div tal:define="prefix provider:form_prefix"
       
    11 			 tal:replace="structure prefix">Form prefix</div>
       
    12 		<tal:var content="structure provider:content_help" />
       
    13 		<form method="post"
       
    14 			  data-async
       
    15 			  tal:attributes="id view.id;
       
    16 							  name view.name;
       
    17 							  action view.get_form_action();
       
    18 							  method view.method;
       
    19 							  enctype view.enctype;
       
    20 							  acceptCharset view.acceptCharset;
       
    21 							  accept view.accept;
       
    22 							  autocomplete view.autocomplete;
       
    23 							  class view.css_class;
       
    24 							  data-ams-data extension:view_data;
       
    25 							  data-ams-form-handler view.get_ajax_handler() | nothing;
       
    26 							  data-ams-form-options view.get_form_options() | nothing;
       
    27 							  data-ams-form-submit-target view.form_target | nothing;
       
    28 							  data-ams-warn-on-change view.warn_on_change;">
       
    29 			<div class="modal-viewport">
       
    30 				<fieldset>
       
    31 					<div class="widgets-prefix"
       
    32 						 tal:define="prefix provider:widgets_prefix"
       
    33 						 tal:condition="prefix"
       
    34 						 tal:content="structure prefix">Widgets prefix</div>
       
    35 					<tal:loop repeat="group view.groups">
       
    36 						<fieldset tal:define="legend group.legend"
       
    37 								  tal:omit-tag="not:legend">
       
    38 							<tal:if condition="group.checkbox_switch">
       
    39 								<legend tal:condition="legend"
       
    40 										tal:content="legend"
       
    41 										tal:attributes="class group.css_class;
       
    42 														data-ams-checker-fieldname group.checker_field.getName();
       
    43 														data-ams-checker-state group.checker_state;">Legend</legend>
       
    44 							</tal:if>
       
    45 							<tal:if condition="not:group.checkbox_switch">
       
    46 								<legend tal:condition="legend"
       
    47 										tal:content="legend"
       
    48 										tal:attributes="class group.css_class;
       
    49 														data-ams-switcher-state group.switcher_state;">Legend</legend>
       
    50 							</tal:if>
       
    51 							<tal:var define="help group.help" condition="help">
       
    52 								<div class=""
       
    53 									 tal:define="html import:pyams_utils.text.text_to_html;
       
    54 												 i18n_help html(request.localizer.translate(help));"
       
    55 									 tal:content="structure i18n_help"></div>
       
    56 							</tal:var>
       
    57 							<tal:loop repeat="widget group.visible_widgets">
       
    58 								<input type="hidden"
       
    59 									   tal:condition="widget.mode == 'hidden'"
       
    60 									   tal:replace="structure widget.render()" />
       
    61 								<tal:if condition="widget.mode != 'hidden'">
       
    62 									<div tal:define="required 'required-field' if widget.required and (widget.mode != 'display') else ''"
       
    63 										 tal:attributes="class string:form-group ${required}">
       
    64 										<label tal:attributes="class view.label_css_class">
       
    65 											<span>
       
    66 												<tal:var content="widget.label" />
       
    67 												<i class="fa fa-question-circle hint" title="Input hint"
       
    68 												   tal:define="description widget.field.description"
       
    69 												   tal:condition="description"
       
    70 												   tal:attributes="title description;
       
    71 																   data-ams-hint-html '<' in description;"></i>
       
    72 											</span>
       
    73 										</label>
       
    74 										<div tal:attributes="class widget.input_css_class | view.input_css_class">
       
    75 											<label class="input"
       
    76 												   tal:attributes="class widget.label_css_class | default;
       
    77 																   data-ams-data extension:object_data(widget);
       
    78 																   data-ams-form-validator view.get_widget_callback(widget.field.getName())">
       
    79 												<input tal:replace="structure widget.render()" />
       
    80 											</label>
       
    81 										</div>
       
    82 									</div>
       
    83 								</tal:if>
       
    84 							</tal:loop>
       
    85 						</fieldset>
       
    86 					</tal:loop>
       
    87 					<div class="widgets-suffix"
       
    88 						 tal:define="suffix provider:widgets_suffix"
       
    89 						 tal:condition="suffix"
       
    90 						 tal:content="structure suffix">Widgets suffix</div>
       
    91 					<div class="subforms"
       
    92 						 tal:condition="view.subforms">
       
    93 						<fieldset tal:define="title view.subforms_legend"
       
    94 								  tal:omit-tag="not:title">
       
    95 							<legend tal:condition="title" tal:content="title" i18n:translate="">Title</legend>
       
    96 							<tal:loop repeat="subform view.subforms">
       
    97 								<tal:var replace="structure subform.render()" />
       
    98 							</tal:loop>
       
    99 						</fieldset>
       
   100 					</div>
       
   101 					<div class="tabforms"
       
   102 						 tal:condition="view.tabforms">
       
   103 						<ul class="nav nav-tabs">
       
   104 							<li tal:repeat="tabform view.tabforms"
       
   105 								tal:attributes="class tabform.widgets.errors and 'state-error' or ''">
       
   106 								<a data-toggle="tab"
       
   107 								   tal:attributes="href string:#${tabform.id}"
       
   108 								   tal:content="tabform.tabLabel" i18n:translate="">Tab label</a>
       
   109 							</li>
       
   110 						</ul>
       
   111 						<div class="tab-content">
       
   112 							<div class="tab-pane fade in"
       
   113 								 tal:repeat="tabform view.tabforms">
       
   114 								 tal:attributes="id tabform.id"
       
   115 								 tal:content="structure tabform.render()" />
       
   116 							</div>
       
   117 						</div>
       
   118 					</div>
       
   119 				</fieldset>
       
   120 			</div>
       
   121 			<footer>
       
   122 				<button tal:repeat="action view.actions.values()"
       
   123 						tal:replace="structure action.render()">Action</button>
       
   124 			</footer>
       
   125 		</form>
       
   126 		<div tal:define="prefix provider:form_suffix"
       
   127 			 tal:replace="structure prefix">Form suffix</div>
       
   128 	</div>
       
   129 </div>