From a3059b10d1518f2e858ec1b82047ef2895aed463 Mon Sep 17 00:00:00 2001 From: prssanna Date: Wed, 22 Apr 2020 12:32:44 +0530 Subject: [PATCH 1/2] fix: move expand button after description and change label according to state --- frappe/public/js/frappe/form/controls/code.js | 11 ++++++++--- frappe/public/less/form.less | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/form/controls/code.js b/frappe/public/js/frappe/form/controls/code.js index bdf36b706a..446b9b5fd8 100644 --- a/frappe/public/js/frappe/form/controls/code.js +++ b/frappe/public/js/frappe/form/controls/code.js @@ -10,11 +10,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ .appendTo(this.input_area); this.expanded = false; - this.$expand_button = $(``).click(() => { + this.$expand_button = $(``).click(() => { this.expanded = !this.expanded; this.refresh_height(); - }).insertAfter(this.ace_editor_target); - + this.toggle_label(); + }).appendTo(this.$input_wrapper); // styling this.ace_editor_target.addClass('border rounded'); this.ace_editor_target.css('height', 300); @@ -37,6 +37,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ this.editor.resize(); }, + toggle_label() { + const button_label = this.expanded? __('Collapse'): __('Expand'); + this.$expand_button.text(button_label); + }, + set_language() { const language_map = { 'Javascript': 'ace/mode/javascript', diff --git a/frappe/public/less/form.less b/frappe/public/less/form.less index b72d249aab..8e43b05122 100644 --- a/frappe/public/less/form.less +++ b/frappe/public/less/form.less @@ -770,6 +770,7 @@ h6.uppercase, .h6.uppercase { .help-box { margin-top: 3px; + margin-bottom: 6px; } pre { From a3b9761f76b7e816e20051268cdff0a563e0706f Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Fri, 24 Apr 2020 13:43:35 +0530 Subject: [PATCH 2/2] style: Fix formatting --- frappe/public/js/frappe/form/controls/code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/code.js b/frappe/public/js/frappe/form/controls/code.js index 446b9b5fd8..6b40201001 100644 --- a/frappe/public/js/frappe/form/controls/code.js +++ b/frappe/public/js/frappe/form/controls/code.js @@ -38,7 +38,7 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ }, toggle_label() { - const button_label = this.expanded? __('Collapse'): __('Expand'); + const button_label = this.expanded ? __('Collapse') : __('Expand'); this.$expand_button.text(button_label); },