summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static/website/js/custom.js5
-rw-r--r--static/website/templates/index.html4
-rw-r--r--static/website/templates/new-question.html14
3 files changed, 20 insertions, 3 deletions
diff --git a/static/website/js/custom.js b/static/website/js/custom.js
index 90ebe9c..5b584ee 100644
--- a/static/website/js/custom.js
+++ b/static/website/js/custom.js
@@ -1,5 +1,6 @@
$(document).ready(function() {
- $category = $("#id_category");
+ $("#id_category").val($category);
+
$tutorial = $("#id_tutorial");
$minute_range = $("#id_minute_range");
$second_range = $("#id_second_range");
@@ -55,7 +56,7 @@ $(document).ready(function() {
$tutorial.change(function() {
/* resetting dropdowns */
reset("minute_range", "second_range");
- var category = $category.val();
+
var tutorial = $(this).val();
if(tutorial == "General") {
/* disabling all other fields */
diff --git a/static/website/templates/index.html b/static/website/templates/index.html
index fcdf8cb..f7c3f37 100644
--- a/static/website/templates/index.html
+++ b/static/website/templates/index.html
@@ -22,7 +22,9 @@
{{ category }}
</small>
{% latest_question category %}
- <a class="btn btn-xs btn-block btn-success" href="{% url 'website:new_question' %}?category={{ category|urlencode }}">Ask new question</a>
+
+
+ <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>
diff --git a/static/website/templates/new-question.html b/static/website/templates/new-question.html
index 85900f7..ed2c541 100644
--- a/static/website/templates/new-question.html
+++ b/static/website/templates/new-question.html
@@ -18,6 +18,7 @@
<div class="col-lg-3 col-md-3 col-sm-3">
{% render_field form.category class+="form-control category"%}
</div>
+
<!--<div class="col-lg-3 col-md-3 col-sm-3">
{% if category %}
{% render_field form.tutorial class+="form-control" %}
@@ -79,6 +80,19 @@ bkLib.onDomLoaded(function() {
}).panelInstance('id_body');
});
</script>
+
+<script>
+
+ window.onload = function() {
+ /* your code */
+ var c2= "{{ category }}";
+
+ $("#id_category").val(c2);
+
+}
+
+</script>
+
{% endblock %}
{% block javascript %}