Merge "Update jquery.uls and adapt styling"

This commit is contained in:
jenkins-bot
2016-05-23 11:09:01 +00:00
committed by Gerrit Code Review
18 changed files with 148 additions and 100 deletions

View File

@@ -172,8 +172,6 @@
onCancel: function () {
$trigger.removeClass( 'selector-open' );
},
// Use compact version of ULS
compact: true,
languages: ulsLanguageList,
// Show common languages
quickList: self.getCommonLanguages( languages )

View File

@@ -300,20 +300,22 @@
left: displaySettings.$parent.left,
top: displaySettings.$parent.top,
onReady: function () {
var uls = this,
$back = $( '<a>' )
.data( 'i18n', 'ext-uls-back-to-display-settings' )
.i18n();
var $wrap,
uls = this,
$back = $( '<div>' )
.addClass( 'uls-icon-back' );
$back.click( function () {
uls.hide();
displaySettings.$parent.show();
} );
uls.$menu.find( 'div.uls-title-region' ).append( $back );
uls.$menu.find( 'h1.uls-title' )
.data( 'i18n', 'ext-uls-display-settings-ui-language' )
.i18n();
$wrap = $( '<div>' )
.addClass( 'uls-search-wrapper-wrapper' );
uls.$menu.find( '.uls-search-wrapper' ).wrap( $wrap );
uls.$menu.find( '.uls-search-wrapper-wrapper' ).prepend( $back );
uls.$menu.prepend(
$( '<span>' ).addClass( 'caret-before' ),
$( '<span>' ).addClass( 'caret-after' )
@@ -322,6 +324,9 @@
onVisible: function () {
var $parent;
this.$menu.find( '.uls-languagefilter' )
.prop( 'placeholder', $.i18n( 'ext-uls-display-settings-ui-language' ) );
if ( !displaySettings.$parent.$window.hasClass( 'callout' ) ) {
// Callout menus will have position rules.
// Others use the default position.
@@ -340,7 +345,7 @@
// If the ULS is shown in the the sidebar,
// add a caret pointing to the icon
if ( displaySettings.$parent.$window.hasClass( 'callout' ) ) {
this.$menu.addClass( 'callout' );
this.$menu.addClass( 'callout callout--languageselection' );
} else {
this.$menu.removeClass( 'callout' );
}

View File

@@ -326,19 +326,24 @@
top: inputSettings.$parent.top,
onReady: function () {
var uls = this,
$back = $( '<a>' )
$wrap,
$back = $( '<div>' )
.addClass( 'uls-icon-back' )
.data( 'i18n', 'ext-uls-back-to-input-settings' )
.i18n();
.i18n()
.text( ' ' );
$back.click( function () {
uls.hide();
inputSettings.$parent.show();
} );
uls.$menu.find( 'div.uls-title-region' ).append( $back );
uls.$menu.find( 'h1.uls-title' )
.data( 'i18n', 'ext-uls-input-settings-ui-language' )
.i18n();
$wrap = $( '<div>' )
.addClass( 'uls-search-wrapper-wrapper' );
uls.$menu.find( '.uls-search-wrapper' ).wrap( $wrap );
uls.$menu.find( '.uls-search-wrapper-wrapper' ).prepend( $back );
uls.$menu.prepend(
$( '<span>' ).addClass( 'caret-before' ),
$( '<span>' ).addClass( 'caret-after' )
@@ -347,6 +352,9 @@
onVisible: function () {
var $parent;
this.$menu.find( '.uls-languagefilter' )
.prop( 'placeholder', $.i18n( 'ext-uls-input-settings-ui-language' ) );
if ( !inputSettings.$parent.$window.hasClass( 'callout' ) ) {
// callout menus will have position rules. others use
// default position
@@ -364,7 +372,7 @@
}
if ( inputSettings.$parent.$window.hasClass( 'callout' ) ) {
this.$menu.addClass( 'callout' );
this.$menu.addClass( 'callout callout--languageselection' );
} else {
this.$menu.removeClass( 'callout' );
}

View File

@@ -383,9 +383,10 @@
languageSettingsOptions = {
defaultModule: 'display',
onVisible: function () {
var topRowHeight, caretHeight, caretWidth,
var caretRadius, caretPosition,
$caretBefore = $( '<span>' ).addClass( 'caret-before' ),
$caretAfter = $( '<span>' ).addClass( 'caret-after' ),
ulsTriggerHeight = this.$element.height(),
ulsTriggerWidth = this.$element.width(),
ulsTriggerOffset = this.$element.offset();
@@ -396,17 +397,22 @@
// Calculate the positioning of the panel
// according to the position of the trigger icon
caretRadius = parseInt( $caretBefore.css( 'border-top-width' ), 10 );
if ( rtlPage ) {
caretWidth = parseInt( $caretBefore.css( 'border-left-width' ), 10 );
this.left = ulsTriggerOffset.left - this.$window.width() - caretWidth;
this.left = ulsTriggerOffset.left - this.$window.width() - caretRadius;
} else {
caretWidth = parseInt( $caretBefore.css( 'border-right-width' ), 10 );
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretWidth;
this.left = ulsTriggerOffset.left + ulsTriggerWidth + caretRadius;
}
topRowHeight = this.$window.find( '.row' ).height();
caretHeight = parseInt( $caretBefore.css( 'top' ), 10 );
this.top = ulsTriggerOffset.top - topRowHeight - caretHeight / 2;
caretPosition = $caretBefore.position();
// The top of the dialog is aligned in relation to
// the middle of the trigger, so that middle of the
// caret aligns with it. 2 is for border and margin.
this.top = ulsTriggerOffset.top +
( ulsTriggerHeight / 2 ) -
( caretRadius + caretPosition.top + 2 );
this.position();
}