From 22cd61fd989adc1ed5b1e6f9319bb3d2fccf62ae Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 26 Dec 2014 15:17:59 +0100 Subject: [PATCH] Add modal form view --- .../src/main/coffee/common/modals.coffee | 43 --------------- .../coding-rules-custom-rule-creation.hbs | 1 + .../coding-rules-custom-rule-creation.hbs | 1 + .../rule/custom-rule-creation-view.js | 37 ++++++------- .../src/main/js/common/modal-form.js | 38 +++++++++++++ server/sonar-web/src/main/js/common/modals.js | 54 +++++++++++++++++++ 6 files changed, 113 insertions(+), 61 deletions(-) delete mode 100644 server/sonar-web/src/main/coffee/common/modals.coffee create mode 100644 server/sonar-web/src/main/js/common/modal-form.js create mode 100644 server/sonar-web/src/main/js/common/modals.js diff --git a/server/sonar-web/src/main/coffee/common/modals.coffee b/server/sonar-web/src/main/coffee/common/modals.coffee deleted file mode 100644 index c9e7c4adce2..00000000000 --- a/server/sonar-web/src/main/coffee/common/modals.coffee +++ /dev/null @@ -1,43 +0,0 @@ -define [ - 'backbone.marionette' -], ( - Marionette -) -> - - $ = jQuery - EVENT_SCOPE = 'modal' - - - class extends Marionette.ItemView - className: 'modal' - overlayClassName: 'modal-overlay' - - - events: -> - 'click .js-modal-close': 'close' - - - onRender: -> - @$el.detach().appendTo $('body') - @renderOverlay() - key 'escape', (=> @close()) - - - onClose: -> - @removeOverlay() - - - renderOverlay: -> - overlay = $(".#{@overlayClassName}") - if overlay.length == 0 - overlay = $("
").appendTo $('body') - - - removeOverlay: -> - $('.modal-overlay').remove() - - - attachCloseEvents: -> - $('body').on "click.#{EVENT_SCOPE}", => - $('body').off "click.#{EVENT_SCOPE}" - @close() diff --git a/server/sonar-web/src/main/hbs/coding-rules-old/coding-rules-custom-rule-creation.hbs b/server/sonar-web/src/main/hbs/coding-rules-old/coding-rules-custom-rule-creation.hbs index c1244ff82e6..94323fa40cf 100644 --- a/server/sonar-web/src/main/hbs/coding-rules-old/coding-rules-custom-rule-creation.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules-old/coding-rules-custom-rule-creation.hbs @@ -8,6 +8,7 @@