diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/forums/templates/user-login.html | 4 | ||||
-rw-r--r-- | static/website/css/main.css | 8 | ||||
-rw-r--r-- | static/website/images/ajax-loader.gif | bin | 0 -> 847 bytes | |||
-rw-r--r-- | static/website/js/custom.js | 44 | ||||
-rw-r--r-- | static/website/templates/ajax-duration.html | 16 | ||||
-rw-r--r-- | static/website/templates/ajax-tutorials.html | 4 | ||||
-rw-r--r-- | static/website/templates/base.html | 3 | ||||
-rw-r--r-- | static/website/templates/fetch_questions.html | 9 | ||||
-rw-r--r-- | static/website/templates/fetch_tutorials.html | 2 | ||||
-rw-r--r-- | static/website/templates/get_tutorial.html | 12 | ||||
-rw-r--r-- | static/website/templates/index.html | 6 | ||||
-rw-r--r-- | static/website/templates/new-post.html | 45 | ||||
-rw-r--r-- | static/website/templates/new-question.html | 45 | ||||
-rw-r--r-- | static/website/templates/recent_questions.html | 5 |
14 files changed, 197 insertions, 6 deletions
diff --git a/static/forums/templates/user-login.html b/static/forums/templates/user-login.html new file mode 100644 index 0000000..6ac4fee --- /dev/null +++ b/static/forums/templates/user-login.html @@ -0,0 +1,4 @@ +<form action="/accounts/login/" method="POST"> {% csrf_token %} + {{ form.as_p }} + <input type="submit" value="Login"> +</form> diff --git a/static/website/css/main.css b/static/website/css/main.css index 997a154..9e68e7f 100644 --- a/static/website/css/main.css +++ b/static/website/css/main.css @@ -10,11 +10,14 @@ #content-inner { } +#content{ + min-height: 600px; +} #content .category { min-height: 50px; border-bottom: 1px solid #f5f5f5; } -#content .category .posts { +#content .category .questions { color: #7395d9; } #content .category .replies { @@ -38,3 +41,6 @@ #footer-inner { } +.field_error { + border: 1px solid red; +} diff --git a/static/website/images/ajax-loader.gif b/static/website/images/ajax-loader.gif Binary files differnew file mode 100644 index 0000000..e192ca8 --- /dev/null +++ b/static/website/images/ajax-loader.gif diff --git a/static/website/js/custom.js b/static/website/js/custom.js new file mode 100644 index 0000000..20801f6 --- /dev/null +++ b/static/website/js/custom.js @@ -0,0 +1,44 @@ +$(document).ready(function() { + $category = $("#id_category"); + $tutorial = $("#id_tutorial"); + $minute_range = $("#id_minute_range"); + $second_range = $("#id_second_range"); + + $category.change(function() { + var category = $(this).val(); + $.ajax({ + url: "/ajax-tutorials/", + type: "POST", + data: { + category: category + }, + success: function(data) { + $("#id_tutorial").html(data); + $("#id_tutorial").removeAttr("disabled"); + console.log("response = " + data); + } + }); + }); + + $tutorial.change(function() { + console.log("tut changed"); + var category = $category.val(); + var tutorial = $(this).val(); + $.ajax({ + url: "/ajax-duration/", + type: "POST", + data: { + category: category, + tutorial: tutorial + }, + success: function(data){ + var $response = $(data); + console.log($response.html()); + $minute_range.html($response.find("#minutes").html()) + $minute_range.removeAttr("disabled"); + $second_range.html($response.find("#seconds").html()) + $second_range.removeAttr("disabled"); + } + }); + }); +}); diff --git a/static/website/templates/ajax-duration.html b/static/website/templates/ajax-duration.html new file mode 100644 index 0000000..f89927b --- /dev/null +++ b/static/website/templates/ajax-duration.html @@ -0,0 +1,16 @@ +{% load count_tags %} +<div> +<div id="minutes"> + <option value="None">min</option> + {% for i in minutes|inc|get_range %} + <option value="{{ i }}-{{ i|inc }}">{{ i }}-{{ i|inc }} </option> + {% endfor %} +</div> <!-- /#minutes --> + +<div id="seconds"> + <option value="None">sec</option> + {% for i in seconds|get_range:"0,10" %} + <option value="{{ i }}">{{ i }}-{{ i|add:"10" }} </option> + {% endfor %} +</div> <!-- /#seconds --> +</div> <!-- /required for ajax --> diff --git a/static/website/templates/ajax-tutorials.html b/static/website/templates/ajax-tutorials.html new file mode 100644 index 0000000..7429f59 --- /dev/null +++ b/static/website/templates/ajax-tutorials.html @@ -0,0 +1,4 @@ +<option value="None">Select a Tutorial</option> +{% for tutorial in tutorials %} + <option value="{{ tutorial.tutorial_name }}">{{ tutorial.tutorial_name }}</option> +{% endfor %} diff --git a/static/website/templates/base.html b/static/website/templates/base.html index dd81da9..f89417f 100644 --- a/static/website/templates/base.html +++ b/static/website/templates/base.html @@ -53,7 +53,7 @@ {% block sidebar %} <h4>Recent Posts</h4> {% load sidebar_tags %} - {% recent_posts %} + {% recent_questions %} {% endblock %} </div> <!-- /#sidebar --> </div> <!-- /#content-inner --> @@ -70,5 +70,6 @@ <script src="{% static 'website/js/jquery.min.js' %}"></script> <script src="{% static 'website/js/bootstrap.min.js' %}"></script> + <script src="{% static 'website/js/custom.js' %}"></script> </body> </html> diff --git a/static/website/templates/fetch_questions.html b/static/website/templates/fetch_questions.html new file mode 100644 index 0000000..d7492fc --- /dev/null +++ b/static/website/templates/fetch_questions.html @@ -0,0 +1,9 @@ +{% extends 'website/templates/base.html' %} +{% block content %} +{{ category }}, {{ tutorial }} +<br> +Number of questions: {{ questions|length }} <br> +{% for question in questions %} + <a href="{% url 'website:get_question' question.id %}"> {{ question.title }}</a> +{% endfor %} +{% endblock %} diff --git a/static/website/templates/fetch_tutorials.html b/static/website/templates/fetch_tutorials.html index a99caec..246c35f 100644 --- a/static/website/templates/fetch_tutorials.html +++ b/static/website/templates/fetch_tutorials.html @@ -2,7 +2,7 @@ {% block content %} {% for tut in tutorials %} <div class="tutorial"> - <a href="{% url 'website:fetch_posts' category tut.tutorial_name %}"> + <a href="{% url 'website:fetch_questions' category tut.tutorial_name %}"> {{tut.tutorial_name}} </a> </div> diff --git a/static/website/templates/get_tutorial.html b/static/website/templates/get_tutorial.html new file mode 100644 index 0000000..159f342 --- /dev/null +++ b/static/website/templates/get_tutorial.html @@ -0,0 +1,12 @@ +{% extends 'website/templates/base.html' %} +{% block content %} +<h4>{{question.title}}</h4> +<p> + {{ question.body }} +</p> + +<b>Replies</b> +{% for reply in replies %} + {{ reply.body }} +{% endfor %} +{% endblock %} diff --git a/static/website/templates/index.html b/static/website/templates/index.html index c8b11b3..471fb48 100644 --- a/static/website/templates/index.html +++ b/static/website/templates/index.html @@ -5,11 +5,11 @@ <a href="{% url 'website:fetch_tutorials' category %}">{{ category }}</a> <br> {% load count_tags %} - <span class="posts"> - {% category_post_count category %} posts, + <span class="questions"> + {% category_question_count category %} questions, </span> <span class="replies"> - {% category_post_count category %} replies + {% category_question_count category %} replies </span> <span class="helper"> A diff --git a/static/website/templates/new-post.html b/static/website/templates/new-post.html new file mode 100644 index 0000000..8487b70 --- /dev/null +++ b/static/website/templates/new-post.html @@ -0,0 +1,45 @@ +{% extends 'website/templates/base.html' %} +{% load widget_tweaks %} +{% block content %} + <h4> + <span class="glyphicon glyphicon-pencil"> + </span> Create a new question . . . + </h4> + <hr> + <form role="form" action="" method="POST"> + {% with WIDGET_ERROR_CLASS='field_error' %} + + <p>Please enter the tutorial details.</p> + <div class="row"> + <div class="col-lg-3 col-md-4 col-sm-4"> + {% render_field form.category class+="form-control"%} + </div> + <div class="col-lg-3 col-md-4 col-sm-4"> + {% render_field form.tutorial class+="form-control" disabled="disabled" %} + </div> + <div class="col-lg-2 col-md-2 col-sm-2"> + {% render_field form.minute_range class+="form-control" disabled="disabled" %} + </div> + <div class="col-lg-2 col-md-2 col-sm-2"> + {% render_field form.second_range class+="form-control" disabled="disabled" %} + </div> + </div> + <hr> + + <p>Please enter your question details.</p> + <div class="row"> + <div class="col-lg-10"> + <div class="form-group"> + <label for="id_title">Title:</label> + {% render_field form.title class+="form-control" %} + </div> + <div class="form-group"> + <label for="id_body">Question:</label> + {% render_field form.body class+="form-control" %} + </div> + </div> + </div> + <input class="btn btn-success" type="submit" value="Submit Question"> + {% endwith %} + </form> +{% endblock %} diff --git a/static/website/templates/new-question.html b/static/website/templates/new-question.html new file mode 100644 index 0000000..5005e13 --- /dev/null +++ b/static/website/templates/new-question.html @@ -0,0 +1,45 @@ +{% extends 'website/templates/base.html' %} +{% load widget_tweaks %} +{% block content %} + <h4> + <span class="glyphicon glyphicon-pencil"> + </span> Create a new question . . . + </h4> + <hr> + <form role="form" action="" method="POST">{% csrf_token %} + {% with WIDGET_ERROR_CLASS='field_error' %} + + <p>Please enter the tutorial details.</p> + <div class="row"> + <div class="col-lg-3 col-md-4 col-sm-4"> + {% render_field form.category class+="form-control"%} + </div> + <div class="col-lg-3 col-md-4 col-sm-4"> + {% render_field form.tutorial class+="form-control" disabled="disabled" %} + </div> + <div class="col-lg-2 col-md-2 col-sm-2"> + {% render_field form.minute_range class+="form-control" disabled="disabled" %} + </div> + <div class="col-lg-2 col-md-2 col-sm-2"> + {% render_field form.second_range class+="form-control" disabled="disabled" %} + </div> + </div> + <hr> + + <p>Please enter your question details.</p> + <div class="row"> + <div class="col-lg-10"> + <div class="form-group"> + <label for="id_title">Title:</label> + {% render_field form.title class+="form-control" %} + </div> + <div class="form-group"> + <label for="id_body">Question:</label> + {% render_field form.body class+="form-control" %} + </div> + </div> + </div> + <input class="btn btn-success" type="submit" value="Submit Question"> + {% endwith %} + </form> +{% endblock %} diff --git a/static/website/templates/recent_questions.html b/static/website/templates/recent_questions.html new file mode 100644 index 0000000..1a4cc44 --- /dev/null +++ b/static/website/templates/recent_questions.html @@ -0,0 +1,5 @@ +<ul> +{% for question in recent_questions %} + <li>{{question.title}}</li> +{% endfor %} +</ul> |