From 1d01e20a1378a925c5b36a1b231dd7ece3683aa1 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Thu, 8 Aug 2019 00:47:00 +0300 Subject: [PATCH] - manual merge with RTL branch; - RTL fixes; --- assets/css/um.rtl.css | 52 +++++++++- assets/dynamic_css/dynamic_profile.php | 16 +++- assets/js/um-functions.js | 99 +++++++++++--------- includes/admin/assets/css/um-admin-rtl.css | 12 +++ includes/admin/core/class-admin-settings.php | 8 +- 5 files changed, 133 insertions(+), 54 deletions(-) diff --git a/assets/css/um.rtl.css b/assets/css/um.rtl.css index 6710d105..870d67d8 100644 --- a/assets/css/um.rtl.css +++ b/assets/css/um.rtl.css @@ -10,6 +10,9 @@ .um-profile-photo a.um-profile-photo-img { float: right; left: auto; +} + +.um-cover + .um-header .um-profile-photo a.um-profile-photo-img { right: 30px; } @@ -32,7 +35,15 @@ div.uimob800 .um-header .um-profile-meta { .um-name { float: right; margin-right: 0; - margin-left: 30px; +} + +.um-profile-nav-item a { + float: right; + padding: 6px 28px 6px 10px; +} +.um-profile-nav-item i { + left: auto; + right: 6px; } .um-profile-nav-item a{float: right} @@ -97,4 +108,43 @@ div.uimob800 .um-header .um-profile-meta { p.um-notice i { right: auto; left: 14px; +} + +.um-account.uimob340 .um-account-nav a, +.um-account.uimob500 .um-account-nav a { + padding-left: 0; + padding-right: 40px; +} +.um-account.uimob340 .um-account-nav span.ico, +.um-account.uimob500 .um-account-nav span.ico { + right: 0; +} +.um-account.uimob340 .um-account-nav span.arr, +.um-account.uimob500 .um-account-nav span.arr { + right: auto; + left: 0; +} + +.select2.select2-container .select2-selection .select2-selection__arrow { + right: auto !important; +} + +.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { + padding-right: 8px; + text-align: right; + padding-left: 20px; +} + +.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear { + margin-left: 4px; +} + +.um-single-image-preview a.cancel, .um-single-file-preview a.cancel { + left: -15px; + right: auto; +} + +.cropper-container { + margin: 0 auto; + left: auto !important; } \ No newline at end of file diff --git a/assets/dynamic_css/dynamic_profile.php b/assets/dynamic_css/dynamic_profile.php index ee1628e3..85664c75 100644 --- a/assets/dynamic_css/dynamic_profile.php +++ b/assets/dynamic_css/dynamic_profile.php @@ -26,10 +26,18 @@ print " } "; -print " -.um-$form_id.um .um-profile-meta { - padding-left: $meta_padding; +if ( is_rtl() ) { + print " + .um-$form_id.um .um-profile-meta { + padding-right: $meta_padding; + } + "; +} else { + print " + .um-$form_id.um .um-profile-meta { + padding-left: $meta_padding; + } + "; } -"; ?> \ No newline at end of file diff --git a/assets/js/um-functions.js b/assets/js/um-functions.js index be0db831..76d7ea79 100644 --- a/assets/js/um-functions.js +++ b/assets/js/um-functions.js @@ -21,9 +21,9 @@ function UM_hide_menus() { menu.hide(); } -function UM_domenus(){ +function UM_domenus() { - jQuery('.um-dropdown').each(function(){ + jQuery('.um-dropdown').each( function() { var menu = jQuery(this); var element = jQuery(this).attr('data-element'); @@ -31,33 +31,41 @@ function UM_domenus(){ jQuery( element ).addClass('um-trigger-menu-on-' + menu.attr( 'data-trigger' ) ); - if ( jQuery(window).width() <= 1200 && element == 'div.um-profile-edit' ) { - position = 'lc'; + if ( position === 'lc' && jQuery('html').attr('dir') === 'rtl' ){ + position = 'rc'; + } + if ( jQuery(window).width() <= 1200 && element === 'div.um-profile-edit' ) { + if ( jQuery('html').attr('dir') === 'rtl' ){ + position = 'rc'; + } else { + position = 'lc'; + } + } - if ( position == 'lc' ){ + if ( 200 > jQuery(element).find('img').width() ) { + left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ) + ( ( jQuery(element).find('img').width() - 200 ) / 2 ); + } else { + left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ); + } - if ( 200 > jQuery(element).find('img').width() ) { - left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ) + ( ( jQuery(element).find('img').width() - 200 ) / 2 ); - } else { - left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ); - } + top_ = parseInt( jQuery(element).find('a').css('top') ); - top_ = parseInt( jQuery(element).find('a').css('top') ); + if ( top_ ) { + top_p = jQuery(element).find('img').height() + 4 + top_; + left_gap = 4; + } else { + top_p = jQuery(element).find('img').height() + 4; + left_gap = 0; + } - if ( top_ ) { - top_p = jQuery(element).find('img').height() + 4 + top_; - left_gap = 4; - } else { - top_p = jQuery(element).find('img').height() + 4; - left_gap = 0; - } + if ( top_p == 4 && element === 'div.um-cover' ) { + top_p = jQuery(element).height() / 2 + ( menu.height() / 2 ); + } else if ( top_p == 4 ) { + top_p = jQuery(element).height() + 20; + } - if ( top_p == 4 && element == 'div.um-cover' ) { - top_p = jQuery(element).height() / 2 + ( menu.height() / 2 ); - } else if ( top_p == 4 ) { - top_p = jQuery(element).height() + 20; - } + if ( position === 'lc' ) { gap_right = jQuery(element).width() + 17; menu.css({ @@ -76,36 +84,37 @@ function UM_domenus(){ 'right' : '-17px' }); - } + } else if ( position === 'rc' ) { - if ( position == 'bc' ){ + gap_right = jQuery(element).width() + 25; + menu.css({ + 'top' : 0, + 'width': 200, + 'left': gap_right + 'px', + 'right' : 'auto', + 'text-align' : 'center' + }); - if ( 200 > jQuery(element).find('img').width() ) { - left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ) + ( ( jQuery(element).find('img').width() - 200 ) / 2 ); + menu.find('.um-dropdown-arr').find('i').removeClass().addClass('um-icon-arrow-left-b'); + + menu.find('.um-dropdown-arr').css({ + 'top' : '4px', + 'left' : '-17px', + 'right' : 'auto' + }); + + } else if ( position === 'bc' ) { + + if ( jQuery('html').attr('dir') === 'rtl' ){ + rtl_gap = 10; } else { - left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ); - } - - top_ = parseInt( jQuery(element).find('a').css('top') ); - - if ( top_ ) { - top_p = jQuery(element).find('img').height() + 4 + top_; - left_gap = 4; - } else { - top_p = jQuery(element).find('img').height() + 4; - left_gap = 0; - } - - if ( top_p == 4 && element == 'div.um-cover' ) { - top_p = jQuery(element).height() / 2 + ( menu.height() / 2 ); - } else if ( top_p == 4 ) { - top_p = jQuery(element).height() + 20; + rtl_gap = 0 } menu.css({ 'top' : top_p, 'width': 200, - 'left': left_p + left_gap, + 'left': left_p + left_gap + rtl_gap, 'right' : 'auto', 'text-align' : 'center' }); diff --git a/includes/admin/assets/css/um-admin-rtl.css b/includes/admin/assets/css/um-admin-rtl.css index 3518122f..57ba3098 100644 --- a/includes/admin/assets/css/um-admin-rtl.css +++ b/includes/admin/assets/css/um-admin-rtl.css @@ -56,4 +56,16 @@ .select2-container .select2-choice > .select2-chosen { margin-right: 10px !important; margin-left: 26px !important; +} + +.um-form-fields-section { + padding: 0 0 0 10px; +} + +.um-form-fields-section { + float: right; +} + +.um-form-fields-section label input { + float: right; } \ No newline at end of file diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 60e4c217..d73e5511 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -863,12 +863,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { array( 'id' => 'profile_header_menu', 'type' => 'select', - 'label' => __( 'Profile Header Menu Position','ultimate-member' ), + 'label' => __( 'Profile Header Menu Position', 'ultimate-member' ), 'default' => um_get_metadefault('profile_header_menu'), - 'tooltip' => __('For incompatible themes, please make the menu open from left instead of bottom by default.','ultimate-member'), + 'tooltip' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.','ultimate-member'), 'options' => array( - 'bc' => 'Bottom of Icon', - 'lc' => 'Left of Icon', + 'bc' => __( 'Bottom of Icon', 'ultimate-member' ), + 'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ), ), 'size' => 'small' ),