mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +11:00
Don't display the compare button if the snippet has no replies. Fixes issue #6.
This commit is contained in:
parent
ca1e12596c
commit
d42a2d3c79
2 changed files with 6 additions and 0 deletions
|
@ -29,6 +29,10 @@ class Snippet(models.Model):
|
|||
def content_splitted(self):
|
||||
return self.content_highlighted.splitlines()
|
||||
|
||||
@property
|
||||
def is_single(self):
|
||||
return self.is_root_node() and not self.get_children()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.pk:
|
||||
self.published = datetime.datetime.now()
|
||||
|
|
|
@ -52,7 +52,9 @@
|
|||
{% if snippet.pk|in_list:request.session.snippet_list %}
|
||||
<a class="btn" href="{% url "snippet_delete" snippet.secret_id %}" onclick="return confirm('{% trans "Really delete this snippet?" %}');"><i class="icon-trash"></i> {% trans "Delete Now" %}</a>
|
||||
{% endif %}
|
||||
{% if not snippet.is_single %}
|
||||
<a class="btn snippet-diff-trigger" href="#snippet-diff"><i class="icon-search"></i> {% trans "Compare Snippets" %}</a>
|
||||
{% endif %}
|
||||
<a class="btn" href="{% url "snippet_details_raw" snippet.secret_id %}"><i class="icon-align-left"></i> {% trans "View Raw" %}</a>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue