From 1541ab6a4ff28a6a0a4e37873367314e3b898dac Mon Sep 17 00:00:00 2001 From: Jayaram Pai Date: Sun, 22 Dec 2013 22:50:27 +0530 Subject: making forum in table format --- static/website/css/main.css | 20 +++- static/website/templates/ajax-keyword-search.html | 112 ++++++++++-------- static/website/templates/ajax-time-search.html | 112 ++++++++++-------- static/website/templates/filter.html | 137 ++++++++++++++++------ static/website/templates/get-question.html | 32 +++-- static/website/templates/index.html | 105 ++++++++++------- website/views.py | 7 +- 7 files changed, 341 insertions(+), 184 deletions(-) diff --git a/static/website/css/main.css b/static/website/css/main.css index 4280d57..2d629ac 100644 --- a/static/website/css/main.css +++ b/static/website/css/main.css @@ -1,3 +1,4 @@ +@import url(http://fonts.googleapis.com/css?family=Varela+Round); /* override bootstrap */ .container>.navbar-header { height: 45px; @@ -12,6 +13,7 @@ body { background: #fafafa; box-shadow: 4px 0 10px #cccccc, -4px 0 10px #cccccc; + font-family: 'Varela Round', sans-serif; } #page-wrapper { max-width: 970px; @@ -56,7 +58,7 @@ body { } #content .question .title a{ padding: 0 0 7px 0; - font-size: 1.3em; + font-size: 1.1em; color: #424242; } #content .question .body { @@ -68,7 +70,7 @@ body { #content .question .minute_range a, #content .question .second_range a { padding: 3px 5px; - margin: 0 10px 0 0; + margin: 0 5px 0 0; -webkit-border-radius: 3px; -moz-border-radius: 3px; -o-border-radius: 3px; @@ -81,6 +83,8 @@ body { #content .question .tutorial a { background: #424242; color: #ffffff; + width: 100px; + overflow: hidden; } #content .question .minute_range a { background: #f5f5f5; @@ -99,6 +103,18 @@ body { background: #f5f5f5; padding: 2px 7px; } +table .category { + color:#7395d9; + font-weight:bold; +} +table .tutorial { + color:#a26dc8; + font-weight:bold; +} +table .title a { + font-size: 1.1em; + color: #424242; +} #similar-link { display: none; } diff --git a/static/website/templates/ajax-keyword-search.html b/static/website/templates/ajax-keyword-search.html index 7d38a42..234332a 100644 --- a/static/website/templates/ajax-keyword-search.html +++ b/static/website/templates/ajax-keyword-search.html @@ -1,55 +1,75 @@ {% if questions %} +
+ + + + + + + + {% for question in questions %} -
-
- {{ question.title }} -
-
- - - - {{ question.category }} - - - +
+ - - - - {{ question.tutorial}} - - - + - - - - {{ question.minute_range }} min - - - + - - - - {{ question.second_range }} sec - - - - - - - - {{ question.date_created }} - - + - - {{ question.user }} - - - + + + + + + {% endfor %} +
FOSS TUTORIAL MIN SEC QUESTION DATE USER
+ + {{ question.category|truncatechars:15 }} + + + + + + + {{ question.tutorial|truncatechars:15 }} + + + + + + + + {{ question.minute_range }} + + + + + + {{ question.second_range }} + + + + + {{ question.title|truncatechars:45 }} + + + + + {{ question.date_created|date:"y-d-m" }} + + + + {{ question.user }} +
{% else %} -

No results found . . .

+

No results found . . .

{% endif %} + +{% block javascript %} + +{% endblock %} diff --git a/static/website/templates/ajax-time-search.html b/static/website/templates/ajax-time-search.html index 7d38a42..234332a 100644 --- a/static/website/templates/ajax-time-search.html +++ b/static/website/templates/ajax-time-search.html @@ -1,55 +1,75 @@ {% if questions %} +
+ + + + + + + + {% for question in questions %} -
-
- {{ question.title }} -
-
- - - - {{ question.category }} - - - +
+ - - - - {{ question.tutorial}} - - - + - - - - {{ question.minute_range }} min - - - + - - - - {{ question.second_range }} sec - - - - - - - - {{ question.date_created }} - - + - - {{ question.user }} - - - + + + + + + {% endfor %} +
FOSS TUTORIAL MIN SEC QUESTION DATE USER
+ + {{ question.category|truncatechars:15 }} + + + + + + + {{ question.tutorial|truncatechars:15 }} + + + + + + + + {{ question.minute_range }} + + + + + + {{ question.second_range }} + + + + + {{ question.title|truncatechars:45 }} + + + + + {{ question.date_created|date:"y-d-m" }} + + + + {{ question.user }} +
{% else %} -

No results found . . .

+

No results found . . .

{% endif %} + +{% block javascript %} + +{% endblock %} diff --git a/static/website/templates/filter.html b/static/website/templates/filter.html index 5d6fbb3..86a826c 100644 --- a/static/website/templates/filter.html +++ b/static/website/templates/filter.html @@ -1,12 +1,10 @@ {% extends 'website/templates/base.html' %} {% block content %} - {% if question %}
-
+ - @@ -38,49 +36,118 @@ + + + + + {{ question.date_created|date:"y-d-m" }}, {{ question.date_created|time }} + + + + + {{ question.user }} + + +
{% endif %} -
You might also want to take a look at:
{% if questions %} - {% for question in questions %} -
- +
+ These are the similar questions in: + {% if category %} + {{ category }} + {% endif %} + {% if tutorial %} + > + {{ tutorial }} + {% endif %} + {% if minute_range %} + > + {{ minute_range }} min + {% endif %} + {% if second_range %} + > + {{ second_range }} sec + {% endif %} +
- - - - {{ question.category }} - - - + + + + + + + + + + {% for question in questions %} + + - - - - {{ question.tutorial}} - - - + - - + - - + + + + + + + + + + + {% endfor %} +
FOSS ST MIN SEC QUESTION DATEVIEWS USER
+ + {{ question.category|truncatechars:15 }} + + + + + + + {{ question.tutorial|truncatechars:15 }} + + + + + + - {{ question.minute_range }} min + {{ question.minute_range }} - - + + + - {{ question.second_range }} sec + {{ question.second_range }} - - - - {% endfor %} + + + + {{ question.title|truncatechars:45 }} + + + + + {{ question.date_created|date:"y-d-m" }} + + + + {{ question.views}} + + {{ question.user }} +
+{% else %} +

There are no similar questions.

{% endif %} {% endblock %} + +{% block javascript %} + +{% endblock %} diff --git a/static/website/templates/get-question.html b/static/website/templates/get-question.html index cc4aca1..15c0197 100644 --- a/static/website/templates/get-question.html +++ b/static/website/templates/get-question.html @@ -55,7 +55,7 @@ - {{ question.date_created }} + {{ question.date_created|date:"y-d-m" }}, {{ question.date_created|time }} @@ -91,20 +91,26 @@
{% endfor %} -
{% csrf_token %} - {% with WIDGET_ERROR_CLASS='field_error' %} -
-
-
- {% render_field form.question value=question.id %} - - {% render_field form.body class+='form-control' %} +{% if user.is_authenticated %} + {% csrf_token %} + {% with WIDGET_ERROR_CLASS='field_error' %} +
+
+
+ {% render_field form.question value=question.id %} + + {% render_field form.body class+='form-control' %} +
-
- {% endwith %} - - + {% endwith %} + + +{% else %} +

+ Log-in to reply to this question. +

+{% endif %} +{% endblock %} diff --git a/website/views.py b/website/views.py index c519b60..3c71941 100644 --- a/website/views.py +++ b/website/views.py @@ -83,7 +83,12 @@ def question_reply(request): return HttpResponseRedirect('/question/'+str(qid)) def filter(request, category=None, tutorial=None, minute_range=None, second_range=None): - context = {} + context = { + 'category': category, + 'tutorial': tutorial, + 'minute_range': minute_range, + 'second_range': second_range + } if category and tutorial and minute_range and second_range: questions = Question.objects.filter(category=category).filter(tutorial=tutorial).filter(minute_range=minute_range).filter(second_range=second_range) elif tutorial is None: -- cgit