summaryrefslogtreecommitdiff
path: root/static/website/templates/index.html
blob: ad67aecdc40dcd60abbde023947b19760c280d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
{% extends 'website/templates/base.html' %}
{% load static %}
{% load count_tags %}
{% load notify %}
{% load helpers %}

{% block content %}

<div style="margin-left: 450px;" >
 <script>
  (function() {
    var cx = '011342992297670206849:dfzecvqmvgc';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
</div>

<style>

 .gsc-search-button
	{
	   
	border-radius: 5px;
	border-color: #666;

	}


input.gsc-search-button, input.gsc-search-button:hover, input.gsc-search-button:focus {
    
    background-image: url("http://www.google.com/uds/css/v2/search_box_icon.png") !important;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    height: 28px !important;
    width: 60px
    
    filter: none;
    
}
    </style>



    <div id="carousel-container">

        <div class="carousel">

            {% for category in categories %}
                <div>
                    <div class="thumbnail">
                        {% with file=category|get_category_image %}
                            {% if file %}
                                <img src="{% static category|get_category_image %}">
                            {% else %}
                                <div class="category-title">{{category}}</div>
                            {% endif %}
                        {% endwith %}
                        <div class="caption">
                            <small class="category">
                                {{ category }}
                            </small>
                            {% latest_question category %}
                            

                            <a class="btn btn-xs btn-block btn-success" href="{% url 'website:new_question' %}?category={{ category.id|urlencode }}">Ask new question</a>
                        </div>
                    </div>
                </div>
            {% endfor %}
        </div> <!-- /.carousel -->
    </div> <!-- /#carousel-container -->



    <div id="filter-container">
        <div class="row">
            <form class ="" id="filter-form" action="" role="form">
                <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" >
                    <a class="btn btn-block btn-primary" href="{% url 'website:questions' %}" style="margin-top: 18px;">View all previous questions.</a>
                </div> <!-- /.col -->
            </form>
            <div class="col-lg-6 col-md-6 col-sm-6" >
                <div class="row">

                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="width: 100px; margin-left:40px; margin-right:40px; " >
                        <h3 style="font-size: 18px" align="center"><strong>{% total_question_count %}</strong></h3>
                        <h3 style="font-size: 18px; margin-top: 1px;" align="center" text-color="#7395d9" >Questions</h3>
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="width: 100px;margin-left:40px; margin-right:40px">
                        <h3 style="font-size: 18px" align="center"><strong>{% total_answer_count %}</strong></h3>
                        <h3 style="font-size: 18px; margin-top: 1px;" 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 class="panel-body">
            <table class="table table-bordered table-hover">
                <th> FOSS </th>
                <!--<th> Tutorial</th>-->
                <th> Question </th>
                <th> Date</th>
                <th> Views</th>
                <th> Answers</th>
                <th> User</th>
                {% for question in questions %}
                <tr>
                    <td>
                        <span class="category" data-toggle="tooltip" data-placement="top" title="{{ question.category}}">
                          
                        <a class="pull-left" href="{% url 'website:filter' question.category %}?qid={{ question.id }}">
                           {{ question.category|truncatechars:12 }} 
                         
                        </a>
                         </span>
                    </td>
                    
                    
                    <td>
                        <span class="question" data-toggle="tooltip" data-placement="top" title="{{ question.title }}">
                            <a href="{% url 'website:get_question' question.id %}{% prettify question.title %}">{{ 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 = $('.carousel').slick({
            lazyLoad: 'ondemand',
            dots: false,
            touchMove: false,
            draggable: false,
            slidesToShow: 4,
            slidesToScroll: 1,
            speed: 2000,
            autoplay: true,
            autoplaySpeed: 2000,
            infinite: true,
        });
        $(".slick-prev").unbind();
        $(".slick-next").unbind();
        
        $(".slick-prev").bind("click", function(e) {
            var current_slide = $carousel.slickCurrentSlide();
            $carousel.slickSetOption("slidesToScroll",3);
            $carousel.slickGoTo(current_slide - 3);
            $carousel.slickSetOption("slidesToScroll",1);
            e.stopPropagation();
        });
        $(".slick-next").bind("click", function(e) {
            var current_slide = $carousel.slickCurrentSlide();
            $carousel.slickSetOption("slidesToScroll",3);
            $carousel.slickGoTo(current_slide + 3);
            $carousel.slickSetOption("slidesToScroll",1);
            e.stopPropagation();
        });
        $("#filter-form").submit(function(e) {
            var category = $("#filter-select").val();
            if(category != -1) {
                window.location = "/filter/" + category;
            }
            e.preventDefault();
        });
    });
    $('span').tooltip();
</script>
<script src="{% static 'website/js/nice-bar.js' %}"></script>
{% endblock %}