This commit is contained in:
Johnson Chetty 2013-09-23 16:54:47 +02:00
commit 07f54c37a7

View File

@ -0,0 +1,42 @@
{% for note in obj.notes.all %}
<div class="noteEach">
<p>
{{ note.text }}
</p>
<p class="noteMetaData">- posted by <a href="{{ note.user.get_absolute_url }}">{{ note.user.username }}</a>, {{ note.added }}</p>
</div>
{% endfor %}
{% if user_has_perms %}
<div id="addNoteForm">
<form class="itfForm" id="addNoteForm">
<label for="addNote">Add a note:</label>
<input type="hidden" id="addNoteObjectId" value="{{ obj.id }}" />
<input type="hidden" id="addNotesCtype" value="{{ content_type.id }}" />
<textarea id="addNote"></textarea><br />
<input type="submit" />
</form>
</div>
<script>
$(function() {
$('#addNoteForm').submit(function(e) {
e.preventDefault();
var object_id = $('#addNoteObjectId').val();
var content_type = $('#addNotesCtype').val();
var note = $('#addNote').val();
var url = "/add_note/" + content_type + "/" + object_id;
$.post(url, {
'note': note
}, function(response) {
window.location.reload();
}, "json");
});
});
</script>
{% endif %}