diff options
Diffstat (limited to 'static/website')
-rw-r--r-- | static/website/css/main.css | 83 | ||||
-rw-r--r-- | static/website/images/down1-off.png | bin | 0 -> 483 bytes | |||
-rw-r--r-- | static/website/images/down1-on.png | bin | 0 -> 285 bytes | |||
-rw-r--r-- | static/website/images/up1-off.png | bin | 0 -> 458 bytes | |||
-rw-r--r-- | static/website/images/up1-on.png | bin | 0 -> 274 bytes | |||
-rw-r--r-- | static/website/templates/base.html | 9 | ||||
-rw-r--r-- | static/website/templates/get-question.html | 214 | ||||
-rw-r--r-- | static/website/templates/questions.html | 2 | ||||
-rw-r--r-- | static/website/templates/search.html | 1 |
9 files changed, 208 insertions, 101 deletions
diff --git a/static/website/css/main.css b/static/website/css/main.css index 20f220a..774871e 100644 --- a/static/website/css/main.css +++ b/static/website/css/main.css @@ -248,6 +248,8 @@ table .question a{ margin: 5px 0px; } #content .answer .body { + padding-bottom: 10px; + ,, } #content .answer .user { padding: 2px 7px; @@ -401,3 +403,84 @@ table .question a{ font-size: 22px; overflow: hidden; } + + +.votes { + color: rgb(85, 85, 85); + padding-top: 8px; + padding-bottom: 8px; + text-align: center; +} + +.vote span { + display: block; + color: rgb(128, 129, 133); + font-weight: normal; +} + +.vote-count-post { + display: block; + font-size: 17px; + +} + +.votecell { + background:#ffffff; + + float:left; + width:60px; + height:100px; + margin-right:5px; + padding:0; + border-radius: 3px; +} + +.post-text { + word-wrap: break-word; + width: 660px; + font-size: 107%; + margin-bottom: 5px; + margin-right: 5px; + margin-right-value: 5px; + margin-right-ltr-source: physical; + margin-right-rtl-source: physical; + line-height: 130%; +} + +.post-taglist { + margin-bottom: 10px; + clear: both; +} + +.vote { + text-align: center; +} + + +.vote-up-off, .vote-up-on, .vote-down-off, .vote-down-on, .star-on, .star-off, .comment-up-off, .comment-up-on, .comment-flag, .flag-off, .vote-accepted-off, .vote-accepted-on { + text-indent: -9999em; + font-size: 1px; +} + +.vote-up-off, .vote-up-on, .vote-down-off, .vote-down-on, .star-on, .star-off { + background-position: 0px -265px; + display: block; + margin: 0px auto; + margin-top: 0px; + margin-right-value: auto; + margin-bottom: 0px; + margin-left-value: auto; + margin-left-ltr-source: physical; + margin-left-rtl-source: physical; + margin-right-ltr-source: physical; + margin-right-rtl-source: physical; + width: 41px; + height: 25px; +} + + +.space { + padding-top: 20px; +} + + diff --git a/static/website/images/down1-off.png b/static/website/images/down1-off.png Binary files differnew file mode 100644 index 0000000..c720b49 --- /dev/null +++ b/static/website/images/down1-off.png diff --git a/static/website/images/down1-on.png b/static/website/images/down1-on.png Binary files differnew file mode 100644 index 0000000..84f1a23 --- /dev/null +++ b/static/website/images/down1-on.png diff --git a/static/website/images/up1-off.png b/static/website/images/up1-off.png Binary files differnew file mode 100644 index 0000000..9fecb01 --- /dev/null +++ b/static/website/images/up1-off.png diff --git a/static/website/images/up1-on.png b/static/website/images/up1-on.png Binary files differnew file mode 100644 index 0000000..f756707 --- /dev/null +++ b/static/website/images/up1-on.png diff --git a/static/website/templates/base.html b/static/website/templates/base.html index b174d69..b5d087b 100644 --- a/static/website/templates/base.html +++ b/static/website/templates/base.html @@ -21,6 +21,15 @@ {% endcompress %} </head> <body> + <!-- Google Tag Manager --> +<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-NQBKKJ" +height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> +<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': +new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], +j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= +'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); +})(window,document,'script','dataLayer','GTM-NQBKKJ');</script> +<!-- End Google Tag Manager --> <div id="page-wrapper"> <div id="header-wrapper"> <div id="header-inner"> diff --git a/static/website/templates/get-question.html b/static/website/templates/get-question.html index c31259b..7c93803 100644 --- a/static/website/templates/get-question.html +++ b/static/website/templates/get-question.html @@ -9,17 +9,47 @@ {% endblock %} {% block content %} + <span class="saving hideme">saving . . .</span> <span class="saved hideme">saved</span> <div class="row"> + + + <div class="question-wrapper col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="question {% if user|can_edit:question %}editable{% endif %}"> + <!-- VOTE CELL --> + + + + <div class="votecell" style="padding-top: 0.0cm;"> + <div class="vote"> + {% ifequal thisUserUpvote 0 %} + <img src="{% static 'website/images/up1-off.png' %}" class="vote-up" title="This question shows research effort; it is useful and clear"/> + {% else %} + <img src="{% static 'website/images/up1-on.png' %}" class="vote-up selected" title="This question shows research effort; it is useful and clear"/> + {% endifequal %} + + <span class="vote-count-post" id="show_vote_count"> + {{ net_count }} + </span> + + {% ifequal thisUserDownvote 0 %} + <img src="{% static 'website/images/down1-off.png' %}" class="vote-down" title="This question does not show any research effort; it is not useful and unclear"/> + {% else %} + <img src="{% static 'website/images/down1-on.png' %}" class="vote-down selected" title="This question does not show any research effort; it is not useful and unclear"/> + {% endifequal %} + </div> + + </div> <div class="title {% if user|can_edit:question %}title-editable{% endif %}"> {{ question.title }} </div> <div id="title-edit" class="hideme"> + + <h5>Title</h5> <input class="form-control" type="text"> <h5>Question</h5> @@ -62,10 +92,13 @@ {{ question.user }} </span> </span> + </div> <!-- /.question --> </div> + </div> <!-- /.row --> + <h4><u>Answers:</u></h4> <div id="answerPanelWrapper" style="display:none;"> <div id="answerNicPanel" style="display:none;"></div> @@ -207,80 +240,7 @@ <div class="modal-body"> <h5>The Current question is under:</h5> - {{ question.category }} <!-- - - <h5>Move the question to:</h5> - <div class="row"> - <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4"> - <select id="id_category" class="form-control"> - <option value="Advanced-C++">Advanced-C++</option> - <option value="BASH">BASH</option> - <option value="Blender">Blender</option> - <option value="C-and-C++">C-and-C++</option> - <option value="CellDesigner">CellDesigner</option> - <option value="Digital-Divide">Digital-Divide</option> - <option value="Drupal">Drupal</option> - <option value="Firefox">Firefox</option> - <option value="GChemPaint">GChemPaint</option> - <option value="Geogebra">Geogebra</option> - <option value="GeoGebra-for-Engineering-drawing">GeoGebra-for-Engineering-drawing</option> - <option value="GIMP">GIMP</option> - <option value="GNS3">GNS3</option> - <option value="GSchem">GSchem</option> - <option value="Inkscape">Inkscape</option> - <option value="Java">Java</option> - <option value="Java-Business-Application">Java-Business-Application</option> - <option value="KiCad">KiCad</option> - <option value="KTouch">KTouch</option> - <option value="KTurtle">KTurtle</option> - <option value="LaTeX">LaTeX</option> - <option value="LibreOffice-Suite-Base">LibreOffice-Suite-Base</option> - <option value="LibreOffice-Suite-Calc">LibreOffice-Suite-Calc</option> - <option value="LibreOffice-Suite-Draw">LibreOffice-Suite-Draw</option> - <option value="LibreOffice-Suite-Impress">LibreOffice-Suite-Impress</option> - <option value="LibreOffice-Suite-Math">LibreOffice-Suite-Math</option> - <option value="LibreOffice-Suite-Writer">LibreOffice-Suite-Writer</option> - <option value="Linux">Linux</option> - <option value="Netbeans">Netbeans</option> - <option value="Ngspice">Ngspice</option> - <option value="OpenFOAM">OpenFOAM</option> - <option value="Orca">Orca</option> - <option value="Oscad">Oscad</option> - <option value="PERL">PERL</option> - <option value="PHP-and-MySQL">PHP-and-MySQL</option> - <option value="Python">Python</option> - <option value="Python-Old-Version">Python-Old-Version</option> - <option value="QCad">QCad</option> - <option value="R">R</option> - <option value="Ruby">Ruby</option> - <option value="Scilab">Scilab</option> - <option value="Selenium">Selenium</option> - <option value="Single-Board-Heater-System">Single-Board-Heater-System</option> - <option value="Spoken-Tutorial-Technology">Spoken-Tutorial-Technology</option> - <option value="Step">Step</option> - <option value="Thunderbird">Thunderbird</option> - <option value="Tux-Typing">Tux-Typing</option> - <option value="What-is-Spoken-Tutorial">What-is-Spoken-Tutorial</option> - <option value="Xfig">Xfig</option> - <option value="General">General FOSS</option> - </select> - </div> - <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4"> - <select id="id_tutorial" class="form-control" disabled> - <option value="None">Select a Tutorial</option> - </select> - </div> - <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> - <select id="id_minute_range" class="form-control" disabled> - <option value="None">min</option> - </select> - </div> - <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> - <select id="id_second_range" class="form-control" disabled> - <option value="None">sec</option> - </select> - </div> - </div> <!-- /.row --> + {{ question.category }} <hr> <div class="pull-right"> <a id="question-details-ok" class="btn btn-sm btn-success hideme" data-qid={{ question.id }} href="#">Ok</a> @@ -291,8 +251,14 @@ </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> +<!-- AJAX SCRIPT --> + + -<script src="{% static 'website/js/nicEdit.js' %}" type="text/javascript"></script> +{% endblock %} + +{% block javascript %} + <script src="{% static 'website/js/nicEdit.js' %}" type="text/javascript"></script> <script type="text/javascript"> bkLib.onDomLoaded(function() { new nicEditor({ @@ -301,34 +267,82 @@ }).panelInstance('id_body'); }); </script> -{% endblock %} + <!-- <script src="{% static 'website/js/thread-user.js' %}"></script> + <script src="{% static 'website/js/custom.js' %}"></script> --> + <script type="text/javascript"> -{% block javascript %} - <script src="{% static 'website/js/thread-user.js' %}"></script> - <script src="{% static 'website/js/custom.js' %}"></script> - <script> $(document).ready(function() { - $vote = $(".vote"); + $.ajaxSetup({ + data: {csrfmiddlewaretoken: '{{ csrf_token }}' }, + }); + + $('div.vote img.vote-up').click(function() { + - $vote.click(function() { - if($(this).hasClass("upvote")) { - /* handle upvote click event */ - if($(this).hasClass("voted")) { - $(this).removeClass("voted"); - } else { - $(this).addClass("voted"); - $(this).siblings(".downvote").removeClass("voted"); - } - } else { - /* handle downvote click event */ - if($(this).hasClass("voted")) { - $(this).removeClass("voted"); - } else { - $(this).addClass("voted"); - $(this).siblings(".upvote").removeClass("voted"); - } - } - }); + + var id = {{ question.pk }}; + var vote_type = 'up'; + + /* USER HAS ALREADY VOTED */ + + if ($(this).hasClass('selected')) { + var vote_action = 'recall-vote' + + $.post('/vote_post/', {id:id, type:vote_type, action:vote_action}, function(response) { + + $('img.vote-up').removeAttr('src') + .attr('src', '{% static 'website/images/up1-off.png' %}') + .removeClass('selected'); + $('div.vote span.vote-count-post').html(response); + }); + } + /* USER WISHES TO VOTE */ + else { + var vote_action = 'vote' + $.post('/vote_post/', {id:id, type:vote_type, action:vote_action}, function(response) { + + $('img.vote-up').removeAttr('src') + .attr('src', '{% static 'website/images/up1-on.png' %}') + .addClass('selected'); + $('div.vote span.vote-count-post').html(response); + }); + } }); + + /* DOWNVOTE */ + + $('div.vote img.vote-down').click(function() { + + var id = {{ question.pk }}; + var vote_type = 'down'; + + /* USER HAS ALREADY DOWN-VOTED */ + + if ($(this).hasClass('selected')) { + var vote_action = 'recall-vote' + + $.post('/vote_post/', {id:id, type:vote_type, action:vote_action}, function(response) { + + $('img.vote-down').removeAttr('src') + .attr('src', '{% static 'website/images/down1-off.png' %}') + .removeClass('selected'); + $('div.vote span.vote-count-post').html(response); + }); + } + /* USER WISHES TO VOTE */ + else { + var vote_action = 'vote' + $.post('/vote_post/', {id:id, type:vote_type, action:vote_action}, function(response) { + + $('img.vote-down').removeAttr('src') + .attr('src', '{% static 'website/images/down1-on.png' %}') + .addClass('selected'); + $('div.vote span.vote-count-post').html(response); + }); + } + }); + }); + </script> + {% endblock %} diff --git a/static/website/templates/questions.html b/static/website/templates/questions.html index 98d016d..96f596d 100644 --- a/static/website/templates/questions.html +++ b/static/website/templates/questions.html @@ -49,8 +49,8 @@ <td> {{ question.answer_set.count }} </td> + - <td> <span class="title" data-toggle="tooltip" data-placement="top" title="{{ question.user }}"> {{ question.user|truncatechars:10 }} </span> diff --git a/static/website/templates/search.html b/static/website/templates/search.html index a7ac917..c374b47 100644 --- a/static/website/templates/search.html +++ b/static/website/templates/search.html @@ -1,4 +1,5 @@ {% extends 'website/templates/base.html' %} +{% load i18n googlesearch_inclusion_tags %} {% load static %} {% block content %} |