Skip to content

Commit

Permalink
rework zpt manage forms to use boostrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jhinghaus committed May 24, 2018
1 parent 2b16912 commit 4897e20
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 117 deletions.
67 changes: 29 additions & 38 deletions src/Products/PageTemplates/www/ptAdd.zpt
@@ -1,4 +1,7 @@
<h1 tal:replace="structure here/manage_page_header">Header</h1>

<main>

<h2 tal:define="form_title string:Add Page Template"
tal:replace="structure here/manage_form_title">Form Title</h2>

Expand All @@ -7,46 +10,34 @@ XML attributes to create dynamic templates. You may choose to upload
the template text from a local file by typing the file name or using
the <em>browse</em> button.</p>

<form action="manage_addPageTemplate" method="post"
enctype="multipart/form-data">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">Id</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">File</div>
</td>
<td align="left" valign="top">
<input type="file" name="file" size="25" value="" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">Encoding</div>
</td>
<td align="left" valign="top">
<input type="text" name="encoding" size="25" value="utf-8" />
<em>(only used for non-XML and non-HTML content)</em>
</td>
</tr>
<tr>
<td align="left" valign="top"></td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value=" Add " />
<input class="form-element" type="submit" name="submit"
<form action="manage_addPageTemplate" method="post"
enctype="multipart/form-data" class="zmi-zpt zmi-add">

<div class="form-group row">
<label for="id" class="form-label col-sm-2">Id</label>
<input id="id" class="form-control col-sm-9 col-md-6" type="text" name="id" size="40" />
</div>
<div class="form-group row">
<label for="file-data" class="form-label col-sm-2">File</label>
<input id="file-data" class="form-control-file col-sm-9 col-md-6" type="file" name="file" size="25" value="" />
</div>
<div class="form-group row">
<label for="encoding" class="form-label col-sm-2">Encoding</label>
<div class="col-sm-9 col-md-6">
<input id="encoding" class="form-control" type="text" name="encoding" size="25" value="utf-8" />
<small id="encodingHelp" class="form-text text-muted">only used for non-XML and non-HTML content</small>
</div>
</div>

<div class="controls">
<input class="btn btn-primary" type="submit" name="submit"
value=" Add " />
<input class="btn btn-primary" type="submit" name="submit"
value=" Add and Edit " />
</div>
</td>
</tr>
</table>

</form>

</main>

<h1 tal:replace="structure here/manage_page_footer">Footer</h1>
138 changes: 59 additions & 79 deletions src/Products/PageTemplates/www/ptEdit.zpt
Expand Up @@ -2,107 +2,87 @@
<h2 tal:define="manage_tabs_message options/manage_tabs_message | nothing"
tal:replace="structure context/manage_tabs">Tabs</h2>

<main>

<tal:block define="global body request/other/text | request/form/text
| context/read" />
<form action="" method="post" tal:attributes="action request/URL1">
<input type="hidden" name="encoding" value="utf-8" />
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="middle">
<div class="form-optional">Title</div>
</td>
<td align="left" valign="middle">
<input type="text" name="title" size="40"
| context/read" />

<form action="" method="post" tal:attributes="action request/URL1" class="zmi-zpt zmi-edit">
<input type="hidden" name="encoding" value="utf-8" />
<div class="form-group row">
<label for="title" class="form-label col-sm-1">Title</label>

<input id="title" class="form-control col-sm-4" type="text" name="title"
tal:attributes="value request/title | context/title" />
</td>
<td align="left" valign="middle">
<div class="form-label">Content-Type</div>
</td>
<td align="left" valign="middle">
<input type="text" name="content_type" size="14"
<label for="contenttype" class="form-label col-sm-3 offset-sm-1">Content Type</label>

<input id="contenttype" class="form-control col-sm-3" type="text" name="content_type"
tal:attributes="value request/content_type | context/content_type" />
</td>
</tr>
<tr>
<td align="left" valign="middle"></td>
<td align="left" valign="middle"></td>
<td align="left" valign="top" colspan="2">
<a href="source.html" tal:condition="context/html">Browse HTML source</a>
<a href="source.xml" tal:condition="not:context/html">Browse XML source</a>
<br />
<input type="hidden" name="expand:int:default" value="0" />
<input type="checkbox" value="1" name="expand:int"
</div>
<div class="row ">
<div class="col-sm-6 offset-sm-6">
<a href="source.html" tal:condition="context/html">Browse HTML source</a>
<a href="source.xml" tal:condition="not:context/html">Browse XML source</a>
</div>

<div class="col-sm-6 offset-sm-6">
<div class="form-group form-check">
<input type="hidden" name="expand:int:default" value="0" />
<input id="expand" class="form-check-input" type="checkbox" value="1" name="expand:int"
tal:attributes="checked request/expand | context/expand" />
Expand macros when editing
</td>
</tr>
<label for="expand" class="form-check-label">Expand macros when editing</label>
</div>
</div>
</div>

<tr tal:define="errors context/pt_errors" tal:condition="errors">
<td align="left" valign="middle" class="form-label">Errors</td>
<td align="left" valign="middle" style="background-color: #FFDDDD"
colspan="3">
<pre tal:content="python:'\n'.join(errors)">errors</pre>
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="4">
<textarea name="text:text" wrap="off" style="width: 100%;" rows="20"
<div tal:define="errors context/pt_errors" tal:condition="errors"
class="alert alert-danger" role="alert">
<pre tal:content="python:'\n'.join(errors)">errors</pre>
</div>

<textarea id="content" class="form-control zmi-zpt zmi-code col-sm-12" name="text:text" wrap="off" style="width: 100%;" rows="20"
tal:content="body">Template Body</textarea>
</td>
</tr>

<tr>
<td align="left" valign="top" colspan="4">
<div class="form-element">
<div class="controls mt-2">
<em tal:condition="context/wl_isLocked">Locked</em>
<input tal:condition="not:context/wl_isLocked"
class="form-element" type="submit"
class="btn btn-primary" type="submit"
name="pt_editAction:method" value="Save Changes"/>
&nbsp;&nbsp;
</div>
</td>
</tr>
</table>
</form>

<p class="form-help">You can upload the text for
<p class="form-help mt-5">You can upload the text for
<span tal:replace="context/title_and_id" /> using the following form.
Choose an existing HTML or XML file from your local computer by
clicking <em>browse</em>. You can also <a href="document_src">click
context</a> to view or download the current text.</p>

<form action="pt_upload" method="post" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">File &nbsp;</div>
</td>
<td align="left" valign="top">
<input type="file" name="file" size="40" value="" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">Encoding &nbsp;</div>
</td>
<td align="left" valign="top" colspan="2">
<input name="encoding" value="utf-8" />
</td>
<td align="left" valign="top" colspan="1">
<em>(only used for non-XML and non-XHTML content)</em>
</td>
</tr>
<tr>
<td></td>
<td align="left" valign="top">
<div class="form-element">
<form action="pt_upload" method="post" enctype="multipart/form-data" class="zmi-upload">

<div class="form-group row">
<label for="file-data" class="col-sm-3 col-md-2" class="form-label">
File
</label>
<div class="col-sm-9 col-md-6">
<input id="file-data" class="form-control-file" type="file" name="file" size="40" value="" />
</div>
</div>
<div class="form-group row">
<label for="encoding" class="form-label col-sm-2">Encoding</label>
<div class="col-sm-9 col-md-6">
<input id="encoding" class="form-control" name="encoding" value="utf-8" />
<small id="encodingHelp" class="form-text text-muted">only used for non-XML and non-HTML content</small>
</div>
</div>

<div class="controls">
<em tal:condition="context/wl_isLocked">Locked</em>
<input tal:condition="not:context/wl_isLocked"
class="form-element" type="submit" value="Upload File" />
class="btn btn-primary" type="submit" value="Upload File" />
</div>
</td>
</tr>
</table>
</form>

</main>

<h1 tal:replace="structure context/manage_page_footer">Footer</h1>

0 comments on commit 4897e20

Please sign in to comment.