Skip to content

Commit

Permalink
Merge branch 'main' into fix_like_in_new_page
Browse files Browse the repository at this point in the history
  • Loading branch information
JisanAR03 authored Dec 10, 2023
2 parents 961f7ba + a56f332 commit 9ea3bdb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
5 changes: 2 additions & 3 deletions website/templates/base_new.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Inter' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Barlow:500;600;700' rel='stylesheet'>
<link href="https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@600&display=swap" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Barlow:500' rel='stylesheet'>
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans" rel="stylesheet">
<link href="{% static 'css/main.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/text-slider.css' %}" rel="stylesheet" type="text/css">
Expand All @@ -61,7 +60,7 @@

</head>

<body class="relative min-h-[100vh] flex flex-col bg-[#F7F7F7] font-['Inter']">
<body class="relative min-h-[100vh] flex flex-col bg-[#F7F7F7] font-['Ubuntu']">

{% comment %} navigation {% endcomment %}
{% include "includes/header.html" %}
Expand Down
23 changes: 23 additions & 0 deletions website/templates/new_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,27 @@
{% include '_bug.html' %}
{% endfor %}
</div>
<div class="col-md-12">
<div class="text-center">
{% if bugs.has_previous %}
<a href="?page=1{% if user %}&user={{ user }}{% endif %}{% if label %}&label={{ label }}{% endif %}"
class="btn btn-default">First</a>
{% else %}
<button class="btn btn-default" disabled>First</button>
{% endif %}
{% for num in bugs.paginator.page_range %}
{% if num == bugs.number %}
<button class="btn btn-default" disabled>{{num}}</button>
{% elif num > bugs.number|add:"-5" and num < bugs.number|add:"5" %}
<a href="?page={{ num }}{% if user %}&user={{ user }}{% endif %}{% if label %}&label={{ label }}{% endif %}" class="btn btn-default">{{num}}</a>
{% endif %}
{% endfor %}
{% if bugs.has_next %}
<a href="?page={{ bugs.paginator.num_pages }}{% if user %}&user={{ user }}{% endif %}{% if label %}&label={{ label }}{% endif %}" class="btn btn-default">Last</a>
{% else %}
<button class="btn btn-default" disabled>Last</button>
{% endif %}
<div>Page {{ bugs.number }} of {{ bugs.paginator.num_pages }}</div>
</div>
</div>
{% endblock %}
8 changes: 6 additions & 2 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,16 @@ def newhome(request, template="new_home.html"):
except:
pass

bugs=Issue.objects.exclude(Q(is_hidden=True) & ~Q(user_id=request.user.id))
bugs=Issue.objects.exclude(Q(is_hidden=True) & ~Q(user_id=request.user.id)).all()
bugs_screenshots = {}

for bug in bugs:
bugs_screenshots[bug] = IssueScreenshot.objects.filter(issue=bug)[0:3]

paginator = Paginator(bugs, 7)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)

# latest_hunts_filter = request.GET.get("latest_hunts",None)

# bug_count = Issue.objects.all().count()
Expand Down Expand Up @@ -237,7 +241,7 @@ def newhome(request, template="new_home.html"):


context = {
"bugs": bugs,
"bugs": page_obj,
"bugs_screenshots" : bugs_screenshots,
# "server_url": request.build_absolute_uri('/'),
# "activities": activities,
Expand Down

0 comments on commit 9ea3bdb

Please sign in to comment.