Flat comments for CMS ella utilizing redis for speed.
Master branch: |
---|
Flat comments for CMS ella utilizing redis for speed.
There does not appear to be an URL pattern to allow users to reply to an existing comment it currently exists in ella-comments here: https://github.com/ella/ella-comments/blob/master/ella_comments/urls.py#L13
Not a huge deal because we can just update our templates accordingly, but the comment-update
url name has been modified in ella-flatcomments
.
The URL in Ella Comments:
url(r'^%s/(?P<comment_id>\d+)/$' % slugify(_('update')), update_comment, name='comments-update'),
The URL in Ella FlatComments:
url(r'^(?P<comment_id>\d+)/%s/$' % slugify(_('update')), post_comment, name='comment-update')
Note the difference between comments-update
and comment-update
. I personally like comment-update
better, but others using this library might not like the lack of backwards compatibility.
Keep me posted on whether or not this gets changed as we'll have to modify templates on our end to match the url name :)
It would be nice to be able to specify a template_name
with the post data when calling ella_flatcomments.views.post_comment() => ella_flatcomments.views.get_template()
in order to override the default template returned on a per request basis.
Currently, the only way to override the template is to attach a get_templates()
method to the object that the comment is associated to.
Use Case: I have an issue in which a Publishable can be rendered in two places (in the forums and via its regular object detail view). We use different templates to render comments in each place. Assigning a get_templates()
method to my Publishable won't solve this because the template that is to be returned needs to be dynamic based on where the request is coming from. Ie: If the comment is made in the forums, render the forum comment template. If the comment is made on the object detail page, render the regular comment template.
Proposal:
Pass the request object to get_templates()
:
ella_flatcomments/views.py:
def get_template(name, request, obj=None, async=False):
if request.POST.get('template_name', None):
return request.POST.get('template_name')
if async:
name = '%s_async.%s' % tuple(name.rsplit('.', 1))
if hasattr(obj, 'get_templates'):
return obj.get_templates(name)
return get_templates_from_publishable(name, obj)
I don't mind creating a pull request if you feel this a reasonable feature enhancement. If there is another way to accomplish this, please let me know.
Looks like updating (editing) a comment results in a new comment getting posted and the old comment not being modified.
Screencast of the Issue:
http://cl.ly/1a36183p2G1b
Posting a new comment (via ajax) returns not only the newly posted comment, but the entire list of comments for the content object.
Screencast: http://cl.ly/3v2I3g0H3T3z
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.