Add preview feature for RST

This commit is contained in:
Sharoon Thomas 2012-09-26 11:10:19 +00:00
parent 2ced995bc8
commit 840aff6004
2 changed files with 18 additions and 2 deletions

View File

@ -277,6 +277,13 @@ class Project(ModelSQL, ModelView):
projects = project_obj.browse(project_ids)
return render_template('project/home.jinja', projects=projects)
def rst_to_html(self):
"""
Return the response as rst converted to html
"""
text = request.form['text']
return render_template('project/rst_to_html.jinja', text=text)
def get_attachments(self, ids, name=None):
"""
Return all the attachments in the object
@ -1034,8 +1041,10 @@ class Project(ModelSQL, ModelView):
task_changes[attr] = request.form[attr]
new_assignee = request.form.get('assigned_to', None, int)
if new_assignee and \
(not task.assigned_to or new_assignee != task.assigned_to.id):
print new_assignee, request.form
if (new_assignee and \
(not task.assigned_to or new_assignee != task.assigned_to.id)) \
or (request.form.get('assigned_to', None) == ""): # Clear the user
history_data['previous_assigned_to'] = task.assigned_to and task.assigned_to.id or None
history_data['new_assigned_to'] = new_assignee
task_changes['assigned_to'] = new_assignee

View File

@ -6,6 +6,13 @@
-->
<tryton>
<data>
<record id="rst_to_html" model="nereid.url_rule">
<field name="rule">/&lt;language&gt;/rst-to-html</field>
<field name="endpoint">project.work.rst_to_html</field>
<field name="methods">("POST",)</field>
<field name="sequence" eval="05" />
<field name="url_map" ref="nereid.default_url_map" />
</record>
<record id="project" model="nereid.url_rule">
<field name="rule">/&lt;language&gt;/project-&lt;int:project_id&gt;</field>
<field name="endpoint">project.work.render_project</field>