-
Notifications
You must be signed in to change notification settings - Fork 92
Dropdown Alignment for locale names - Fix #19, #127 #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Dropdown Alignment for locale names - Fix #19, #127 #159
Conversation
Probably
I don't know how I feel about the styling of that dropdown. Screenshot? |
@sushain97 , After this PR, i would set up travis locally too. Please (pliss) pardon me on this one :P |
On it! |
@share-with-me it looks a bit too much like a button now and not enough like a select looks. The |
@sushain97 , I have updated the styling of the dropdown button. It looks like this now: |
Does the alignment of “English” match that of a normal select? Seems to be center instead of right?
… On Jul 6, 2017, at 10:48 AM, Monish Godhia ***@***.***> wrote:
@sushain97 <https://github.com/sushain97> , I have updated the styling of the dropdown button. It looks like this now:
<https://user-images.githubusercontent.com/8894636/27916939-2bbb5db0-6288-11e7-8d05-9f0ca0e21133.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#159 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEBEfreXwIVepA3CIo06iuvnSqZNW-qoks5sLPOrgaJpZM4OLP3q>.
|
Yes.
… On Jul 6, 2017, at 10:58 AM, Monish Godhia ***@***.***> wrote:
Seems to be center instead of right?
Um, 'English' should appear in the left if that is what you are saying?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#159 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEBEftPGZYdgUZXg7UJB8i3BVMOyaujSks5sLPYsgaJpZM4OLP3q>.
|
Made the changes @sushain97 ! Made some changes in logic too after determining an edge case that was failing. |
Added the appropriate paddings! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions
assets/js/localization.js
Outdated
@@ -115,6 +117,8 @@ $(document).ready(function () { | |||
window.history.replaceState({}, document.title, newURL); | |||
} | |||
} | |||
|
|||
$('#localeDropdownCaret').css('left', rtlLanguages.indexOf(locale) !== -1 ? '5%' : '90%'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assets/js/localization.js
Outdated
.text(this[1]) | ||
.prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
.css('padding-left', rtlLanguages.indexOf(this[0]) !== -1 ? '115px' : '5px') | ||
.css('padding-right', rtlLanguages.indexOf(this[0]) !== -1 ? '5px' : '115px') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this seems a bit brittle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, by brittle, do you mean that the logic to align the languages could be improved? Um, what suggestions do you have?
assets/js/localization.js
Outdated
$('#localeDropdown').append( | ||
$('<li></li>').append( | ||
$('<a>', { | ||
href: 'index.' + this[0] + '.html' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current locale dropdown does not do this. We do not want to force a page refresh for switching languages! That's not great UX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm yes. I would try to use the same logic and update this.
@@ -90,9 +90,11 @@ | |||
<p data-text="tagline" class="tagline"></p> | |||
</div> | |||
<div style="width: 35%" class="pull-right hidden-xs"> | |||
<!-- <i class="icon-globe localeGlobe pull-right"></i> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D
@sushain97 , Made all the changes. Also implemented the functionality where the page is not forced to refresh now. I have emulated the existing functionality :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work switching to the right behavior, some concerns
assets/js/localization.js
Outdated
$('#localeDropdown').append( | ||
$('<li></li>').append( | ||
$('<a>', { | ||
rel: this[0] // eslint-disable-line id-length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be a valid value for the rel
attribute per https://www.w3.org/TR/html5/links.html#linkTypes. Have you tried using something like data-locale
? Note that jQuery has a helpful $.data()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it.
assets/js/localization.js
Outdated
.prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
.css('padding-left', rtlLanguages.indexOf(this[0]) !== -1 ? '105px' : '5px') | ||
.css('padding-right', rtlLanguages.indexOf(this[0]) !== -1 ? '5px' : '105px') | ||
.hover( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go in CSS if at all possible. Is there a reason you put it here? CSS transitions might be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, yep. It does make sense to put it in CSS. Would change it
assets/js/localization.js
Outdated
.text(this[1]) | ||
.prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') | ||
.css('padding-left', rtlLanguages.indexOf(this[0]) !== -1 ? '105px' : '5px') | ||
.css('padding-right', rtlLanguages.indexOf(this[0]) !== -1 ? '5px' : '105px') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to use text-align
instead and then add padding on both sides?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
assets/js/localization.js
Outdated
rel: this[0] // eslint-disable-line id-length | ||
}) | ||
.text(this[1]) | ||
.prop('dir', rtlLanguages.indexOf(this[0]) !== -1 ? 'rtl' : 'ltr') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it would be worth not exporting rtlLanguages
and instead a function like isRtlLanguage
or something like that... I don't recall if we use rtlLanguages
for any other purpose though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, would making a function instead serve better? The entire usage of rtlLanguages
is to determine if it is present in that particular array. Should I make a function instead?
Something like:
function isRtlLanguage(lang) {
return rtlLanguages.indexOf(lang) !== -1;
}
Um, but isn't scrollbar appearing 'always' a specific setting in OS? Are you suggesting that I could override it to always show?
I’m pretty certain it can also be done with CSS.
Also, if not, then when the user changes the settings of scrollbar, the appropriate margin gets added automatically right?
I don’t think it’s a margin per se. It’s out of the browser’s control.
… On Aug 10, 2017, at 12:26 AM, Monish Godhia ***@***.***> wrote:
Um, but isn't scrollbar appearing 'always' a specific setting in OS? Are you suggesting that I could override it to always show? Also, if not, then when the user changes the settings of scrollbar, the appropriate margin gets added automatically right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#159 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEBEfl2O6hjVllURbz94V65eJFnYbrf8ks5sWoZ7gaJpZM4OLP3q>.
|
@sushain97 , referring to this link, I have added the necessary CSS. Could you check how it looks now? |
assets/css/style.css
Outdated
@@ -338,6 +376,18 @@ body { | |||
text-decoration: none; | |||
} | |||
|
|||
@media(device-width: 768px) and (device-height: 1024px){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small concern. I also still think we can get rid of localeToLanguageMap
! I think you need to use $('.someElement').data('locale-name', 'blah')
.
assets/css/style.css
Outdated
@@ -338,6 +376,18 @@ body { | |||
text-decoration: none; | |||
} | |||
|
|||
@media(device-width: 768px) and (device-height: 1024px) { | |||
::-webkit-scrollbar { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this applies to all scrollbars on the page. We only want to affect the language dropdown one!
Thank you @sushain97 :D. I actually managed to achieve it. |
Implemented both :D |
assets/js/localization.js
Outdated
$('<li></li>').append( | ||
$('<a>', { | ||
'data-locale': this[0] | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use .data('locale', this[0])
for the sake of consistency?
assets/js/localization.js
Outdated
$.each(localePairs, function () { | ||
var isRtlLanguage = (rtlLanguages.indexOf(this[0]) !== -1); | ||
$('.localeSelect').append( | ||
$('<option></option>') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that "</option>"
is required here?
Made the changes. |
assets/js/localization.js
Outdated
.data('locale', this[0]) | ||
.text(this[1]) | ||
.prop('dir', isRtlLanguage ? 'rtl' : 'ltr') | ||
.css({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, on second thought, this should all go in the stylesheet. All you need to do is #localeDropdown li[dir='rtl'] { ... }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes but doing a git rebase
now is causing conflicts :/ .
Implemented the CSS changes. |
Screenshot? |
This looks good to me. I guess mostly we need it tested on OS X, though. @sushain97 ? |
Hm, it appears good to me if I remove:
Why did you add this? |
I had referred to some stackoverflow link and I was not sure how to test. I'd remove the media queries and update it now. |
Removed the media queries @sushain97 . |
This PR aims to fix #19 and #127 . I make use of a
bootstrap dropdown
to display thelocales
. This dropdown is visible only on larger (non-mobile devices) and it reverts to the currentselect
feature for displaying thelocales
while on mobile devices.Currently, for 3 lanaguages, the
bootstrap button
does not display the name of the locale. For instance,qaraqalpaksha
. I could not find this name (and 2 others) anywhere (neither inlanguages
nor iniso639Codes
and hence, am unable to populate this name currently ). How are theselect options
for these languages getting populated in the current functionality?