diff --git a/sao/src/sao.js b/sao/src/sao.js index d0119feae3f..516ecd9c8ba 100644 --- a/sao/src/sao.js +++ b/sao/src/sao.js @@ -939,7 +939,8 @@ var Sao = { Sao.Dialog = Sao.class_(Object, { init: function( - title, class_, size='sm', keyboard=true, small=null) { + title, class_, size='sm', keyboard=true, small=null, + closeable=false) { this.modal = jQuery('
', { 'class': class_ + ' modal fade', 'role': 'dialog', @@ -954,6 +955,17 @@ var Sao = { this.header = jQuery('', { 'class': 'modal-header' }).appendTo(this.content); + if (closeable) { + var close_button = jQuery('', { + 'type': 'button', + 'class': 'close', + 'data-dismiss': 'modal', + 'aria-label': Sao.i18n.gettext("Close"), + }).append(jQuery('', { + 'aria-hidden': true, + }).append('×')); + this.header.append(close_button); + } if (title) { this.add_title(title, small); } diff --git a/sao/src/screen.js b/sao/src/screen.js index f1a5922afac..6128c3b51b9 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -448,7 +448,8 @@ }; if (!this.search_modal) { var dialog = new Sao.Dialog( - Sao.i18n.gettext('Filters'), '', 'lg'); + Sao.i18n.gettext('Filters'), '', 'lg', true, null, + true); this.search_modal = dialog.modal; this.search_form = dialog.content; this.search_form.addClass('form-horizontal'); diff --git a/sao/src/theme/coog/sao.less b/sao/src/theme/coog/sao.less index 2bd25c35f01..6d4055fdd82 100644 --- a/sao/src/theme/coog/sao.less +++ b/sao/src/theme/coog/sao.less @@ -477,6 +477,10 @@ div.modal-header { .coog-group-header-colors(); } +div.modal-header .close { + font-size: 21px; +} + div.wizard-dialog { // For "small" state views, bump the window width from 600px > div.modal-dialog.modal-md { diff --git a/sao/src/wizard.js b/sao/src/wizard.js index bc6f5d08a52..6a5ac45d38a 100644 --- a/sao/src/wizard.js +++ b/sao/src/wizard.js @@ -190,6 +190,20 @@ this.screen.add_view(view); this.screen.switch_view(); this.screen.windows.push(this); + var close_button = jQuery('', { + 'type': 'button', + 'class': 'close', + 'aria-label': Sao.i18n.gettext("Close"), + }).append(jQuery('', { + 'aria-hidden': true, + }).append('×')); + close_button.click((e) => { + e.preventDefault(); + if (this.end_state in this.states) { + this.response(this.states[this.end_state].attributes); + } + }); + this.header.append(close_button); this.header.append(jQuery('', { 'class': 'model-title', 'title': this.name,