Mercurial > agora-palash
changeset 196:134f726fd62c
Removed extrawhitespaces and moved comments template files to templates folder
author | Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com> |
---|---|
date | Thu, 04 Jul 2013 15:45:50 +0500 |
parents | baf8776dc44d |
children | 1341435d4d33 |
files | apps/treecomments/forms.py apps/treecomments/models.py apps/treecomments/views.py comments/form.html comments/list.html comments/rawcomment.html static/css/agora.less static/js/agora.js templates/comments/form.html templates/comments/list.html templates/comments/rawcomment.html templates/snippet/snippet_details.djhtml |
diffstat | 12 files changed, 89 insertions(+), 112 deletions(-) [+] |
line wrap: on
line diff
--- a/apps/treecomments/forms.py Tue Jul 02 02:09:21 2013 +0500 +++ b/apps/treecomments/forms.py Thu Jul 04 15:45:50 2013 +0500 @@ -5,11 +5,9 @@ class TreeCommentsForm(CommentForm): parent = forms.ModelChoiceField(queryset=TreeComments.objects.all(), required=False, widget=forms.HiddenInput) - def get_comment_model(self): return TreeComments - def get_comment_create_data(self): data = super(TreeCommentsForm,self).get_comment_create_data() data['parent'] = self.cleaned_data['parent'] - return data \ No newline at end of file + return data \ No newline at end of file
--- a/apps/treecomments/models.py Tue Jul 02 02:09:21 2013 +0500 +++ b/apps/treecomments/models.py Thu Jul 04 15:45:50 2013 +0500 @@ -1,6 +1,6 @@ from django.contrib.comments.models import Comment from mptt.models import MPTTModel, TreeForeignKey -# Create your models here. + class TreeComments(MPTTModel,Comment):
--- a/apps/treecomments/views.py Tue Jul 02 02:09:21 2013 +0500 +++ b/apps/treecomments/views.py Thu Jul 04 15:45:50 2013 +0500 @@ -1,1 +0,0 @@ -# Create your views here.
--- a/comments/form.html Tue Jul 02 02:09:21 2013 +0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -{% load comments i18n %} - - -<form action="{% comment_form_target %}" method="post"> - {% csrf_token %} - {{ form.object_pk }} - {{ form.content_type }} - {{ form.timestamp }} - {{ form.security_hash }} - {# if it is has a parent #} - - {% if node.id %} - <input type="hidden" name="parent" id="parent_id" value="{{ node.id }}" /> - <input type = 'button' value = "Reply" onClick= "$(this).ShowCommentForm({{ node.id }})" id = "{{ node.id }}-button" - class = "reply-button"/> - - {% endif %} - <!-- I have used node id over here so that I can show/hide comment field --> - <div class = "comment-box" style="{% if node.id %}display:none {% else %} display:block {%endif%}" id = "{{ node.id }}" > - <h4> - {%if node.id%} - Reply: - {%else%} Comment: - {%endif%} - </h4> - {{form.comment}} - - <br/> - <input type="submit" value = "Submit" class = 'reply-button' > - </div> - - - -</form>
--- a/comments/list.html Tue Jul 02 02:09:21 2013 +0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -Override -<dl id="comments"> - {% for comment in comment_list %} - <dt id="c{{ comment.id }}"> - {{ comment.submit_date }} - {{ comment.name }} - </dt> - <dt> {{ comment.user_name }} </dt> - <dt> {{ comment.ip_address }} </dt> - <dt> {{ comment.user_email }} </dt> - <dd> - <p>{{ comment.user_url }}</p> - </dd> - {% endfor %} -</dl>
--- a/comments/rawcomment.html Tue Jul 02 02:09:21 2013 +0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -{% load comments %} -{% load mptt_tags %} -<div id = "comment"> - - - -{% if user.is_authenticated %} - - -{% render_comment_form for object %} - -{% get_comment_list for object as comments %} - -{% if comments %} -{% recursetree comments %} - <a name = "c{{ node.id }}"> </a> - <!-- {{ node.id }} --> - <div class = "comment-node"> - - <p class = "comment-bar"><a href = "{{ object.get_absolute_url }}#c{{ node.id }}"><strong>{{ node.user }} </strong> · {{ node.submit_date|timesince }} ago </a> </p> - <p class = "comment"><p class = "comment-body"> {{ node.comment }} </p> - - - - - - {% render_comment_form for object %} -</div> - {# recursion tree logic #} - {% if not node.is_leaf_node %} - <div class = "comment-node-child"> - {{ children }} -</div> - {% endif %} - -{% endrecursetree %} -{% endif%} - -{% else %} - <h4>You need to be logged in to see comments</h4> - -{% endif%} - -</div> \ No newline at end of file
--- a/static/css/agora.less Tue Jul 02 02:09:21 2013 +0500 +++ b/static/css/agora.less Thu Jul 04 15:45:50 2013 +0500 @@ -433,7 +433,6 @@ max-width:700px; border-left: 1px solid #e8e8e8; margin: 5px; - } #comment-box {
--- a/static/js/agora.js Tue Jul 02 02:09:21 2013 +0500 +++ b/static/js/agora.js Thu Jul 04 15:45:50 2013 +0500 @@ -40,9 +40,6 @@ $.fn.ShowCommentForm = function(id){ $(this).hide(); $('#' + id).show(); - - - }; $(document).ready(function () { @@ -83,10 +80,5 @@ currentStyle = newStyle; }); }); - - - } -)(jQuery); - - +)(jQuery); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/comments/form.html Thu Jul 04 15:45:50 2013 +0500 @@ -0,0 +1,31 @@ +{% load comments i18n %} + + +<form action="{% comment_form_target %}" method="post"> + {% csrf_token %} + {{ form.object_pk }} + {{ form.content_type }} + {{ form.timestamp }} + {{ form.security_hash }} + {# if it is has a parent #} + + {% if node.id %} + <input type="hidden" name="parent" id="parent_id" value="{{ node.id }}" /> + <input type = 'button' value = "Reply" onClick= "$(this).ShowCommentForm({{ node.id }})" id = "{{ node.id }}-button" + class = "reply-button"/> + + {% endif %} + <!-- I have used node id over here so that I can show/hide comment field --> + <div class = "comment-box" style="{% if node.id %}display:none {% else %} display:block {%endif%}" id = "{{ node.id }}" > + <h4> + {%if node.id%} + Reply: + {%else%} Comment: + {%endif%} + </h4> + {{form.comment}} + + <br/> + <input type="submit" value = "Submit" class = 'reply-button' > + </div> + </form> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/comments/list.html Thu Jul 04 15:45:50 2013 +0500 @@ -0,0 +1,14 @@ +Override +<dl id="comments"> + {% for comment in comment_list %} + <dt id="c{{ comment.id }}"> + {{ comment.submit_date }} - {{ comment.name }} + </dt> + <dt> {{ comment.user_name }} </dt> + <dt> {{ comment.ip_address }} </dt> + <dt> {{ comment.user_email }} </dt> + <dd> + <p>{{ comment.user_url }}</p> + </dd> + {% endfor %} +</dl>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/comments/rawcomment.html Thu Jul 04 15:45:50 2013 +0500 @@ -0,0 +1,39 @@ +{% load comments %} +{% load mptt_tags %} +<div id = "comment"> + + + +{% if user.is_authenticated %} + + +{% render_comment_form for object %} + +{% get_comment_list for object as comments %} + +{% if comments %} +{% recursetree comments %} + <a name = "c{{ node.id }}"> </a> + <!-- {{ node.id }} --> + <div class = "comment-node"> + + <p class = "comment-bar"><a href = "{{ object.get_absolute_url }}#c{{ node.id }}"><strong>{{ node.user }} </strong> · {{ node.submit_date|timesince }} ago </a> </p> + <p class = "comment"><p class = "comment-body"> {{ node.comment }} </p> + {% render_comment_form for object %} +</div> + {# recursion tree logic #} + {% if not node.is_leaf_node %} + <div class = "comment-node-child"> + {{ children }} +</div> + {% endif %} + +{% endrecursetree %} +{% endif%} + +{% else %} + <h4>You need to be logged in to see comments</h4> + +{% endif%} + +</div> \ No newline at end of file
--- a/templates/snippet/snippet_details.djhtml Tue Jul 02 02:09:21 2013 +0500 +++ b/templates/snippet/snippet_details.djhtml Thu Jul 04 15:45:50 2013 +0500 @@ -81,9 +81,7 @@ {% include "snippet/snippet_box.djhtml" with lines=snippet.content_splitted %} <br /> - <h2> Comments for this snippet: </h2> - -{% with snippet as object %}{% include "comments/rawcomment.html" %}{% endwith %}. + <h2> Comments for this snippet: </h2>{% with snippet as object %}{% include "comments/rawcomment.html" %}{% endwith %}. <h2 id="revise">{% trans "Revise this snippet" %}</h2> @@ -175,5 +173,4 @@ <script type="text/javascript"> {%include "snippet/snippet_details.js" %} </script> -{% endblock script_footer %} - \ No newline at end of file +{% endblock script_footer %} \ No newline at end of file