Mooeypoo has uploaded a new change for review.

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

Change subject: [WIP] Create a BoardDescriptionWidget
......................................................................

[WIP] Create a BoardDescriptionWidget

Encapsulate board description with an OOUI widget that works with
the new data model.

Bug:T101278
Change-Id: Idedc61a36b59864f0a751c99f3d6101b59b6baba
---
M Resources.php
M modules/flow-initialize.js
A modules/flow/ui/widgets/mw.flow.ui.BoardDescriptionWidget.js
3 files changed, 44 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/38/216038/1

diff --git a/Resources.php b/Resources.php
index 7757434..5cb2a4a 100644
--- a/Resources.php
+++ b/Resources.php
@@ -380,6 +380,7 @@
                        'flow/ui/widgets/mw.flow.ui.ToCWidget.js',
                        'flow/ui/widgets/mw.flow.ui.ReorderTopicsWidget.js',
                        'flow/ui/widgets/mw.flow.ui.NavigationWidget.js',
+                       'flow/ui/widgets/mw.flow.ui.BoardDescriptionWidget.js',
                ),
                'styles' => array(
 //                     'styles/flow/mw.flow.ui.less',
diff --git a/modules/flow-initialize.js b/modules/flow-initialize.js
index af81bc6..ddf8e67 100644
--- a/modules/flow-initialize.js
+++ b/modules/flow-initialize.js
@@ -9,7 +9,7 @@
         * @todo not like this
         */
        $( document ).ready( function () {
-               var navWidget, flowBoard, dmBoard,
+               var descriptionWidget, navWidget, flowBoard, dmBoard,
                        $component = $( '.flow-component' );
 
                // HACK: If there is no component, we are not on a flow
@@ -78,8 +78,15 @@
                /* UI Widgets */
                dmBoard = mw.flow.system.getBoard();
                navWidget = new mw.flow.ui.NavigationWidget( dmBoard );
+               descriptionWidget = new mw.flow.ui.BoardDescriptionWidget( 
dmBoard.getDescription(), $( '.flow-board-header-content' ) );
 
                $( '.flow-board-navigation' ).append( navWidget.$element );
+               $( '.flow-board-header-detail-view' )
+                       // HACK: We will need to find a good way of creating 
the OOUI js widget
+                       // out of the existing content, rather than rebuilding 
it. For the moment,
+                       // however, this is done to make sure the widget can 
display properly
+                       .empty()
+                       .append( descriptionWidget.$element );
 
                // Initialize the old system to accept the default
                // 'newest' order for the topic order widget
diff --git a/modules/flow/ui/widgets/mw.flow.ui.BoardDescriptionWidget.js 
b/modules/flow/ui/widgets/mw.flow.ui.BoardDescriptionWidget.js
new file mode 100644
index 0000000..b616789
--- /dev/null
+++ b/modules/flow/ui/widgets/mw.flow.ui.BoardDescriptionWidget.js
@@ -0,0 +1,35 @@
+( function ( $ ) {
+       /**
+        * Flow board description widget
+        *
+        * @extends OO.ui.Widget
+        *
+        * @constructor
+        * @param {mw.flow.dm.BoardDescription} model Board description model
+        * @param {Object} [config]
+        *
+        */
+       mw.flow.ui.BoardDescriptionWidget = function 
mwFlowUiBoardDescriptionWidget( model, $container, config ) {
+               config = config || {};
+
+               // Parent constructor
+               mw.flow.ui.BoardDescriptionWidget.super.call( this, config );
+
+               // TODO: Figure out a better way to work with having an 
existing content
+               // on the page. How do we work with the data-parsoid 
information (do we
+               // need it?) and if we fetch information from an existing 
element on the
+               // page, do we update the model? Do we replace this.$element 
directly
+               // or just transfer the content, like is done below?
+               this.model = model;
+               this.$content = $container && $container.clone().html();
+
+               // Initialize
+               this.$element
+                       .append( this.$content )
+                       .addClass( 'flow-ui-boardDescriptionWidget' );
+       };
+
+       /* Initialization */
+
+       OO.inheritClass( mw.flow.ui.BoardDescriptionWidget, OO.ui.Widget );
+}( jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idedc61a36b59864f0a751c99f3d6101b59b6baba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

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

Reply via email to