[MediaWiki-commits] [Gerrit] Make BookletLayout inherit from MenuLayout instead of embedd... - change (oojs/ui)

2015-01-31 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Make BookletLayout inherit from MenuLayout instead of embedding 
a GridLayout
..


Make BookletLayout inherit from MenuLayout instead of embedding a GridLayout

Change-Id: I16fe6226929ca99b851dfd4b39f7c99f7b4621f9
TODO: Consider murdering GridLayout with a blunt object.
---
M build/modules.json
M demos/pages/dialogs.js
M src/layouts/BookletLayout.js
3 files changed, 105 insertions(+), 18 deletions(-)

Approvals:
  Jforrester: Looks good to me, but someone else must approve
  Trevor Parscal: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/build/modules.json b/build/modules.json
index f0e76c4..f24b1fd 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -39,13 +39,13 @@
"src/dialogs/MessageDialog.js",
"src/dialogs/ProcessDialog.js",
 
-   "src/layouts/BookletLayout.js",
"src/layouts/FieldLayout.js",
"src/layouts/ActionFieldLayout.js",
"src/layouts/FieldsetLayout.js",
"src/layouts/FormLayout.js",
"src/layouts/GridLayout.js",
"src/layouts/MenuLayout.js",
+   "src/layouts/BookletLayout.js",
"src/layouts/PanelLayout.js",
"src/layouts/PageLayout.js",
"src/layouts/StackLayout.js",
diff --git a/demos/pages/dialogs.js b/demos/pages/dialogs.js
index 6414ac5..6483476 100644
--- a/demos/pages/dialogs.js
+++ b/demos/pages/dialogs.js
@@ -184,16 +184,48 @@
};
BookletDialog.prototype.initialize = function () {
BookletDialog.super.prototype.initialize.apply( this, arguments 
);
-   this.bookletLayout = new OO.ui.BookletLayout( { $: this.$, 
outlined: true } );
+
+   var dialog = this;
+
+   function changePage( direction ) {
+   var pageIndex = dialog.pages.indexOf( 
dialog.bookletLayout.getCurrentPage() );
+   pageIndex = ( dialog.pages.length + pageIndex + 
direction ) % dialog.pages.length;
+   dialog.bookletLayout.setPage( dialog.pages[ pageIndex 
].getName() );
+   }
+
+   this.navigationField = new OO.ui.FieldLayout(
+   new OO.ui.ButtonGroupWidget( {
+   items: [
+   new OO.ui.ButtonWidget( {
+   data: 'previous',
+   icon: 'previous'
+   } ).on( 'click', function () {
+   changePage( -1 );
+   } ),
+   new OO.ui.ButtonWidget( {
+   data: 'next',
+   icon: 'next'
+   } ).on( 'click', function () {
+   changePage( 1 );
+   } )
+   ]
+   } ),
+   {
+   label: 'Change page',
+   align: 'top'
+   }
+   );
+
+   this.bookletLayout = new OO.ui.BookletLayout( { $: this.$ } );
this.pages = [
-   new SamplePage( 'small', { $: this.$, label: 'Small', 
icon: 'window' } ),
-   new SamplePage( 'medium', { $: this.$, label: 'Medium', 
icon: 'window' } ),
-   new SamplePage( 'large', { $: this.$, label: 'Large', 
icon: 'window' } ),
-   new SamplePage( 'larger', { $: this.$, label: 'Larger', 
icon: 'window' } ),
-   new SamplePage( 'full', { $: this.$, label: 'Full', 
icon: 'window' } )
+   new SamplePage( 'page-1', { $: this.$, label: 'Page 1', 
icon: 'window' } ),
+   new SamplePage( 'page-2', { $: this.$, label: 'Page 2', 
icon: 'window' } ),
+   new SamplePage( 'page-3', { $: this.$, label: 'Page 3', 
icon: 'window' } )
];
this.bookletLayout.addPages( this.pages );
this.bookletLayout.connect( this, { set: 'onBookletLayoutSet' } 
);
+   this.bookletLayout.setPage( 'page-1' );
+
this.$body.append( this.bookletLayout.$element );
};
BookletDialog.prototype.getActionProcess = function ( action ) {
@@ -205,10 +237,52 @@
return BookletDialog.super.prototype.getActionProcess.call( 
this, action );
};
BookletDialog.prototype

[MediaWiki-commits] [Gerrit] Make BookletLayout inherit from MenuLayout instead of embedd... - change (oojs/ui)

2015-01-30 Thread Esanders (Code Review)
Esanders has uploaded a new change for review.

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

Change subject: Make BookletLayout inherit from MenuLayout instead of embedding 
a GridLayout
..

Make BookletLayout inherit from MenuLayout instead of embedding a GridLayout

Change-Id: I16fe6226929ca99b851dfd4b39f7c99f7b4621f9
TODO: Consider murdering GridLayout with a blunt object.
---
M build/modules.json
M demos/pages/dialogs.js
M src/layouts/BookletLayout.js
3 files changed, 105 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/24/187824/1

diff --git a/build/modules.json b/build/modules.json
index f0e76c4..f24b1fd 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -39,13 +39,13 @@
"src/dialogs/MessageDialog.js",
"src/dialogs/ProcessDialog.js",
 
-   "src/layouts/BookletLayout.js",
"src/layouts/FieldLayout.js",
"src/layouts/ActionFieldLayout.js",
"src/layouts/FieldsetLayout.js",
"src/layouts/FormLayout.js",
"src/layouts/GridLayout.js",
"src/layouts/MenuLayout.js",
+   "src/layouts/BookletLayout.js",
"src/layouts/PanelLayout.js",
"src/layouts/PageLayout.js",
"src/layouts/StackLayout.js",
diff --git a/demos/pages/dialogs.js b/demos/pages/dialogs.js
index 6414ac5..6483476 100644
--- a/demos/pages/dialogs.js
+++ b/demos/pages/dialogs.js
@@ -184,16 +184,48 @@
};
BookletDialog.prototype.initialize = function () {
BookletDialog.super.prototype.initialize.apply( this, arguments 
);
-   this.bookletLayout = new OO.ui.BookletLayout( { $: this.$, 
outlined: true } );
+
+   var dialog = this;
+
+   function changePage( direction ) {
+   var pageIndex = dialog.pages.indexOf( 
dialog.bookletLayout.getCurrentPage() );
+   pageIndex = ( dialog.pages.length + pageIndex + 
direction ) % dialog.pages.length;
+   dialog.bookletLayout.setPage( dialog.pages[ pageIndex 
].getName() );
+   }
+
+   this.navigationField = new OO.ui.FieldLayout(
+   new OO.ui.ButtonGroupWidget( {
+   items: [
+   new OO.ui.ButtonWidget( {
+   data: 'previous',
+   icon: 'previous'
+   } ).on( 'click', function () {
+   changePage( -1 );
+   } ),
+   new OO.ui.ButtonWidget( {
+   data: 'next',
+   icon: 'next'
+   } ).on( 'click', function () {
+   changePage( 1 );
+   } )
+   ]
+   } ),
+   {
+   label: 'Change page',
+   align: 'top'
+   }
+   );
+
+   this.bookletLayout = new OO.ui.BookletLayout( { $: this.$ } );
this.pages = [
-   new SamplePage( 'small', { $: this.$, label: 'Small', 
icon: 'window' } ),
-   new SamplePage( 'medium', { $: this.$, label: 'Medium', 
icon: 'window' } ),
-   new SamplePage( 'large', { $: this.$, label: 'Large', 
icon: 'window' } ),
-   new SamplePage( 'larger', { $: this.$, label: 'Larger', 
icon: 'window' } ),
-   new SamplePage( 'full', { $: this.$, label: 'Full', 
icon: 'window' } )
+   new SamplePage( 'page-1', { $: this.$, label: 'Page 1', 
icon: 'window' } ),
+   new SamplePage( 'page-2', { $: this.$, label: 'Page 2', 
icon: 'window' } ),
+   new SamplePage( 'page-3', { $: this.$, label: 'Page 3', 
icon: 'window' } )
];
this.bookletLayout.addPages( this.pages );
this.bookletLayout.connect( this, { set: 'onBookletLayoutSet' } 
);
+   this.bookletLayout.setPage( 'page-1' );
+
this.$body.append( this.bookletLayout.$element );
};
BookletDialog.prototype.getActionProcess = function ( action ) {
@@ -205,10 +237,52 @@
return BookletDialog.super.prototype.getActionProcess.call( 
this, action );
};
BookletDialog.prototype.onBookletLayoutSet = function ( pag