Fixed for event items. Will probably fail tests because selenium can't type in simpleMDE :(

This commit is contained in:
David Taylor
2016-04-02 02:42:37 +01:00
parent 1b4cc91ec8
commit 02c615a08c
2 changed files with 18 additions and 6 deletions

View File

@@ -36,6 +36,16 @@ function updatePrices() {
$('#total').text(parseFloat(sum + vat).toFixed(2));
}
function setupMDE(selector) {
editor = new SimpleMDE({
element: $(selector)[0],
forceSync: true,
toolbar: ["bold", "italic", "strikethrough", "|", "unordered-list", "ordered-list", "|", "link", "|", "preview", "guide"],
status: true,
});
$(selector).data('mde_editor',editor);
}
$('#item-table').on('click', '.item-delete', function () {
delete objectitems[$(this).data('pk')]
$('#item-' + $(this).data('pk')).remove();

View File

@@ -43,12 +43,14 @@
$(document).ready(function () {
$(".md-enabled").each(function(index){
editor = new SimpleMDE({
element: $(".md-enabled")[index],
toolbar: ["bold", "italic", "strikethrough", "|", "unordered-list", "ordered-list", "|", "link", "|", "preview", "guide"],
status: false,
});
setupMDE('#id_description');
setupMDE('#id_notes');
setupMDE('#item_description');
$('#itemModal').on('shown.bs.modal', function (e) {
$('#item_description').data('mde_editor').value(
$('#item_description').val()
);
});
{% if not object.pk and not form.errors %}