Updated templates
authorThierry Florac <thierry.florac@onf.fr>
Thu, 08 Oct 2015 09:15:08 +0200
changeset 27 5c2f8344b85d
parent 26 a55e6f2b27ba
child 28 893e485046bc
Updated templates
src/pyams_form/templates/form.pt
src/pyams_form/templates/help.pt
src/pyams_form/templates/inner-form.pt
src/pyams_form/templates/widget-form.pt
--- a/src/pyams_form/templates/form.pt	Thu Oct 08 09:14:52 2015 +0200
+++ b/src/pyams_form/templates/form.pt	Thu Oct 08 09:15:08 2015 +0200
@@ -1,17 +1,25 @@
 <div class="modal-content">
-	<div class="modal-header">
-		<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
-				tal:condition="view.is_dialog">
-			<i class="fa fa-fw fa-close"></i>
-		</button>
-		<h3 class="modal-title"
-			tal:define="config extension:configuration;">
-			<span class="title" tal:content="view.title | context.title | config.title">Title</span>
-		</h3>
+	<div class="modal-header"
+		 tal:define="header provider:form_header">
+		<tal:if condition="header">
+			<tal:var replace="structure header" />
+		</tal:if>
+		<tal:if condition="not:header">
+			<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
+					tal:condition="view.is_dialog">
+				<i class="fa fa-fw fa-times-circle"></i>
+			</button>
+			<h3 class="modal-title"
+				tal:define="config extension:configuration;">
+				<span class="title" tal:content="view.title | context.title | config.title">Title</span>
+			</h3>
+		</tal:if>
 	</div>
 	<div class="modal-body no-padding">
-		<div tal:define="prefix provider:form_prefix"
-			 tal:replace="structure prefix">Form prefix</div>
+		<div class="form-prefix"
+			 tal:define="prefix provider:form_prefix"
+			 tal:condition="prefix"
+			 tal:content="structure prefix">Form prefix</div>
 		<form method="post"
 			  data-async
 			  tal:attributes="id view.id;
@@ -38,7 +46,7 @@
 						<tal:var condition="python:getattr(view, 'show_widget_title', False)"
 								 content="structure provider:pyams.widget_title" />
 					</legend>
-					<tal:var content="structure provider:content_help" />
+					<tal:var content="structure provider:form_help" />
 					<div class="widgets-prefix"
 						 tal:define="prefix provider:widgets_prefix"
 						 tal:condition="prefix"
@@ -131,7 +139,8 @@
 								tal:attributes="class 'small {active} {errors}'.format(active='active' if repeat['tabform'].start() else '',
 																					   errors='state-error' if tabform.widgets.errors else '')">
 								<a data-toggle="tab"
-								   tal:attributes="href string:#${tabform.id}"
+								   tal:attributes="href string:#${tabform.id};
+												   data-ams-url python:getattr(tabform, 'tab_target', None);"
 								   tal:content="tabform.tab_label" i18n:translate="">Tab label</a>
 							</li>
 						</ul>
@@ -145,12 +154,14 @@
 					</div>
 				</fieldset>
 			</div>
-			<footer>
+			<footer tal:condition="view.actions and (view.is_dialog or (view.mode == 'input'))">
 				<button tal:repeat="action view.actions.values()"
 						tal:replace="structure action.render()">Action</button>
 			</footer>
 		</form>
-		<div tal:define="prefix provider:form_suffix"
-			 tal:replace="structure prefix">Form suffix</div>
+		<div class="form-suffix"
+			 tal:define="suffix provider:form_suffix"
+			 tal:condition="suffix"
+			 tal:content="structure suffix">Form suffix</div>
 	</div>
 </div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_form/templates/help.pt	Thu Oct 08 09:15:08 2015 +0200
@@ -0,0 +1,7 @@
+<tal:if define="help view.help"
+		condition="help">
+	<div tal:attributes="class string:margin-${help.outer_margin} help alert alert-block alert-${help.status} fade in">
+		<h4 class="alert-heading" tal:condition="help.header" tal:content="help.header"></h4>
+		<div tal:replace="structure extension:html(help)"></div>
+	</div>
+</tal:if>
--- a/src/pyams_form/templates/inner-form.pt	Thu Oct 08 09:14:52 2015 +0200
+++ b/src/pyams_form/templates/inner-form.pt	Thu Oct 08 09:15:08 2015 +0200
@@ -22,6 +22,7 @@
 						  data-ams-form-download-target view.download_target | nothing;
 						  data-ams-warn-on-change view.warn_on_change;">
 		<fieldset tal:define="legend view.legend"
+				  tal:attributes="class view.fieldset_class | nothing"
 				  tal:omit-tag="not:legend">
 			<legend class="inner" tal:condition="legend">
 				<i tal:attributes="class view.icon_css_class | nothing"></i>
@@ -29,7 +30,7 @@
 				<tal:var condition="python:getattr(view, 'show_widget_title', False)"
 						 content="structure provider:pyams.widget_title" />
 			</legend>
-			<tal:var content="structure provider:content_help" />
+			<tal:var content="structure provider:form_help" />
 			<div class="widgets-prefix"
 				 tal:define="prefix provider:widgets_prefix"
 				 tal:condition="prefix"
@@ -122,7 +123,8 @@
 						tal:attributes="class '{active} {errors}'.format(active='active' if repeat['tabform'].start() else '',
 																		 errors='state-error' if tabform.widgets.errors else '')">
 						<a data-toggle="tab"
-						   tal:attributes="href string:#${tabform.id}"
+						   tal:attributes="href string:#${tabform.id};
+										   data-ams-url python:getattr(tabform, 'tab_target', None);"
 						   tal:content="tabform.tab_label" i18n:translate="">Tab label</a>
 					</li>
 				</ul>
@@ -135,7 +137,7 @@
 				</div>
 			</div>
 		</fieldset>
-		<footer tal:condition="view.actions">
+		<footer tal:condition="view.actions and (view.is_dialog or (view.mode == 'input'))">
 			<button tal:repeat="action view.actions.values()"
 					tal:replace="structure action.render()">Action</button>
 		</footer>
--- a/src/pyams_form/templates/widget-form.pt	Thu Oct 08 09:14:52 2015 +0200
+++ b/src/pyams_form/templates/widget-form.pt	Thu Oct 08 09:15:08 2015 +0200
@@ -10,7 +10,7 @@
 	<div class="widget-body no-padding">
 		<div tal:define="prefix provider:form_prefix"
 			 tal:replace="structure prefix">Form prefix</div>
-		<tal:var content="structure provider:content_help" />
+		<tal:var content="structure provider:form_help" />
 		<form method="post"
 			  data-async
 			  tal:attributes="id view.id;
@@ -122,7 +122,8 @@
 								tal:attributes="class 'small {active} {errors}'.format(active='active' if repeat['tabform'].start() else '',
 																					   errors='state-error' if tabform.widgets.errors else '')">
 								<a data-toggle="tab"
-								   tal:attributes="href string:#${tabform.id}"
+								   tal:attributes="href string:#${tabform.id};
+												   data-ams-url python:getattr(tabform, 'tab_target', None);"
 								   tal:content="tabform.tab_label" i18n:translate="">Tab label</a>
 							</li>
 						</ul>
@@ -136,7 +137,7 @@
 					</div>
 				</fieldset>
 			</div>
-			<footer>
+			<footer tal:condition="view.actions and (view.is_dialog or (view.mode == 'input'))">
 				<button tal:repeat="action view.actions.values()"
 						tal:replace="structure action.render()">Action</button>
 			</footer>