Coder Social home page Coder Social logo

ella-flatcomments's Introduction

Ella Flat Comment

Flat comments for CMS ella utilizing redis for speed.

Build status

Master branch:Travis CI - Distributed build platform for the open source community

ella-flatcomments's People

Contributors

honzakral avatar kvbik avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ella-flatcomments's Issues

Update Comment URL Name Change

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 :)

Supply A Template Name When Posting a New Comment

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.