Add preview feature for RST
This commit is contained in:
parent
2ced995bc8
commit
840aff6004
13
project.py
13
project.py
|
@ -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
|
||||
|
|
7
urls.xml
7
urls.xml
|
@ -6,6 +6,13 @@
|
|||
-->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="rst_to_html" model="nereid.url_rule">
|
||||
<field name="rule">/<language>/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">/<language>/project-<int:project_id></field>
|
||||
<field name="endpoint">project.work.render_project</field>
|
||||
|
|
Loading…
Reference in New Issue