diff options
-rw-r--r-- | static/website/css/main.css | 20 | ||||
-rw-r--r-- | static/website/templates/ajax-keyword-search.html | 112 | ||||
-rw-r--r-- | static/website/templates/ajax-time-search.html | 112 | ||||
-rw-r--r-- | static/website/templates/filter.html | 137 | ||||
-rw-r--r-- | static/website/templates/get-question.html | 32 | ||||
-rw-r--r-- | static/website/templates/index.html | 105 | ||||
-rw-r--r-- | 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 %} +<br> +<table class="table table-striped table-bordered table-hover"> + <th> FOSS </th> + <th>TUTORIAL</th> + <th> MIN</th> + <th> SEC </th> + <th> QUESTION</th> + <th> DATE</th> + <th> USER</th> {% for question in questions %} - <div class="question"> - <div class="title"> - <a href="{% url 'website:get_question' question.id %}">{{ question.title }}</a> - </div> - <br> - <span class="category"> - <small> - <a href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> - {{ question.category }} - </a> - </small> - </span> + <tr> + <td> + <span href="#" class="category" data-toggle="tooltip" data-placement="top" title="{{ question.category}}"> + {{ question.category|truncatechars:15 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <span class="tutorial"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> - {{ question.tutorial}} - </a> - </small> - </span> + <td> + <span class="tutorial" data-toggle="tooltip" data-placement="top" title="{{ question.tutorial}}"> + {{ question.tutorial|truncatechars:15 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <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> + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range %}?qid={{ question.id }}"> + {{ question.minute_range }} + </a> + </span> + </td> - <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 }} - </i> - </small> + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range question.second_range%}?qid={{ question.id }}"> + {{ question.second_range }} + </a> + </span> + </td> - <span class="user"> - {{ question.user }} - </span> - </span> - </div> <!-- /.question --> + <td> + <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.title }}"> + <a href="{% url 'website:get_question' question.id %}">{{ question.title|truncatechars:45 }}</a> + </span> + </td> + + <td> + <span> + <i> + {{ question.date_created|date:"y-d-m" }} + </i> + </span> + </td> + + <td> + {{ question.user }} + </td> + </tr> {% endfor %} +</table> {% else %} -<h4>No results found . . .</h4> + <h4>No results found . . .</h4> {% endif %} + +{% block javascript %} +<script> + $('span').tooltip(); +</script> +{% 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 %} +<br> +<table class="table table-striped table-bordered table-hover"> + <th> FOSS </th> + <th>TUTORIAL</th> + <th> MIN</th> + <th> SEC </th> + <th> QUESTION</th> + <th> DATE</th> + <th> USER</th> {% for question in questions %} - <div class="question"> - <div class="title"> - <a href="{% url 'website:get_question' question.id %}">{{ question.title }}</a> - </div> - <br> - <span class="category"> - <small> - <a href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> - {{ question.category }} - </a> - </small> - </span> + <tr> + <td> + <span href="#" class="category" data-toggle="tooltip" data-placement="top" title="{{ question.category}}"> + {{ question.category|truncatechars:15 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <span class="tutorial"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> - {{ question.tutorial}} - </a> - </small> - </span> + <td> + <span class="tutorial" data-toggle="tooltip" data-placement="top" title="{{ question.tutorial}}"> + {{ question.tutorial|truncatechars:15 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <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> + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range %}?qid={{ question.id }}"> + {{ question.minute_range }} + </a> + </span> + </td> - <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 }} - </i> - </small> + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range question.second_range%}?qid={{ question.id }}"> + {{ question.second_range }} + </a> + </span> + </td> - <span class="user"> - {{ question.user }} - </span> - </span> - </div> <!-- /.question --> + <td> + <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.title }}"> + <a href="{% url 'website:get_question' question.id %}">{{ question.title|truncatechars:45 }}</a> + </span> + </td> + + <td> + <span> + <i> + {{ question.date_created|date:"y-d-m" }} + </i> + </span> + </td> + + <td> + {{ question.user }} + </td> + </tr> {% endfor %} +</table> {% else %} -<h4>No results found . . .</h4> + <h4>No results found . . .</h4> {% endif %} + +{% block javascript %} +<script> + $('span').tooltip(); +</script> +{% 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 %} <div class="question"> - <div class="title"> + <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 }}"> @@ -38,49 +36,118 @@ </a> </small> </span> + + <span class="meta"> + <small> + <i> + {{ question.date_created|date:"y-d-m" }}, {{ question.date_created|time }} + </i> + </small> + + <span class="user"> + {{ question.user }} + </span> + </span> + </div> {% endif %} -<h5>You might also want to take a look at:</h5> {% if questions %} - {% for question in questions %} - <div class="question"> - <div class="title"> - <a href="{% url 'website:get_question' question.id %}">{{ question.title }}</a> - </div> +<h5> + These are the similar questions in: + {% if category %} + {{ category }} + {% endif %} + {% if tutorial %} + <b> > </b> + {{ tutorial }} + {% endif %} + {% if minute_range %} + <b> > </b> + {{ minute_range }} min + {% endif %} + {% if second_range %} + <b> > </b> + {{ second_range }} sec + {% endif %} +</h5> - <span class="category"> - <small> - <a href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> - {{ question.category }} - </a> - </small> - </span> + <table class="table table-striped table-bordered"> + <th> FOSS </th> + <th> ST</th> + <th> MIN</th> + <th> SEC </th> + <th> QUESTION</th> + <th> DATE</th> + <th>VIEWS</th> + <th> USER</th> + {% for question in questions %} + <tr> + <td> + <span href="#" class="category" data-toggle="tooltip" data-placement="top" title="{{ question.category}}"> + {{ question.category|truncatechars:15 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <span class="tutorial"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> - {{ question.tutorial}} - </a> - </small> - </span> + <td> + <span class="tutorial" data-toggle="tooltip" data-placement="top" title="{{ question.tutorial}}"> + {{ question.tutorial|truncatechars:15 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <span class="minute_range"> - <small> + <td> + <span> <a href="{% url 'website:filter' question.category question.tutorial question.minute_range %}?qid={{ question.id }}"> - {{ question.minute_range }} min + {{ question.minute_range }} </a> - </small> - </span> + </span> + </td> - <span class="second_range"> - <small> + <td> + <span> <a href="{% url 'website:filter' question.category question.tutorial question.minute_range question.second_range%}?qid={{ question.id }}"> - {{ question.second_range }} sec + {{ question.second_range }} </a> - </small> - </span> - </div> - {% endfor %} + </span> + </td> + + <td> + <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.title }}"> + <a href="{% url 'website:get_question' question.id %}">{{ question.title|truncatechars:45 }}</a> + </span> + </td> + + <td> + <span> + <i> + {{ question.date_created|date:"y-d-m" }} + </i> + </span> + </td> + + <td> + {{ question.views}} + </td> + + <td> + {{ question.user }} + </td> + </tr> + {% endfor %} + </table> +{% else %} +<h4>There are no similar questions.</h4> {% endif %} {% endblock %} + +{% block javascript %} +<script> + $('span').tooltip(); +</script> +{% 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 @@ <span class="meta"> <small> <i> - {{ question.date_created }} + {{ question.date_created|date:"y-d-m" }}, {{ question.date_created|time }} </i> </small> @@ -91,20 +91,26 @@ </div> <!-- /.reply --> {% endfor %} -<form action="{% url 'website:question_reply' %}" method="POST"> {% csrf_token %} - {% with WIDGET_ERROR_CLASS='field_error' %} - <div class="row"> - <div class="col-lg-12"> - <div class="form-group"> - {% render_field form.question value=question.id %} - <label for="id_body">Reply</label> - {% render_field form.body class+='form-control' %} +{% if user.is_authenticated %} + <form action="{% url 'website:question_reply' %}" method="POST"> {% csrf_token %} + {% with WIDGET_ERROR_CLASS='field_error' %} + <div class="row"> + <div class="col-lg-12"> + <div class="form-group"> + {% render_field form.question value=question.id %} + <label for="id_body">Reply</label> + {% render_field form.body class+='form-control' %} + </div> </div> </div> - </div> - {% endwith %} - <input class="btn btn-info" type="submit" value="Submit Reply"> -</form> + {% endwith %} + <input class="btn btn-info" type="submit" value="Submit Reply"> + </form> +{% else %} + <h4> + <a class="btn btn-xs btn-success" href="{% url 'user_login'%}"><b>Log-in</b></a> to reply to this question. + </h4> +{% endif %} <script src="{% static 'website/js/nicEdit.js' %}" type="text/javascript"></script> <script type="text/javascript"> diff --git a/static/website/templates/index.html b/static/website/templates/index.html index ef840bc..cb5f3df 100644 --- a/static/website/templates/index.html +++ b/static/website/templates/index.html @@ -2,58 +2,75 @@ {% block content %} {% load count_tags %} <h4><u>Recent Questions</u></h4> +<table class="table table-striped table-bordered table-hover"> + <th> FOSS </th> + <th>TUTORIAL</th> + <th> MIN</th> + <th> SEC </th> + <th> QUESTION</th> + <th> DATE</th> + <th>VIEWS</th> + <th> USER</th> {% for question in questions %} - <div class="question"> - <div class="title"> - <a href="{% url 'website:get_question' question.id %}">{{ question.title }}</a> - </div> - <br> - <span class="category"> - <small> - <a href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> - {{ question.category }} - </a> - </small> + <tr> + <td> + <span href="#" class="category" data-toggle="tooltip" data-placement="top" title="{{ question.category}}"> + {{ question.category|truncatechars:15 }} </span> + <a class="pull-right" href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <span class="tutorial"> - <small> - <a href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> - {{ question.tutorial}} - </a> - </small> + <td> + <span class="tutorial" data-toggle="tooltip" data-placement="top" title="{{ question.tutorial}}"> + {{ question.tutorial|truncatechars:15 }} </span> + <a class="pull-right" href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> - <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> + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range %}?qid={{ question.id }}"> + {{ question.minute_range }} + </a> </span> + </td> - <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> + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range question.second_range%}?qid={{ question.id }}"> + {{ question.second_range }} + </a> </span> - - <span class="meta"> - <small> - <i> - {{ question.date_created }} - </i> - </small> + </td> + + <td> + <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.title }}"> + <a href="{% url 'website:get_question' question.id %}">{{ question.title|truncatechars:45 }}</a> + </span> + </td> - <span class="user"> - {{ question.user }} - </span> + <td> + <span> + <i> + {{ question.date_created|date:"y-d-m" }} + </i> </span> - </div> <!-- /.question --> - {% endfor %} + </td> + <td> + {{ question.views}} + </td> + + <td> + {{ question.user }} + </td> + </tr> + {% endfor %} +</table> {% if total > 10 %} <ul class="pagination pull-right"> {% for i in total|get_range:"0,10" %} @@ -71,3 +88,9 @@ {% endif %} {% endblock %} + +{% block javascript %} +<script> + $('span').tooltip(); +</script> +{% 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: |