oops, adding notes.html

This commit is contained in:
Sanjay B 2013-09-23 18:20:35 +05:30
parent 1360d84d86
commit c7bb5c5890

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 %}