diff options
-rw-r--r-- | static/website/css/main.css | 4 | ||||
-rw-r--r-- | static/website/templates/filter.html | 61 | ||||
-rw-r--r-- | website/views.py | 7 |
3 files changed, 12 insertions, 60 deletions
diff --git a/static/website/css/main.css b/static/website/css/main.css index 4726635..467cea6 100644 --- a/static/website/css/main.css +++ b/static/website/css/main.css @@ -354,3 +354,7 @@ table .title a { .carousel .caption .btn { margin-top: 7px; } +.parent-filter { + background: #FDF5E6; + transition: background 2.5s ease; +} diff --git a/static/website/templates/filter.html b/static/website/templates/filter.html index 7496c0c..1397b26 100644 --- a/static/website/templates/filter.html +++ b/static/website/templates/filter.html @@ -1,57 +1,5 @@ {% extends 'website/templates/base.html' %} {% block content %} -{% if question %} - <div class="question"> - <div class="title" style="margin-bottom: 10px;"> - <a href="{% url 'website:get_question' question.id %}">{{ question.title }}</a> - </div> - <span class="category"> - <small> - <a href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> - {{ question.category }} - </a> - </small> - </span> - - <span class="tutorial"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> - {{ question.tutorial}} - </a> - </small> - </span> - - <span class="minute_range"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial question.minute_range %}?qid={{ question.id }}"> - {{ question.minute_range }} min - </a> - </small> - </span> - - <span class="second_range"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial question.minute_range question.second_range%}?qid={{ question.id }}"> - {{ question.second_range }} sec - </a> - </small> - </span> - - <span class="meta"> - <small> - <i> - {{ question.date_created|date:"d-m-y" }}, {{ question.date_created|time }} - </i> - </small> - - <span class="user"> - {{ question.user }} - </span> - </span> - - </div> -{% endif %} - {% if questions %} <h5> These are the similar questions in: @@ -75,7 +23,7 @@ <br> <div class="clearfix"></div> - <table class="table table-striped table-bordered"> + <table class="table table-bordered"> <th> FOSS </th> <th> Tutorial</th> <th> Min </th> @@ -86,7 +34,7 @@ <th> Answers</th> <th> User</th> {% for question in questions %} - <tr> + <tr {% if question.id == qid %}class="parent-filter"{% endif %}> <td> <span href="#" class="category" data-toggle="tooltip" data-placement="top" title="{{ question.category}}"> {{ question.category|truncatechars:12 }} @@ -159,6 +107,9 @@ {% block javascript %} <script> - $('span').tooltip(); + $(document).ready(function() { + $('span').tooltip(); + $('.parent-filter').css("background", "#ffffe0"); + }); </script> {% endblock %} diff --git a/website/views.py b/website/views.py index e349daa..842b12b 100644 --- a/website/views.py +++ b/website/views.py @@ -207,12 +207,9 @@ def filter(request, category=None, tutorial=None, minute_range=None, second_ran questions = Question.objects.filter(category=category).filter(tutorial=tutorial).filter(minute_range=minute_range) if 'qid' in request.GET: - qid = request.GET['qid'] - question = get_object_or_404(Question, id=qid) - context['question'] = question - questions = questions.filter(~Q(id=qid)) + context['qid'] = int(request.GET['qid']) - context['questions'] = questions + context['questions'] = questions.order_by('date_created').reverse() return render(request, 'website/templates/filter.html', context) @login_required |