From fa497c2dc7570f5402bfdc21f8dee45a970ef618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20S=C3=A1nchez?= Date: Fri, 29 Jun 2018 16:27:36 +0200 Subject: [PATCH] Adding TinyMCE editor on add case update form --- portal/static/portal/cases_detail.js | 14 +------------- portal/templates/portal/module_detail_cases.html | 9 ++++++++- portal/views.py | 2 +- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/portal/static/portal/cases_detail.js b/portal/static/portal/cases_detail.js index ea91c67..720a135 100644 --- a/portal/static/portal/cases_detail.js +++ b/portal/static/portal/cases_detail.js @@ -1,16 +1,4 @@ $( document ).ready(function() { - - $('textarea').each(function () { - this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;resize:none;'); - }).on('input', function () { - this.style.height = 'auto'; - this.style.height = (this.scrollHeight) + 'px'; - if (this.value.length > 0) { - $('#update-case-form-submit-button').prop('disabled', false); - } else { - $('#update-case-form-submit-button').prop('disabled', true); - } - }); $('#update-case-form').submit(function(event) { // Stop the browser from submitting the form. @@ -36,7 +24,7 @@ $( document ).ready(function() { $('#update_case_modal').each(function () { $('#update-case-text').val(''); $('#update-case-attachment').val(null); - $('#update-case-form-submit-button').prop('disabled', true); + tinyMCE.get('update-case-text').load(); $('#case-updates').append(response.case_update); $(this).find('.modal-body').html( ' - + + + +