jenkins-bot has submitted this change and it was merged.

Change subject: Beta welcome dialog
......................................................................


Beta welcome dialog

For configured wikis, show a dialog that welcomes the user to the
amazing and fantabulous world of VisualEditing, which is not only full of
wonderment and joy but also may lead to increased popularity and love.

The dialog only shows up once (uses a cookie).

Change-Id: I8e7c4dc2c63b36594378a543b9d66291395eebcf
---
M VisualEditor.hooks.php
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
A modules/ve-mw/ui/dialogs/ve.ui.MWBetaWelcomeDialog.js
M modules/ve-mw/ui/styles/ve.ui.MWDialog.css
M modules/ve/ui/styles/ve.ui.Dialog.css
M modules/ve/ui/ve.ui.Dialog.js
8 files changed, 116 insertions(+), 2 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 88059ed..3fee364 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -270,7 +270,7 @@
                                '/common/images/magnify-clip' .
                                ( $wgContLang->isRTL() ? '-rtl' : '' ) . '.png',
                        'pageLanguageCode' => 
$out->getTitle()->getPageLanguage()->getHtmlCode(),
-                       'pageLanguageDir' => 
$out->getTitle()->getPageLanguage()->getDir(),
+                       'pageLanguageDir' => 
$out->getTitle()->getPageLanguage()->getDir()
                );
 
                return true;
@@ -287,7 +287,8 @@
                        $wgVisualEditorNamespaces,
                        $wgVisualEditorPluginModules,
                        $wgVisualEditorTabPosition,
-                       $wgVisualEditorTabMessages;
+                       $wgVisualEditorTabMessages,
+                       $wgVisualEditorShowBetaWelcome;
 
                $vars['wgVisualEditorConfig'] = array(
                        'disableForAnons' => $wgVisualEditorDisableForAnons,
@@ -302,6 +303,7 @@
                        'skins' => self::$supportedSkins,
                        'tabPosition' => $wgVisualEditorTabPosition,
                        'tabMessages' => $wgVisualEditorTabMessages,
+                       'showBetaWelcome' => $wgVisualEditorShowBetaWelcome,
                );
 
                return true;
diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 1da0d2f..3a6b269 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -88,6 +88,9 @@
        'visualeditor-dialog-transclusion-remove-param' => 'Remove parameter',
        'visualeditor-dialog-transclusion-remove-template' => 'Remove template',
        'visualeditor-dialog-transclusion-title' => 'Transclusion',
+       'visualeditor-dialog-beta-welcome-title' => 'Welcome to VisualEditor',
+       'visualeditor-dialog-beta-welcome-content' => 'This is our new, easier 
way to edit. It\'s still in beta, which means you might find parts of the page 
you can\'t edit, or encounter issues that need to be fixed. You can keep using 
our old editor by clicking the "$1" tab instead.',
+       'visualeditor-dialog-beta-welcome-action-continue' => 'Continue',
        'visualeditor-dialogbutton-media-tooltip' => 'Media',
        'visualeditor-dialogbutton-meta-tooltip' => 'Page settings',
        'visualeditor-dialogbutton-reference-tooltip' => 'Reference',
@@ -343,6 +346,9 @@
        'visualeditor-dialog-transclusion-remove-param' => 'Label for button 
that removes a parameter from a template',
        'visualeditor-dialog-transclusion-remove-template' => 'Label for button 
that removes a template from a transclusion.
 {{Identical|Remove template}}',
+       'visualeditor-dialog-beta-welcome-title' => 'Title of the beta welcome 
dialog',
+       'visualeditor-dialog-beta-welcome-content' => 'Text explaining 
VisualEditor is in beta. Parameters: $1 is the text for #ca-edit',
+       'visualeditor-dialog-beta-welcome-action-continue' => 'Text to close 
the dialog and continue using visual editor',
        'visualeditor-dialog-transclusion-title' => 
'{{Identical|Transclusion}}',
        'visualeditor-dialogbutton-media-tooltip' => '{{Identical|Media}}',
        'visualeditor-dialogbutton-meta-tooltip' => '{{Identical|Page 
Settings}}',
diff --git a/VisualEditor.php b/VisualEditor.php
index 0eb7f35..7ec15ef 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -494,6 +494,7 @@
 
                        've/ui/dialogs/ve.ui.PagedDialog.js',
                        've-mw/ui/dialogs/ve.ui.MWMetaDialog.js',
+                       've-mw/ui/dialogs/ve.ui.MWBetaWelcomeDialog.js',
                        've-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js',
                        've-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js',
                        've-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js',
@@ -625,6 +626,9 @@
                        'visualeditor-dialog-transclusion-remove-template',
                        'visualeditor-dialog-transclusion-title',
                        'visualeditor-dialog-transclusion-wikitext-label',
+                       'visualeditor-dialog-beta-welcome-title',
+                       'visualeditor-dialog-beta-welcome-content',
+                       'visualeditor-dialog-beta-welcome-action-continue',
                        'visualeditor-dialogbutton-media-tooltip',
                        'visualeditor-dialogbutton-meta-tooltip',
                        'visualeditor-dialogbutton-reference-tooltip',
@@ -776,6 +780,9 @@
 // Whether to enable incomplete experimental code
 $wgVisualEditorEnableExperimentalCode = false;
 
+// Whether to show the "welcome to the beta" dialog the first time a user uses 
VisualEditor
+$wgVisualEditorShowBetaWelcome = false;
+
 // Where to put the VisualEditor edit tab
 // 'before': put it right before the old edit tab
 // 'after': put it right after the old edit tab
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 520f152..3e8d241 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -323,6 +323,9 @@
                        this.setupBeforeUnloadHandler();
                        this.$document[0].focus();
                        this.activating = false;
+                       if ( mw.config.get( 'wgVisualEditorConfig' 
).showBetaWelcome ) {
+                               this.showBetaWelcome();
+                       }
                        mw.hook( 've.activationComplete' ).fire();
                }, this ) );
        }
@@ -2230,6 +2233,16 @@
 };
 
 /**
+ * Show beta welcome dialog if first load.
+ */
+ve.init.mw.ViewPageTarget.prototype.showBetaWelcome = function () {
+       if ( $.cookie( 've-beta-welcome-dialog' ) === null ) {
+               this.surface.getDialogs().open( 'mwBetaWelcome' );
+       }
+       $.cookie( 've-beta-welcome-dialog', 1, { 'path': '/', 'expires': 30 } );
+};
+
+/**
  * Handle page show event.
  *
  * @method
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWBetaWelcomeDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWBetaWelcomeDialog.js
new file mode 100644
index 0000000..dd7af30
--- /dev/null
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWBetaWelcomeDialog.js
@@ -0,0 +1,68 @@
+/*!
+ * VisualEditor user interface MWBetaWelcomeDialog class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Dialog for inserting MediaWiki media objects.
+ *
+ * @class
+ * @extends ve.ui.MWDialog
+ *
+ * @constructor
+ * @param {ve.ui.Surface} surface
+ * @param {Object} [config] Config options
+ */
+ve.ui.MWBetaWelcomeDialog = function VeUiMWBetaWelcomeDialog( surface, config 
) {
+       // Configuration initialization
+       config = ve.extendObject( {}, config, { 'small': true, 'footless': 
false } );
+
+       // Parent constructor
+       ve.ui.MWDialog.call( this, surface, config );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ui.MWBetaWelcomeDialog, ve.ui.MWDialog );
+
+/* Static Properties */
+
+ve.ui.MWBetaWelcomeDialog.static.titleMessage = 
'visualeditor-dialog-beta-welcome-title';
+
+ve.ui.MWBetaWelcomeDialog.static.icon = 'help';
+
+/* Methods */
+
+/**
+ * @inheritdoc
+ */
+ve.ui.MWBetaWelcomeDialog.prototype.initialize = function () {
+       // Parent method
+       ve.ui.MWDialog.prototype.initialize.call( this );
+
+       // Properties
+       this.$content = this.$$( '<div>' )
+               .addClass( 've-ui-mwBetaWelcomeDialog-content' )
+               .text(
+                       ve.msg( 'visualeditor-dialog-beta-welcome-content', $( 
'#ca-edit' ).text() )
+               );
+
+       this.continueButton = new ve.ui.ButtonWidget( {
+               '$$': this.$$,
+               'label': ve.msg( 
'visualeditor-dialog-beta-welcome-action-continue' ),
+               'flags': ['primary']
+       } );
+
+       // Events
+       this.continueButton.connect( this, { 'click': [ 'close', 'close' ] } );
+
+       // Initialization
+       this.$body.append( this.$content );
+       this.$foot.append( this.continueButton.$ );
+};
+
+/* Registration */
+
+ve.ui.dialogFactory.register( 'mwBetaWelcome', ve.ui.MWBetaWelcomeDialog );
diff --git a/modules/ve-mw/ui/styles/ve.ui.MWDialog.css 
b/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
index 63b1fff..bb2712d 100644
--- a/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
+++ b/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
@@ -72,6 +72,14 @@
        background: #F8F8F8;
 }
 
+/* ve.ui.MWBetaWelcomeDialog */
+
+.ve-ui-mwBetaWelcomeDialog-content {
+       padding: 1.5em;
+       line-height: 1.25em;
+       font-size: 1.1em;
+}
+
 /* ve.ui.MWMediaInsertDialog */
 
 .ve-ui-mwMediaInsertDialog-select {
diff --git a/modules/ve/ui/styles/ve.ui.Dialog.css 
b/modules/ve/ui/styles/ve.ui.Dialog.css
index 68049ce..a79f677 100644
--- a/modules/ve/ui/styles/ve.ui.Dialog.css
+++ b/modules/ve/ui/styles/ve.ui.Dialog.css
@@ -52,6 +52,12 @@
        animation: ve-ui-zoom-in 250ms ease-in-out 0 1 normal;
 }
 
+.ve-ui-dialog .ve-ui-window-frame.ve-ui-window-frame-small {
+       width: 600px;
+       min-height: 200px;
+       height: 200px;
+}
+
 .ve-ui-dialog-closing .ve-ui-window-frame {
        -webkit-animation: ve-ui-zoom-in 250ms ease-in-out 0 1 reverse;
        -moz-animation: ve-ui-zoom-in 250ms ease-in-out 0 1 reverse;
diff --git a/modules/ve/ui/ve.ui.Dialog.js b/modules/ve/ui/ve.ui.Dialog.js
index 5c0ca60..95e88e4 100644
--- a/modules/ve/ui/ve.ui.Dialog.js
+++ b/modules/ve/ui/ve.ui.Dialog.js
@@ -27,6 +27,7 @@
        // Properties
        this.visible = false;
        this.footless = !!config.footless;
+       this.small = !!config.small;
        this.onWindowMouseWheelHandler = ve.bind( this.onWindowMouseWheel, this 
);
        this.onDocumentKeyDownHandler = ve.bind( this.onDocumentKeyDown, this );
 
@@ -154,6 +155,9 @@
        if ( this.footless ) {
                this.frame.$content.addClass( 've-ui-dialog-content-footless' );
        }
+       if ( this.small ) {
+               this.$frame.addClass( 've-ui-window-frame-small' );
+       }
        this.closeButton.$.addClass( 've-ui-window-closeButton' );
        this.$head.append( this.closeButton.$ );
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8e7c4dc2c63b36594378a543b9d66291395eebcf
Gerrit-PatchSet: 17
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to