Vue Comments: Comments ported to Vue + DnD fileupload

* Drag and drop files to comment editor to add a file attachment
* Using Vue to render comments

Since comments now has attachments we need to update the schemas
./manage.py maintenance replace_pillar_node_type_schemas
This commit is contained in:
2018-12-12 11:45:46 +01:00
parent 5bf1693d5b
commit 5f9406edd2
3 changed files with 7 additions and 23 deletions

View File

@@ -16,7 +16,6 @@ from pillar.web.utils import system_util, get_file, current_user_is_authenticate
from pillar.web.utils import attach_project_pictures
from pillar.web.settings import blueprint as blueprint_settings
from pillar.web.nodes.routes import url_for_node
from pillar.web.nodes.custom.comments import render_comments_for_node
from pillar.web.projects.routes import render_project
from pillar.web.projects.routes import find_project_or_404
@@ -60,6 +59,7 @@ def _homepage_context() -> dict:
'name': 1,
'node_type': 1,
'project': 1,
'parent': 1,
'properties.url': 1,
}},
api=api)
@@ -397,26 +397,6 @@ def emails_welcome_txt():
return flask.Response(txt, content_type='text/plain; charset=utf-8')
@blueprint.route('/nodes/<string(length=24):node_id>/comments')
def comments_for_node(node_id):
"""Overrides the default render_comments_for_node.
This is done in order to extend can_post_comments by requiring the
subscriber capability.
"""
api = system_util.pillar_api()
node = Node.find(node_id, api=api)
project = Project({'_id': node.project})
can_post_comments = project.node_type_has_method('comment', 'POST', api=api)
can_comment_override = flask.request.args.get('can_comment', 'True') == 'True'
can_post_comments = can_post_comments and can_comment_override and current_user.has_cap(
'subscriber')
return render_comments_for_node(node_id, can_post_comments=can_post_comments)
@blueprint.route('/p/hero')
def project_hero():
api = system_util.pillar_api()

View File

@@ -32,6 +32,8 @@ html(lang="en")
| {% endblock og %}
script(src="{{ url_for('static_pillar', filename='assets/js/tutti.min.js') }}")
script.
pillar.utils.initCurrentUser({{ current_user | json | safe }});
script(src="{{ url_for('static_pillar', filename='assets/js/timeline.min.js') }}")
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.typeahead-0.11.1.min.js')}}")
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/js.cookie-2.0.3.min.js')}}")
@@ -133,7 +135,6 @@ html(lang="en")
.nc-text
span.nc-date
a(href="")
| {% if current_user.is_authenticated %}
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/jquery.typewatch-3.0.0.min.js') }}")
script.

View File

@@ -41,7 +41,10 @@ include ../../../../../../pillar/src/templates/mixins/components
hr.my-4
#comments-embed.d-flex.justify-content-center.mx-auto
comments-tree#comments-embed.justify-content-center.mx-auto(
parent-id="{{ node._id }}"
read-only=false
)
| {% endmacro %}
//- ******************************************************* -//