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"/>
<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"/>
<!-- <lineStyle kind="lineabove" 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"/>
</blockTableStyle>
<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"/>
<!-- <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"/>
</blockTableStyle>
<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"/>
<!-- <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"/>
</blockTableStyle>
</stylesheet>
@@ -65,8 +57,6 @@
<drawString x="265" y="746">info@nottinghamtec.co.uk</drawString>
<drawString x="137" y="732">Phone: (0115) 846 8720</drawString>
<setFont name="OpenSans" size="10" />
{% 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>
@@ -81,7 +71,7 @@
<image file="RIGS/static/imgs/paperwork/corner-bl.jpg" x="0" y="0" height="200" width="200"/>
<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>
</pageGraphics>
<frame id="main" x1="50" y1="65" width="495" height="727"/>
@@ -89,7 +79,6 @@
</template>
<story firstPageTemplate="Headed">
Hello this is some text
{% include "rigForms/form_print_page.xml" %}
</story>

View File

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

View File

@@ -91,27 +91,6 @@ class FormList(generic.ListView):
class FormPrint(generic.TemplateView):
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):
# Render all the child form bits first
children=[]
@@ -136,6 +115,27 @@ class FormPrint(generic.TemplateView):
}
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):
template = get_template('rigForms/print/render-boolean.xml')
context = {