Merge pull request #10044 from prssanna/code-expand-button
fix: move expand button after description and change label according to state
This commit is contained in:
commit
852741581a
2 changed files with 9 additions and 3 deletions
|
|
@ -10,11 +10,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({
|
|||
.appendTo(this.input_area);
|
||||
|
||||
this.expanded = false;
|
||||
this.$expand_button = $(`<button class="margin-top btn btn-xs btn-default">${__('Expand / Collapse')}</button>`).click(() => {
|
||||
this.$expand_button = $(`<button class="btn btn-xs btn-default">${__('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',
|
||||
|
|
|
|||
|
|
@ -770,6 +770,7 @@ h6.uppercase, .h6.uppercase {
|
|||
|
||||
.help-box {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
pre {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue