Skip to content

Commit

Permalink
Merge pull request #180 from Gprakhar141/feature/filter_issues_by_dif…
Browse files Browse the repository at this point in the history
…ficulty_level

feature/filter issues by difficulty level
  • Loading branch information
meisabhishekpatel authored Oct 19, 2024
2 parents 4496403 + da5d30d commit 464c12f
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 193 deletions.
296 changes: 144 additions & 152 deletions home/templates/dashboard/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,176 +3,168 @@
<style>
.dropdown-menu li {
position: relative;
}
.dropdown-menu .dropdown-submenu {
}

.dropdown-menu .dropdown-submenu {
display: none;
position: absolute;
left: 100%;
top: -7px;
}
.dropdown-menu .dropdown-submenu-left {
margin-top: 5;
}

.dropdown-menu .dropdown-submenu-left {
right: 100%;
left: auto;
}
.dropdown-menu > li:hover > .dropdown-submenu {
}

.dropdown-menu > li:hover > .dropdown-submenu {
display: block;
}
}
</style>
<nav class="navbar navbar-expand-lg navbar-light bg-transparent">
<!-- Container wrapper -->
<div class="container-fluid">
<!-- Toggle button -->
<button
class="navbar-toggler"
type="button"
data-mdb-toggle="collapse"
data-mdb-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<i class="fas fa-bars"></i>
</button>

<!-- Collapsible wrapper -->
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse" data-mdb-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Navbar brand -->
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<img src="{% static 'images/logo/logo.png' %}" height="45" alt="" loading="lazy"/>
<a class="navbar-brand mt-2 mt-lg-0" href="#">
<img src="{% static 'images/logo/logo.png' %}" height="45" alt="" loading="lazy" />
</a>
<strong>
<a class="navbar-brand text-success mt-2 mt-lg-0" href="{% url 'home' %}">
<b>ContriHUB</b>
</a>
<strong>
<a class="navbar-brand text-success mt-2 mt-lg-0" href="{% url 'home' %}">
<b>ContriHUB</b>
</strong>
<div class="d-flex align-items-center">
<a class="nav-link" href="../#about" target="_blank">
<button type="button" class="btn btn-secondary btn-rounded" data-mdb-ripple-color="dark">
Rules
</button>
</a>
</div>
{% if user.is_authenticated %}
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="{% url 'rankings' %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
Ranking
</button>
</a>
</strong>
<div class="d-flex align-items-center">
<a class="nav-link" href="../#about" target="_blank">
<button type="button" class="btn btn-secondary btn-rounded" data-mdb-ripple-color="dark">
Rules
</button>
</a>
</div>

<!-- Left links -->

{% if user.is_authenticated %}
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="{% url 'rankings' %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
Ranking
</button>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'user_profile' user.username %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
User Profile
</button>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'user_profile' user.username %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
User Profile
</button>
</a>
</li>
<li class="nav-item dropdown">
<div class="dropdown nav-item nav-link">
<button class="btn btn-primary btn-rounded dropdown-toggle" type="button" id="dropdownMenuButton"
data-mdb-toggle="dropdown" aria-expanded="false">
All Projects
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
{% for project in projects %}
<li style="width: 500px">
<span class="dropdown-item-text">
<button type="button" class="btn btn-secondary p-1" data-mdb-ripple-color="dark">
<a class='text-white' href="{{ project.html_url }}" target="_blank">
<b>{{ project.name }}</b> [ {{ project.domain }} ]
</a>
</button>
</span>
</li>
{% endfor %}
</ul>
</div>
</li>
<li class="nav-item dropdown mt-2">
<button class="btn btn-primary btn-rounded dropdown-toggle" type="button" id="dropdownMenuButton"
data-mdb-toggle="dropdown" aria-expanded="false">
Filter By
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li>
<a class="dropdown-item" href="#">
Difficulty &raquo;
<button type="button" disabled class="btn btn-danger btn-sm">{{ curr_difficulty }}</button>
</a>
<ul class="dropdown-menu dropdown-submenu">
<li><a class="dropdown-item" href="{% url 'filter_by_difficulty' 'All' %}">All</a></li>
<li><a class="dropdown-item" href="{% url 'filter_by_difficulty' 'Free' %}">Free</a></li>
<li><a class="dropdown-item" href="{% url 'filter_by_difficulty' 'Very-Easy' %}">Very-Easy</a></li>
<li><a class="dropdown-item" href="{% url 'filter_by_difficulty' 'Easy' %}">Easy</a></li>
<li><a class="dropdown-item" href="{% url 'filter_by_difficulty' 'Medium' %}">Medium</a></li>
<li><a class="dropdown-item" href="{% url 'filter_by_difficulty' 'Hard' %}">Hard</a></li>
</ul>
</li>
<li>
<a class="dropdown-item" href="#">
Domain &raquo; <button type="button" disabled class="btn btn-success btn-sm">{{ curr_domain }}</button>
</a>
<ul class="dropdown-menu dropdown-submenu">
<li>
<a class="dropdown-item" href="../../">
<input type="text" class="btn btn-small btn-success" value="All" data-filter="domain" />
</a>
</li>
<li class="nav-item dropdown">

<div class="dropdown nav-item nav-link">
<button class="btn btn-primary btn-rounded dropdown-toggle" type="button" id="dropdownMenuButton"
data-mdb-toggle="dropdown" aria-expanded="false">
All Projects
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
{% for project in projects %}
<li class="" style="width: 500px">
<span class="dropdown-item-text">
<button type="button" class="btn btn-secondary p-1" data-mdb-ripple-color="dark">
<a class='text-white' href="{{ project.html_url }}" target="_blank"> {# style="color: white" #}
<b>{{ project.name }}</b> [ {{ project.domain }} ]
</a>
</button>
</span>
</li>
{% endfor %}
</ul>
</div>
</li>
<li class="nav-item dropdown mt-2">
<button class="btn btn-primary btn-rounded dropdown-toggle" type="button" id="dropdownMenuButton"
data-mdb-toggle="dropdown" aria-expanded="false">
Filter By
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li>
<a class="dropdown-item" href="#">
Domain &raquo; <button type="button" disabled class="btn btn-success btn-sm">{{ curr_domain }}</button>
</a>
<ul class="dropdown-menu dropdown-submenu">
<li>
<a class="dropdown-item" href="../../">
<input type=input class="btn btn-small btn-success" value="All" data-filter="domain"
/>
</a>
</li>
{% for domain in domains %}
<li>
<a class="dropdown-item" href="{% url 'filter_by_domain' domain.pk %}">
<input type=input class="btn btn-small btn-outline-success" value="{{ domain }}" data-filter="domain"
/>
</a>
</li>
{% endfor %}
</ul>
</li>
<li>
<a class="dropdown-item" href="#">
SubDomain &raquo; <button type="button" disabled class="btn btn-danger btn-sm">{{ curr_subdomain }}</button>
</a>
<ul class="dropdown-menu dropdown-submenu">
<li>
<a class="dropdown-item" href="../../">
<input type=input class="btn btn-small btn-danger" value="All" data-filter="domain"
/>
</a>
</li>
{% for subdomain in subdomains %}
<li>
<a class="dropdown-item" href="{% url 'filter_by_subdomain' subdomain.pk %}">
<input type=input class="btn btn-outline-danger" value="{{ subdomain }}" data-filter="subdomain"
/>
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'contact_form' %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
Contact Us
</button>
</a>
{% for domain in domains %}
<li>
<a class="dropdown-item" href="{% url 'filter_by_domain' domain.pk %}">
<input type="text" class="btn btn-small btn-outline-success" value="{{ domain }}" data-filter="domain" />
</a>
</li>
</ul>
{% endif %}
{% endfor %}
</ul>
</li>
<li>
<a class="dropdown-item" href="#">
SubDomain &raquo; <button type="button" disabled class="btn btn-danger btn-sm">{{ curr_subdomain }}</button>
</a>
<ul class="dropdown-menu dropdown-submenu">
<li>
<a class="dropdown-item" href="../../">
<input type="text" class="btn btn-small btn-danger" value="All" data-filter="domain" />
</a>
</li>
{% for subdomain in subdomains %}
<li>
<a class="dropdown-item" href="{% url 'filter_by_subdomain' subdomain.pk %}">
<input type="text" class="btn btn-outline-danger" value="{{ subdomain }}" data-filter="subdomain" />
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'contact_form' %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
Contact Us
</button>
</a>
</li>
</ul>
{% endif %}
</div>
<!-- Right elements -->
<div class="d-flex align-items-center">
{% if not user.is_authenticated %}
<a class="nav-link" href="{% url 'authorize' %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
Authorize
</button>
</a>
{% else %}
<a class="nav-link" href="{% url 'logout' %}">
<button type="button" class="btn btn-danger btn-rounded" data-mdb-ripple-color="dark">
Logout
</button>
</a>
{% endif %}
{% if not user.is_authenticated %}
<a class="nav-link" href="{% url 'authorize' %}">
<button type="button" class="btn btn-primary btn-rounded" data-mdb-ripple-color="dark">
Authorize
</button>
</a>
{% else %}
<a class="nav-link" href="{% url 'logout' %}">
<button type="button" class="btn btn-danger btn-rounded" data-mdb-ripple-color="dark">
Logout
</button>
</a>
{% endif %}
</div>
<!-- Right elements -->

<!-- Collapsible wrapper -->
</div>
<!-- Container wrapper -->
</nav>
<!-- Navbar -->
25 changes: 16 additions & 9 deletions home/urls.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
from django.urls import path
from . import views


urlpatterns = [
path('', views.home, name='home'),
path('dashboard/', views.dashboard, name='dashboard'),
path('authorize/', views.authorize, name='authorize'),
path('logout/', views.logout_, name='logout'),
path('request_issue_assignment/<int:issue_pk>/', views.request_issue_assignment, name='request_issue_assignment'),
path('accept_issue_request/<int:issue_req_pk>/', views.accept_issue_request, name='accept_issue_request'),
path('reject_issue_request/<int:issue_req_pk>/', views.reject_issue_request, name='reject_issue_request'),
path('submit_pr_request/<int:active_issue_pk>/', views.submit_pr_request, name='submit_pr_request'),
path('request_issue_assignment/<int:issue_pk>/',
views.request_issue_assignment, name='request_issue_assignment'),
path('accept_issue_request/<int:issue_req_pk>/',
views.accept_issue_request, name='accept_issue_request'),
path('reject_issue_request/<int:issue_req_pk>/',
views.reject_issue_request, name='reject_issue_request'),
path('submit_pr_request/<int:active_issue_pk>/',
views.submit_pr_request, name='submit_pr_request'),
path('judge_pr/<int:pk>/', views.judge_pr, name='judge_pr'),
path('filter_by_domain/<int:domain_pk>/', views.filter_by_domain, name='filter_by_domain'),
path('filter_by_subdomain/<int:subdomain_pk>/', views.filter_by_subdomain, name='filter_by_subdomain'),
path('filter_by_domain/<int:domain_pk>/',
views.filter_by_domain, name='filter_by_domain'),
path('filter_by_subdomain/<int:subdomain_pk>/',
views.filter_by_subdomain, name='filter_by_subdomain'),
path('filter/difficulty/<str:difficulty_level>/',
views.filter_by_difficulty, name='filter_by_difficulty'),
path('contact/', views.contact_form, name='contact_form'),
path('like/<int:issue_pk>', views.likes, name='like_issue'),
path('dislike/<int:issue_pk>', views.dislikes, name='dislike_issue'),
path('like/<int:issue_pk>/', views.likes, name='like_issue'),
path('dislike/<int:issue_pk>/', views.dislikes, name='dislike_issue'),
]
Loading

0 comments on commit 464c12f

Please sign in to comment.