MozReview: Provide close button for dropdown dialog (Bug 1308291). draft
authorDavid Walsh <dwalsh@mozilla.com>
Thu, 03 Nov 2016 11:41:30 -0500
changeset 207 8e326d55516b3ec3d710d66b2455c30a94eaaf4d
parent 191 b81bf3718ac588ca498f8dd03a52dd8bf1b455f6
push idunknown
push userunknown
push dateunknown
bugs1308291
MozReview: Provide close button for dropdown dialog (Bug 1308291). MozReview-Commit-ID: 186ff2qGY6L
reviewboard/reviewboard/static/rb/css/pages/reviews.less
reviewboard/reviewboard/static/rb/js/views/reviewDialogView_mozreview.js
--- a/reviewboard/reviewboard/static/rb/css/pages/reviews.less
+++ b/reviewboard/reviewboard/static/rb/css/pages/reviews.less
@@ -1712,16 +1712,25 @@
       }
     }
   }
 
   #review-form-comments {
     background: none;
     margin: 0 0 20px 0;
 
+    #dialog-close-button {
+      position: absolute;
+      top: 6px;
+      right: 20px;
+      font-weight: bold;
+      font-size: 20px;
+      padding: 0 6px;
+    }
+
     pre {
       .pre-wrap;
     }
 
     .spinner {
       font-size: 20px;
     }
 
--- a/reviewboard/reviewboard/static/rb/js/views/reviewDialogView_mozreview.js
+++ b/reviewboard/reviewboard/static/rb/js/views/reviewDialogView_mozreview.js
@@ -538,20 +538,23 @@ HeaderFooterCommentView = Backbone.View.
  * This provides editing capabilities for creating or modifying a new
  * review. The list of comments are retrieved from the server, providing
  * context for the comments.
  */
 RB.ReviewDialogView = Backbone.View.extend({
     id: 'review-form-comments',
     className: 'review',
 
+    events: {
+        'click #dialog-close-button': '_onCloseButtonClicked',
+    },
+
     template: _.template([
         '<div class="edit-field">',
-        ' <a class="markdown-info" href="<%- markdownDocsURL %>"',
-        '    target="_blank"><%- markdownText %></a>',
+        '<button class="btn" id="dialog-close-button" title="Close">&times;</button>',
         ' <input id="id_shipit" type="checkbox" />',
         ' <label for="id_shipit"><%- shipItText %></label>',
         '</div>',
         '<div class="review-dialog-hooks-container"></div>',
         '<div class="edit-field body-top"></div>',
         '<ul class="comments"></ul>',
         '<div class="spinner"><span class="fa fa-spinner fa-pulse"></span></div>',
         '<div class="edit-field body-bottom"></div>'
@@ -1030,16 +1033,23 @@ RB.ReviewDialogView = Backbone.View.exte
      * Sets the text attributes on a model for forcing and including types.
      */
     _setTextTypeAttributes: function(model) {
         model.set({
             forceTextType: 'html',
             includeTextTypes: this._defaultUseRichText
                               ? 'raw,markdown' : 'raw'
         });
+    },
+
+    /*
+     * Directs the DraftReviewBannerView to close this dialog
+     */
+    _onCloseButtonClicked: function() {
+        RB.DraftReviewBannerView.instance._onHideDialog();
     }
 }, {
     /*
      * Add some useful singletons to ReviewDialogView for managing the
      * review dialog.
      */
 
     _instance: null,