summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholyantony2015-05-14 12:00:50 +0530
committerholyantony2015-05-14 12:00:50 +0530
commit5ab212f99c20ec6e9b00a329165051783b9fcbc5 (patch)
tree46e29a43fb765ed5d72a6b58972d3d4fbfa54c0b
parente68d57dba6f9193d75c48d218dd98c7592e776ee (diff)
downloadFOSSEE-Forum-5ab212f99c20ec6e9b00a329165051783b9fcbc5.tar.gz
FOSSEE-Forum-5ab212f99c20ec6e9b00a329165051783b9fcbc5.tar.bz2
FOSSEE-Forum-5ab212f99c20ec6e9b00a329165051783b9fcbc5.zip
Subject: Auto select category name on Ask new question click
Description:
-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 %}