More tidying of code & templates

This commit is contained in:
David Taylor
2015-08-10 15:24:03 +03:00
committed by Tom Price
parent b3cf0b39ac
commit 58e06c1b3e
3 changed files with 23 additions and 33 deletions

View File

@@ -24,25 +24,17 @@
<paraStyle name="center" alignment="center"/> <paraStyle name="center" alignment="center"/>
<blockTableStyle id="checkboxTable"> <blockTableStyle id="checkboxTable">
<!-- <lineStyle cap="default" kind="grid" colorName="black" thickness="1" start="0,0" stop="-1,-1"/> -->
<blockValign start="0,0" stop="-1,-1" value="top"/> <blockValign start="0,0" stop="-1,-1" value="top"/>
<!-- <lineStyle kind="lineabove" start="1,0" stop="-1,-1" colorName="lightgrey"/> -->
<lineStyle kind="linebelow" start="1,0" stop="-1,-1" colorName="lightgrey"/> <lineStyle kind="linebelow" start="1,0" stop="-1,-1" colorName="lightgrey"/>
<blockLeftPadding start="0,0" stop="-1,-1" length="0"/> <blockLeftPadding start="0,0" stop="-1,-1" length="0"/>
</blockTableStyle> </blockTableStyle>
<blockTableStyle id="stringTable"> <blockTableStyle id="stringTable">
<!-- <lineStyle cap="default" kind="grid" colorName="black" thickness="1" start="0,0" stop="-1,-1"/> -->
<blockValign start="0,0" stop="-1,-1" value="top"/> <blockValign start="0,0" stop="-1,-1" value="top"/>
<!-- <blockLeftPadding start="0,0" stop="-1,-1" length="0"/> -->
<!-- <lineStyle kind="lineabove" start="1,0" stop="-1,-1" colorName="lightgrey"/> -->
<lineStyle kind="linebelow" start="1,0" stop="-1,-1" colorName="lightgrey"/> <lineStyle kind="linebelow" start="1,0" stop="-1,-1" colorName="lightgrey"/>
</blockTableStyle> </blockTableStyle>
<blockTableStyle id="objectTable"> <blockTableStyle id="objectTable">
<!-- <lineStyle cap="default" kind="grid" colorName="black" thickness="1" start="0,0" stop="-1,-1"/> -->
<blockValign start="0,0" stop="-1,-1" value="top"/> <blockValign start="0,0" stop="-1,-1" value="top"/>
<!-- <blockLeftPadding start="0,0" stop="-1,-1" length="0"/> -->
<!-- <lineStyle kind="lineabove" start="1,0" stop="-1,-1" colorName="lightgrey"/> -->
<lineStyle kind="linebelow" start="1,0" stop="-1,-1" colorName="lightgrey"/> <lineStyle kind="linebelow" start="1,0" stop="-1,-1" colorName="lightgrey"/>
</blockTableStyle> </blockTableStyle>
</stylesheet> </stylesheet>
@@ -65,8 +57,6 @@
<drawString x="265" y="746">info@nottinghamtec.co.uk</drawString> <drawString x="265" y="746">info@nottinghamtec.co.uk</drawString>
<drawString x="137" y="732">Phone: (0115) 846 8720</drawString> <drawString x="137" y="732">Phone: (0115) 846 8720</drawString>
<setFont name="OpenSans" size="10" /> <setFont name="OpenSans" size="10" />
{% if copy %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %} {% if copy %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %}
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString> <drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
@@ -81,7 +71,7 @@
<image file="RIGS/static/imgs/paperwork/corner-bl.jpg" x="0" y="0" height="200" width="200"/> <image file="RIGS/static/imgs/paperwork/corner-bl.jpg" x="0" y="0" height="200" width="200"/>
<setFont name="OpenSans" size="10"/> <setFont name="OpenSans" size="10"/>
{% if not invoice %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %} {% if copy %}<drawCenteredString x="302.5" y="50">[{{ copy }} Copy]</drawCenteredString>{% endif %}
<drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString> <drawCenteredString x="302.5" y="38">[Page <pageNumber/> of <getName id="lastPage" default="0" />]</drawCenteredString>
</pageGraphics> </pageGraphics>
<frame id="main" x1="50" y1="65" width="495" height="727"/> <frame id="main" x1="50" y1="65" width="495" height="727"/>
@@ -89,7 +79,6 @@
</template> </template>
<story firstPageTemplate="Headed"> <story firstPageTemplate="Headed">
Hello this is some text
{% include "rigForms/form_print_page.xml" %} {% include "rigForms/form_print_page.xml" %}
</story> </story>

View File

@@ -1,5 +1,6 @@
<setNextFrame name="main"/> <setNextFrame name="main"/>
<nextFrame/> <nextFrame/>
<setNextTemplate name="Main"/>
<h1><b>{{ form.schema.schema_type.name }}</b><small></small></h1> <h1><b>{{ form.schema.schema_type.name }}</b><small></small></h1>
<spacer length="10"/> <spacer length="10"/>

View File

@@ -91,27 +91,6 @@ class FormList(generic.ListView):
class FormPrint(generic.TemplateView): class FormPrint(generic.TemplateView):
indentBy = 20 indentBy = 20
def _render_object(self, field, value, current_indent):
# Render all the child form bits first
children = self._render_field(field["properties"], value, current_indent + self.indentBy)
template = get_template('rigForms/print/render-object.xml')
context = {
'field': field,
'children': children,
'currentIndent':current_indent
}
return template.render(context)
def _render_string(self, field, value, current_indent):
template = get_template('rigForms/print/render-string.xml')
context = {
'field': field,
'currentIndent':current_indent,
'value':value
}
return template.render(context)
def _render_array(self, field, value, current_indent): def _render_array(self, field, value, current_indent):
# Render all the child form bits first # Render all the child form bits first
children=[] children=[]
@@ -136,6 +115,27 @@ class FormPrint(generic.TemplateView):
} }
return template.render(context) return template.render(context)
def _render_object(self, field, value, current_indent):
# Render all the child form bits first
children = self._render_field(field["properties"], value, current_indent + self.indentBy)
template = get_template('rigForms/print/render-object.xml')
context = {
'field': field,
'children': children,
'currentIndent':current_indent
}
return template.render(context)
def _render_string(self, field, value, current_indent):
template = get_template('rigForms/print/render-string.xml')
context = {
'field': field,
'currentIndent':current_indent,
'value':value
}
return template.render(context)
def _render_boolean(self, field, value, current_indent): def _render_boolean(self, field, value, current_indent):
template = get_template('rigForms/print/render-boolean.xml') template = get_template('rigForms/print/render-boolean.xml')
context = { context = {