Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch2 #164

Merged
merged 4 commits into from
Jun 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bugheist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
url(r'^upload/(?P<time>[^/]+)/(?P<hash>[^/]+)/', UploadCreate.as_view(), name="upload"),
url(r'^profile/(?P<slug>[^/]+)/$', UserProfileDetailView.as_view(), name="profile"),
url(r'^domain/(?P<slug>[^/]+)/$', DomainDetailView.as_view(), name="domain"),
url(r'^domain/(?P<slug>[^/]+)/(?P<choice>\ball\b|\bopen\b|\bclosed\b)$', DomainDetailView.as_view(), name="domain"),
url(r'^email/(?P<slug>[^/]+)/$', EmailDetailView.as_view(), name="email"),
url(r'^.well-known/acme-challenge/(?P<token>[^/]+)/$', website.views.find_key, name="find_key"),
url(r'^accounts/profile/', website.views.profile),
Expand Down
63 changes: 37 additions & 26 deletions website/templates/domain.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends "base.html" %}
{% load issue_type %}
{% load staticfiles %}
{% load gravatar %}
{% load email_obfuscator %}
Expand Down Expand Up @@ -67,37 +68,47 @@
<div class="col-lg-9">
<div class="panel panel-default">
<div class="panel-heading">
Latest Issues
<a href="all" style="padding: 0px 20px;" >ALL({{ total_issues }})</a>
<a href="open" style="padding: 0px 20px;" >OPEN({{ total_open }})</a>
<a href="closed" style="padding: 0px 20px;" >CLOSED({{ total_closed }})</a>
</div>
<div class="panel-body">
<div class="list-group" >
<div class="list-group" >
{% for activity in issues %}
<div class="list-group-item" style="height:96px; overflow:hidden;">
<div style=" overflow:hidden; float:left;width:800px; " >
<div style="float:left;margin-right:10px">
{% if activity.user.socialaccount_set.all.0.get_avatar_url %}
<img src="{{activity.user.socialaccount_set.all.0.get_avatar_url}}" width="50" height="50">
{% else %}
{% gravatar activity.user.email 50 %}
{% endif %}
{% if issue_choice == "all" %}
{% define issue_choice as condition %}
{% else %}
{% define activity.status as condition %}
{% endif %}

{% if condition == issue_choice %}
<div class="list-group-item" style="height:96px; overflow:hidden;">
<div style=" overflow:hidden; float:left;width:800px; " >
<div style="float:left;margin-right:10px">
{% if activity.user.socialaccount_set.all.0.get_avatar_url %}
<img src="{{activity.user.socialaccount_set.all.0.get_avatar_url}}" width="50" height="50">
{% else %}
{% gravatar activity.user.email 50 %}
{% endif %}
</div>
{{ activity.user.username }} entered issue
<a href="{{ activity.get_absolute_url }}">
<img src="http://{{activity.hostname_domain}}/favicon.ico" height="16" onerror="this.onerror=null; this.style.display ='none';">
{{ activity.domain_title }} - {{ activity }}
</a>
</div>
<div style="float:right;">
<span class=" text-muted small" style="float:right; height:77px; overflow:hidden;">
<em>{{ activity.created|timesince }} ago</em></br>
{% if activity.screenshot %}
<a href="{{ activity.get_absolute_url }}">
<img src="{{ activity.screenshot.url }}" width="100" style="float:right;" >
</a>
{% endif %}
</span>
</div>
{{ activity.user.username }} entered issue
<a href="{{ activity.get_absolute_url }}">
<img src="http://{{activity.hostname_domain}}/favicon.ico" height="16" onerror="this.onerror=null; this.style.display ='none';">
{{ activity.domain_title }} - {{ activity }}
</a>
</div>
<div style="float:right;">
<span class=" text-muted small" style="float:right; height:77px; overflow:hidden;">
<em>{{ activity.created|timesince }} ago</em></br>
{% if activity.screenshot %}
<a href="{{ activity.get_absolute_url }}">
<img src="{{ activity.screenshot.url }}" width="100" style="float:right;" >
</a>
{% endif %}
</span>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions website/templatetags/issue_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django import template

register = template.Library()


@register.simple_tag
def define(the_string):
return the_string
8 changes: 6 additions & 2 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,16 @@ def get_context_data(self, *args, **kwargs):

try:
context['domain'] = Domain.objects.get(name=self.kwargs['slug'])
context['issue_choice'] = self.kwargs['choice']
except:
context['domain'] = self.kwargs['slug']
context['issue_choice'] = "all"
context['issues'] = Issue.objects.filter(domain__name__contains=self.kwargs['slug'])
context['leaderboard'] = User.objects.filter(issue__url__contains=self.kwargs['slug']).annotate(total=Count('issue')).order_by('-total')
context['total_issues'] = Issue.objects.filter(domain__name__contains=self.kwargs['slug']).count()
context['total_open'] = Issue.objects.filter(domain__name__contains=self.kwargs['slug']).filter(status="open").count()
context['total_closed'] = Issue.objects.filter(domain__name__contains=self.kwargs['slug']).filter(status="closed").count()

return context


Expand Down Expand Up @@ -630,5 +636,3 @@ def form_valid(self, form):
return HttpResponseRedirect(self.success_url)