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
|
{% extends 'website/templates/base.html' %}
{% load static %}
{% load widget_tweaks %}
{% block content %}
<h4 style="padding-top: 15px;">
<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 FOSS details.
<img id="ajax-loader" src="{% static 'website/images/ajax-loader.gif' %}" style="display:none;">
</p>
<div class="row">
{{ form.category.errors }}
<div class="col-lg-3 col-md-3 col-sm-3">
{% render_field form.category class+="form-control category"%}
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<small><strong>
<a id="similar-link" data-toggle="modal" data-target="#similarModal" href="#">
0 similar questions
</a>
</strong></small>
</div>
</div>
<hr>
<p>Please enter your question details.</p>
<div class="row">
<div class="col-lg-12">
{{ form.title.errors }}
<div class="form-group">
<label for="id_title">Title:</label>
{% render_field form.title class+="form-control title" %}
</div>
{{ form.body.errors }}
<div class="form-group">
<label for="id_body">Question:</label>
{% render_field form.body class+="form-control body" %}
</div>
</div>
</div>
<input class="btn btn-success" type="submit" value="Submit Question">
{% endwith %}
</form>
<!-- Modal -->
<div class="modal fade" id="similarModal" tabindex="-1" role="dialog" aria-labelledby="similarModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Similar Questions</h4>
</div>
<div class="modal-body" id="modal-body">
...
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="{% static 'website/js/nicEdit.js' %}" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
new nicEditor({
iconsPath: "{% static 'website/js/nicEditorIcons.gif' %}",
buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript','html','image', 'link', 'forecolor', 'bgcolor']
}).panelInstance('id_body');
});
</script>
<script>
window.onload = function() {
/* your code */
var c2= "{{ category }}";
if(c2 != "None"){
$("#id_category").val(c2);
}
}
</script>
{% endblock %}
{% block javascript %}
<script src="{% static 'website/js/custom.js' %}"></script>
{% endblock %}
|