Trevor Parscal has uploaded a new change for review.

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

Change subject: Make it possible to toggle the outline in a booklet layout
......................................................................

Make it possible to toggle the outline in a booklet layout

And in apex, we animate the layout change.

Change-Id: I28fd4e2c4c1d2ca726865c0bc152cd6bda62d7f1
---
M src/layouts/OO.ui.BookletLayout.js
M src/themes/apex/layouts/OO.ui.BookletLayout.less
2 files changed, 38 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/93/116893/1

diff --git a/src/layouts/OO.ui.BookletLayout.js 
b/src/layouts/OO.ui.BookletLayout.js
index d6cb341..4aaead3 100644
--- a/src/layouts/OO.ui.BookletLayout.js
+++ b/src/layouts/OO.ui.BookletLayout.js
@@ -25,6 +25,7 @@
        this.ignoreFocus = false;
        this.stackLayout = new OO.ui.StackLayout( { '$': this.$, 'continuous': 
!!config.continuous } );
        this.autoFocus = !!config.autoFocus;
+       this.outlineVisible = false;
        this.outlined = !!config.outlined;
        if ( this.outlined ) {
                this.editable = !!config.editable;
@@ -35,6 +36,7 @@
                this.gridLayout = new OO.ui.GridLayout(
                        [this.outlinePanel, this.stackLayout], { '$': this.$, 
'widths': [1, 2] }
                );
+               this.outlineVisible = true;
                if ( this.editable ) {
                        this.outlineControlsWidget = new 
OO.ui.OutlineControlsWidget(
                                this.outlineWidget,
@@ -170,6 +172,30 @@
 };
 
 /**
+ * Check if booklet has editing controls.
+ *
+ * @method
+ * @returns {boolean} Booklet is outlined
+ */
+OO.ui.BookletLayout.prototype.isOutlineVisible = function () {
+       return this.outlined && this.outlineVisible;
+};
+
+/**
+ *
+ * @chainable
+ */
+OO.ui.BookletLayout.prototype.toggleOutline = function ( state ) {
+       if ( this.outlined ) {
+               state = state === undefined ? !this.outlineVisible : !!state;
+               this.outlineVisible = state;
+               this.gridLayout.layout( state ? [ 1, 2 ] : [ 0, 1 ], [ 1 ] );
+       }
+
+       return this;
+};
+
+/**
  * Get the outline widget.
  *
  * @method
diff --git a/src/themes/apex/layouts/OO.ui.BookletLayout.less 
b/src/themes/apex/layouts/OO.ui.BookletLayout.less
index 4214900..ef08585 100644
--- a/src/themes/apex/layouts/OO.ui.BookletLayout.less
+++ b/src/themes/apex/layouts/OO.ui.BookletLayout.less
@@ -1,6 +1,17 @@
+@import '../../../styles/mixins';
+
 /* OO.ui.BookletLayout */
 
 .oo-ui-bookletLayout {
+       > .oo-ui-gridLayout > .oo-ui-panelLayout {
+               .oo-ui-transition(
+                       width 250ms ease-in-out,
+                       height 250ms ease-in-out,
+                       top 250ms ease-in-out,
+                       left 250ms ease-in-out
+               );
+       }
+
        &-outlinePanel {
                border-right: solid 1px #ddd;
 
@@ -8,4 +19,4 @@
                        box-shadow: 0 0 0.25em rgba(0,0,0,0.25);
                }
        }
-}
\ No newline at end of file
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28fd4e2c4c1d2ca726865c0bc152cd6bda62d7f1
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <tpars...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to