Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/232850

Change subject: Make it possible to add static footers to popups
......................................................................

Make it possible to add static footers to popups

* Make 'buffer' a configurable option in ClippableElement
* Add a $footer option to popups that is outside the $body, so they
  will be outside the $clippable element (which for popups is defined
  as the $body.

Change-Id: Id4bbe14ba0bf6c26e8aa93635bf618a1cda7fc0d
---
M src/mixins/ClippableElement.js
M src/widgets/PopupWidget.js
2 files changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/50/232850/1

diff --git a/src/mixins/ClippableElement.js b/src/mixins/ClippableElement.js
index 06281e5..f670079 100644
--- a/src/mixins/ClippableElement.js
+++ b/src/mixins/ClippableElement.js
@@ -10,6 +10,8 @@
  *
  * @constructor
  * @param {Object} [config] Configuration options
+ * @cfg {number} [buffer] A height buffer for clipping the $clippable nodes. 
This can be used
+ *  to add a footer that always appears.
  * @cfg {jQuery} [$clippable] Nodes to clip, assigned to #$clippable, omit to 
use #$element
  */
 OO.ui.mixin.ClippableElement = function OoUiMixinClippableElement( config ) {
@@ -17,6 +19,7 @@
        config = config || {};
 
        // Properties
+       this.buffer = config.buffer || 7; // Chosen by fair dice roll
        this.$clippable = null;
        this.clipping = false;
        this.clippedHorizontally = false;
@@ -161,7 +164,7 @@
                return this;
        }
 
-       var buffer = 7, // Chosen by fair dice roll
+       var buffer = this.buffer,
                cOffset = this.$clippable.offset(),
                $container = this.$clippableContainer.is( 'html, body' ) ?
                        this.$clippableWindow : this.$clippableContainer,
diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index a542aa8..99b2653 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -38,6 +38,7 @@
  *  [3]: https://www.mediawiki.org/wiki/OOjs_UI/Widgets/Popups#containerExample
  * @cfg {number} [containerPadding=10] Padding between the popup and its 
container, specified as a number of pixels.
  * @cfg {jQuery} [$content] Content to append to the popup's body
+ * @cfg {jQuery} [$footer] Content to append to the popup's footer
  * @cfg {boolean} [autoClose=false] Automatically close the popup when it 
loses focus.
  * @cfg {jQuery} [$autoCloseIgnore] Elements that will not close the popup 
when clicked.
  *  This config option is only relevant if #autoClose is set to `true`. See 
the [OOjs UI docs on MediaWiki][2]
@@ -64,6 +65,7 @@
        // Properties
        this.$popup = $( '<div>' );
        this.$head = $( '<div>' );
+       this.$footer = $( '<div>' );
        this.$anchor = $( '<div>' );
        // If undefined, will be computed lazily in updateDimensions()
        this.$container = config.$container;
@@ -92,9 +94,12 @@
        if ( !config.head ) {
                this.$head.addClass( 'oo-ui-element-hidden' );
        }
+       if ( !config.$footer ) {
+               this.$footer.addClass( 'oo-ui-element-hidden' );
+       }
        this.$popup
                .addClass( 'oo-ui-popupWidget-popup' )
-               .append( this.$head, this.$body );
+               .append( this.$head, this.$body, this.$footer );
        this.$element
                .addClass( 'oo-ui-popupWidget' )
                .append( this.$popup, this.$anchor );
@@ -102,6 +107,9 @@
        if ( config.$content instanceof jQuery ) {
                this.$body.append( config.$content );
        }
+       if ( config.$footer instanceof jQuery ) {
+               this.$footer.append( config.$footer );
+       }
        if ( config.padded ) {
                this.$body.addClass( 'oo-ui-popupWidget-body-padded' );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/232850
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4bbe14ba0bf6c26e8aa93635bf618a1cda7fc0d
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to