[MediaWiki-commits] [Gerrit] Hygiene: Introduce Icon.js abstraction - change (mediawiki...MobileFrontend)
jenkins-bot has submitted this change and it was merged. Change subject: Hygiene: Introduce Icon.js abstraction .. Hygiene: Introduce Icon.js abstraction This allows easy creation of icons using a standard markup. Change-Id: Ie82924357d76fe0072c2255bc530c20063537462 --- M includes/Resources.php M javascripts/CtaDrawer.js A javascripts/Icon.js M javascripts/Overlay.js M javascripts/modules/editor/EditorOverlayBase.js M javascripts/modules/issues/issues.js M javascripts/modules/references/references.js M javascripts/modules/search/SearchOverlay.js M javascripts/modules/toc/toc.js M javascripts/modules/uploads/UploadTutorial.js M templates/Overlay.hogan D templates/backButton.hogan D templates/cancelButton.hogan M templates/ctaDrawer.hogan A templates/icon.hogan M templates/modules/editor/EditorOverlayBase.hogan M templates/modules/editor/EditorOverlayHeader.hogan M templates/modules/editor/VisualEditorOverlayHeader.hogan M templates/modules/editor/switcher.hogan M templates/modules/mediaViewer/ImageOverlay.hogan M templates/modules/references/ReferencesDrawer.hogan M templates/modules/search/SearchOverlay.hogan M templates/modules/talk/talkSectionAddHeader.hogan M templates/modules/talk/talkSectionHeader.hogan M templates/modules/toc/toc.hogan M templates/modules/uploads/PhotoUploadProgress.hogan M templates/modules/uploads/UploadTutorial.hogan 27 files changed, 105 insertions(+), 30 deletions(-) Approvals: Phuedx: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Resources.php b/includes/Resources.php index 34c146c..516cad5 100644 --- a/includes/Resources.php +++ b/includes/Resources.php @@ -171,12 +171,16 @@ 'messages' => array( 'mobile-frontend-language-article-heading', ), + 'templates' => array( + 'icon.hogan', + ), 'scripts' => array( 'javascripts/Router.js', 'javascripts/OverlayManager.js', // FIXME: Remove api code to mobile.ajax 'javascripts/api.js', 'javascripts/PageApi.js', + 'javascripts/Icon.js', 'javascripts/Panel.js', 'javascripts/Section.js', 'javascripts/Page.js', @@ -578,8 +582,6 @@ 'mobile-frontend-overlay-continue', ), 'templates' => array( - 'backButton.hogan', - 'cancelButton.hogan', 'Overlay.hogan', 'LoadingOverlay.hogan', ), diff --git a/javascripts/CtaDrawer.js b/javascripts/CtaDrawer.js index ce1c37f..7ae4916 100644 --- a/javascripts/CtaDrawer.js +++ b/javascripts/CtaDrawer.js @@ -1,5 +1,6 @@ ( function( M, $ ) { var Drawer = M.require( 'Drawer' ), + Icon = M.require( 'Icon' ), CtaDrawer; /** @@ -11,6 +12,7 @@ */ CtaDrawer = Drawer.extend( { defaults: { + collapseButton: new Icon( { name: 'arrow-down', additionalClassNames: 'cancel' } ).toHtmlString(), loginCaption: mw.msg( 'mobile-frontend-watchlist-cta-button-login' ), signupCaption: mw.msg( 'mobile-frontend-watchlist-cta-button-signup' ) }, diff --git a/javascripts/Icon.js b/javascripts/Icon.js new file mode 100644 index 000..b971e83 --- /dev/null +++ b/javascripts/Icon.js @@ -0,0 +1,33 @@ +( function( M ) { + + var View = M.require( 'View' ), + Icon; + + /** +* A {@link View} that pops up from the bottom of the screen. +* @class Drawer +* @extends Panel +*/ + Icon = View.extend( { + defaults: { + hasText: false, + tagName: 'div', + base: 'icon', + name: '', + modifier: '' + }, + initialize: function( options ) { + if ( options.hasText ) { + options.modifier = 'icon-text'; + } + View.prototype.initialize.call( this, options ); + }, + toHtmlString: function() { + return this.$el.html(); + }, + template: M.template.get( 'icon.hogan' ) + } ); + + M.define( 'Icon', Icon ); + +}( mw.mobileFrontend ) ); diff --git a/javascripts/Overlay.js b/javascripts/Overlay.js index 539b005..057d437 100644 --- a/javascripts/Overlay.js +++ b/javascripts/Overlay.js @@ -3,6 +3,7 @@ var View = M.require( 'View' ), + Icon = M.require( 'Icon' ), $window = $( window )
[MediaWiki-commits] [Gerrit] Hygiene: Introduce Icon.js abstraction - change (mediawiki...MobileFrontend)
Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/165937 Change subject: Hygiene: Introduce Icon.js abstraction .. Hygiene: Introduce Icon.js abstraction This allows easy creation of icons using a standard markup. Change-Id: Ie82924357d76fe0072c2255bc530c20063537462 --- M includes/Resources.php M javascripts/CtaDrawer.js A javascripts/Icon.js M javascripts/Overlay.js M javascripts/modules/editor/EditorOverlayBase.js M javascripts/modules/issues/issues.js M javascripts/modules/references/references.js M javascripts/modules/search/SearchOverlay.js M javascripts/modules/toc/toc.js M javascripts/modules/uploads/UploadTutorial.js M templates/Overlay.hogan D templates/backButton.hogan D templates/cancelButton.hogan M templates/ctaDrawer.hogan A templates/icon.hogan M templates/modules/editor/EditorOverlayBase.hogan M templates/modules/editor/EditorOverlayHeader.hogan M templates/modules/editor/VisualEditorOverlayHeader.hogan M templates/modules/editor/switcher.hogan M templates/modules/mediaViewer/ImageOverlay.hogan M templates/modules/references/ReferencesDrawer.hogan M templates/modules/search/SearchOverlay.hogan M templates/modules/talk/talkSectionAddHeader.hogan M templates/modules/talk/talkSectionHeader.hogan M templates/modules/toc/toc.hogan M templates/modules/uploads/PhotoUploadProgress.hogan M templates/modules/uploads/UploadTutorial.hogan 27 files changed, 105 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/37/165937/1 diff --git a/includes/Resources.php b/includes/Resources.php index b0ccef6..bd8e12e 100644 --- a/includes/Resources.php +++ b/includes/Resources.php @@ -171,12 +171,16 @@ 'messages' => array( 'mobile-frontend-language-article-heading', ), + 'templates' => array( + 'icon.hogan', + ), 'scripts' => array( 'javascripts/Router.js', 'javascripts/OverlayManager.js', // FIXME: Remove api code to mobile.ajax 'javascripts/api.js', 'javascripts/PageApi.js', + 'javascripts/Icon.js', 'javascripts/Panel.js', 'javascripts/Section.js', 'javascripts/Page.js', @@ -577,8 +581,6 @@ 'mobile-frontend-overlay-continue', ), 'templates' => array( - 'backButton.hogan', - 'cancelButton.hogan', 'Overlay.hogan', 'LoadingOverlay.hogan', ), diff --git a/javascripts/CtaDrawer.js b/javascripts/CtaDrawer.js index ce1c37f..273b45a 100644 --- a/javascripts/CtaDrawer.js +++ b/javascripts/CtaDrawer.js @@ -1,5 +1,6 @@ ( function( M, $ ) { var Drawer = M.require( 'Drawer' ), + Icon = M.require( 'Icon' ), CtaDrawer; /** @@ -11,6 +12,7 @@ */ CtaDrawer = Drawer.extend( { defaults: { + collapseButton: new Icon( { name: 'down', additionalClassNames: 'cancel' } ), loginCaption: mw.msg( 'mobile-frontend-watchlist-cta-button-login' ), signupCaption: mw.msg( 'mobile-frontend-watchlist-cta-button-signup' ) }, diff --git a/javascripts/Icon.js b/javascripts/Icon.js new file mode 100644 index 000..b971e83 --- /dev/null +++ b/javascripts/Icon.js @@ -0,0 +1,33 @@ +( function( M ) { + + var View = M.require( 'View' ), + Icon; + + /** +* A {@link View} that pops up from the bottom of the screen. +* @class Drawer +* @extends Panel +*/ + Icon = View.extend( { + defaults: { + hasText: false, + tagName: 'div', + base: 'icon', + name: '', + modifier: '' + }, + initialize: function( options ) { + if ( options.hasText ) { + options.modifier = 'icon-text'; + } + View.prototype.initialize.call( this, options ); + }, + toHtmlString: function() { + return this.$el.html(); + }, + template: M.template.get( 'icon.hogan' ) + } ); + + M.define( 'Icon', Icon ); + +}( mw.mobileFrontend ) ); diff --git a/javascripts/Overlay.js b/javascripts/Overlay.js index 4bb4801..01ed7d7 100644 --- a/javascripts/Overlay.js +++ b/javascripts/Overlay.js @@ -3,6 +3,7 @@ var View = M.require( 'View' ), + Icon = M.require( 'Ico