diff options
Diffstat (limited to 'static/website/templates/index.html')
-rw-r--r-- | static/website/templates/index.html | 178 |
1 files changed, 165 insertions, 13 deletions
diff --git a/static/website/templates/index.html b/static/website/templates/index.html index 6e7af78..a5e746e 100644 --- a/static/website/templates/index.html +++ b/static/website/templates/index.html @@ -1,19 +1,171 @@ {% extends 'website/templates/base.html' %} {% load static %} +{% load count_tags %} + {% block content %} -<div class="row"> - {% for category in categories %} - <div class="col-lg-2 col-md-2 col-sm-2"> - <div class="thumbnail"> - <img src="{% static "website/images/" %}{{ category }}.jpg" height="75px" width="100%"> - <div class="caption"> - <h3>{{ category }}</h3> - <p> - <a class="btn btn-xs btn-default btn-block vs" href="/filter/{{ category }}">View Questions</a> - </p> + <div id="carousel-container"> + <div class="row"> + <div class="col-lg-12"> + <div class="carousel"> + {% for category in categories %} + <div class="item"> + <div class="thumb"> + <img data-lazy="{% static "website/images/" %}{{ category }}.jpg" height="75px" width="99px"> + </div> + <div class="descp"> + <a class="btn btn-block btn-default btn-sm vs" href="{% url 'website:filter' category %}">{{ category }}</a> + </div> + </div> <!-- /.item --> + {% endfor %} + </div> <!-- /.carousel --> + </div> <!-- /.col --> + </div> <!-- /.row --> + </div> + + <div id="filter-container"> + <div class="row"> + <form class ="" id="filter-form" action="" role="form"> + <div class="col-lg-6"> + <h3>Filter questions . . .</h3> + <div class="row"> + <div class="form-group col-lg-10"> + <select id="filter-select" class="form-control"> + <option value="-1">Select a FOSS category</option> + {% for category in categories %} + <option value="{{ category }}">{{ category }}</option> + {% endfor %} + </select> + </div> <!-- /.form-group, .col --> + <div class="form-group col-lg-2"> + <input class="btn btn-primary btn-block" type="submit" value="Go"> + </div> <!-- /.form-group, .col --> + </div> + </div> <!-- /.col --> + </form> + <div class="col-lg-6"> + <div class="row"> + <div class="col-lg-6"> + <h3 align="center"><strong>{% total_question_count %}</strong></h3> + <h3 align="center">Questions</h3> + </div> + <div class="col-lg-6"> + <h3 align="center"><strong>{% total_answer_count %}</strong></h3> + <h3 align="center">Answers</h3> + </div> + </div> </div> + </div> <!-- /.row --> + </div> <!-- /#filter-container --> + + <br> + <div class="panel panel-default"> + <div class="panel-heading"> + Recent Questions </div> - </div> - {% endfor %} -</div> + <div class="panel-body"> + <table class="table 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> Answers</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:12 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> + + <td> + <span class="tutorial" data-toggle="tooltip" data-placement="top" title="{{ question.tutorial}}"> + {{ question.tutorial|truncatechars:12 }} + </span> + <a class="pull-right" href="{% url 'website:filter' question.category question.tutorial %}?qid={{ question.id }}"> + <span class="glyphicon glyphicon-search"></span> + </a> + </td> + + <td> + <span> + <a href="{% url 'website:filter' question.category question.tutorial question.minute_range %}?qid={{ question.id }}"> + {{ question.minute_range }} + </a> + </span> + </td> + + <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> + + <td> + <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.title }}"> + <a href="{% url 'website:get_question' question.id %}">{{ question.title|truncatechars:40 }}</a> + </span> + </td> + + <td> + <span> + <i> + {{ question.date_created|date:"d-m-y" }} + </i> + </span> + </td> + + <td> + {{ question.views}} + </td> + + <td> + {{ question.answer_set.count }} + </td> + + <td> + <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.user }}"> + {{ question.user|truncatechars:10 }} + </span> + </td> + </tr> + {% endfor %} + + </table> + </div> <!-- /.panel-body --> + </div> <!-- /.panel --> +{% endblock %} + +{% block javascript %} +<script> + $(document).ready(function(){ + $('.carousel').slick({ + lazyLoad: 'ondemand', + dots: false, + touchMove: false, + draggable: false, + slidesToShow: 8, + slidesToScroll: 3, + speed: 500, + {# autoplay: true, #} + autoplaySpeed: 1000, + }); + + $("#filter-form").submit(function(e) { + var category = $("#filter-select").val(); + if(category != -1) { + window.location = "/filter/" + category; + } + e.preventDefault(); + }); + }); +</script> {% endblock %} |