Skip to content

Commit

Permalink
Add labels search
Browse files Browse the repository at this point in the history
  • Loading branch information
jajodiaraghav committed Jul 20, 2017
1 parent 14e1ca5 commit 62c8d1c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 53 deletions.
11 changes: 0 additions & 11 deletions website/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,6 @@ input[type='file'] {
#myFooter .fa-github:hover {
color: black;
}

.cardbox {
width: 20rem;
}

.cborder {
border-style: solid;
border-width: 1px;
padding-top: 15px;
border-radius: 5px;
margin-right: 25px;
margin-left: 25px;
margin-bottom: 10px;
}
50 changes: 30 additions & 20 deletions website/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ <h1 class="page-header">{% trans "Find Bugs, Win Points and Prizes" %}</h1>
<br>
</section>

<div class="container">
<center>
<div class="container">
<center>
<div class="row">
<div class="col-sm-3 cborder">
<div class="col-sm-4">
<div class="card cardbox">
<center><i class="fa fa-exclamation-triangle fa-3x"></i></center>
<div class="card-block">
Expand All @@ -35,10 +35,12 @@ <h4 class="card-title">{% trans "Number Error" %}</h4>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="/search/?query=Number+error&type=label">Examples</a></li>
<li class="list-group-item">
<a href="/search/?query=1&type=label">Examples</a>
</li>
</ul>
</div>
<div class="col-sm-3 cborder">
<div class="col-sm-4">
<div class="card cardbox">
<center><i class="fa fa-trophy fa-3x"></i></center>
<div class="card-block">
Expand All @@ -47,10 +49,12 @@ <h4 class="card-title">{% trans "Functional" %}</h4>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="/search/?query=Functional&type=label">Examples</a></li>
<li class="list-group-item">
<a href="/search/?query=2&type=label">Examples</a>
</li>
</ul>
</div>
<div class="col-sm-3 cborder">
<div class="col-sm-4">
<div class="card cardbox">
<center><i class="fa fa-flash fa-3x"></i></center>
<div class="card-block">
Expand All @@ -59,14 +63,14 @@ <h4 class="card-title">{% trans "Performance" %}</h4>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="/search/?query=Performance&type=label">Examples</a></li>
<li class="list-group-item">
<a href="/search/?query=3&type=label">Examples</a>
</li>
</ul>
</div>
</div>
<br>
<br>
<div class="row">
<div class="col-sm-3 cborder">
<div class="col-sm-4">
<div class="card cardbox">
<center><i class="fa fa-lock fa-3x"></i></center>
<div class="card-block">
Expand All @@ -75,10 +79,12 @@ <h4 class="card-title">{% trans "Security" %}</h4>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="/search/?query=Security&type=label">Examples</a></li>
<li class="list-group-item">
<a href="/search/?query=4&type=label">Examples</a>
</li>
</ul>
</div>
<div class="col-sm-3 cborder">
<div class="col-sm-4">
<div class="card cardbox">
<center> <i class="fa fa-eraser fa-3x"></i></center>
<div class="card-block">
Expand All @@ -87,10 +93,12 @@ <h4 class="card-title">{% trans "Typo" %}</h4>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="/search/?query=Typo&type=label">Examples</a></li>
<li class="list-group-item">
<a href="/search/?query=5&type=label">Examples</a>
</li>
</ul>
</div>
<div class="col-sm-3 cborder">
<div class="col-sm-4">
<div class="card cardbox">
<center><i class="fa fa-code fa-3x"></i></center>
<div class="card-block">
Expand All @@ -99,12 +107,14 @@ <h4 class="card-title">{% trans "Design" %}</h4>
</div>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="/search/?query=Design&type=label">Examples</a></li>
</ul>
</div>
<li class="list-group-item">
<a href="/search/?query=6&type=label">Examples</a>
</li>
</ul>
</div>
</div>
</center>
</div>
</center>
</div>
<div class="row">
<div class="col-lg-9">
<div class="row">
Expand Down
9 changes: 2 additions & 7 deletions website/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
<h3 class="text-center">Search for Bugs & Issues</h3><hr>
<form method="GET" action=".">
<div class="input-group">
<input type="text" class="form-control" name="query" value="{{query}}" placeholder="Search for issues...">
<input type="text" class="form-control" name="query" value="{% if type != 'label' %}{{query}}{% endif %}" placeholder="Search for issues...">
<span class="input-group-btn">
<select class="form-control" name="type" style="width:150%">
<option value="issue" selected="selected">Issue</option>
<option value="domain">Domain</option>
<option value="user">User</option>
<option value="label">Label</option>
</select>
<button class="btn btn-default" type="submit">Search</button>
</span>
Expand All @@ -40,11 +39,7 @@ <h3 class="text-center">Search for Bugs & Issues</h3><hr>
</a>
</div>
{% endfor %}
</div>
{% elif labels %}
{% for activity in issues %}
{% include '_activity.html' %}
{% endfor %}
</div>
{% elif users %}
<div class="list-group">
{% for user in users %}
Expand Down
16 changes: 1 addition & 15 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,21 +481,7 @@ def search(request, template="search.html"):
'type': stype,
'users': User.objects.filter(Q(username__icontains=query))[0:20]
}

elif stype == "label":
stype1 = query.lower()
if stype1=="number error" or stype1=="numbererror":
query=1
elif stype1=="functional":
query=2
elif stype1=="performance":
query=3
elif stype1=="security":
query=4
elif stype1=="typo":
query=5
elif stype1=="design":
query=6
elif stype == "label":
context = {
'query': query,
'type': stype,
Expand Down

0 comments on commit 62c8d1c

Please sign in to comment.