Skip to content
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

fix(item-options): rtl better suport #11188

Merged
merged 3 commits into from
Apr 17, 2017
Merged

fix(item-options): rtl better suport #11188

merged 3 commits into from
Apr 17, 2017

Conversation

jlucfarias
Copy link

@jlucfarias jlucfarias commented Apr 12, 2017

Short description of what this resolves:

fix the side of item-options component when rtl

Ionic Version: 1.x / 2.x / 3.x

Fixes partially: #11115

for sliding items

*Note:* need tests
@jlucfarias
Copy link
Author

@AmitMY


/**
* @hidden
*/
getSides(): number {
if (isPresent(this.side) && this.side === 'left') {
if (isPresent(this.side) && this.side === 'left' && !_plt.isRTL()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This misses 'right' and ltr (I get that you set it as default, just a tiny bit odd. Great work though.

What do you think of?

if (isPresent(this.side))
	switch(this.side) {
		case 'left':
			return _plt.isRTL()? ITEM_SIDE_FLAG_RIGHT: ITEM_SIDE_FLAG_LEFT;
		case 'right':
			return _plt.isRTL()? ITEM_SIDE_FLAG_LEFT: ITEM_SIDE_FLAG_RIGHT;
	}

return ITEM_SIDE_FLAG_RIGHT;

@jlucfarias
Copy link
Author

Can you review now, @AmitMY?

@AmitMY
Copy link
Contributor

AmitMY commented Apr 17, 2017

This looks much better, nice job!


Note: If #11233 gets merged, the sliding item will also need to subscribe to the dirChanged event emitter I added, and to change accordingly in real time. Fun stuff ahead.


@brandyscarney Anything else here?

Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Added some comments. :)

case 'right':
return ITEM_SIDE_FLAG_RIGHT;
case 'start':
return _plt.isRTL() ? ITEM_SIDE_FLAG_RIGHT : ITEM_SIDE_FLAG_LEFT;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be this._plt.isRTL()

case 'start':
return _plt.isRTL() ? ITEM_SIDE_FLAG_RIGHT : ITEM_SIDE_FLAG_LEFT;
case 'end':
return _plt.isRTL() ? ITEM_SIDE_FLAG_LEFT : ITEM_SIDE_FLAG_RIGHT;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

if (isPresent(this.side) && this.side === 'left') {
return ITEM_SIDE_FLAG_LEFT;
if (isPresent(this.side)) {
switch(this.side) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add whitespace to make it: switch (this.side) (it is giving me linter errors)

@jlucfarias
Copy link
Author

@AmitMY if #11233 gets merged, can you help me to implement this? because i'm really new in angular and I don't know how to do what is needed to change the side on runtime

@brandyscarney
Copy link
Member

Thanks @John-Luke! Do the latest changes look good to you @AmitMY? :)

@AmitMY
Copy link
Contributor

AmitMY commented Apr 17, 2017

@brandyscarney It now looks even better :)
@John-Luke Sure thing. It is not a tiny PR, so probably will be merged in a while, but when/if it will I will add the necessary subscription for run-time update

@brandyscarney brandyscarney merged commit ea6450e into ionic-team:master Apr 17, 2017
@brandyscarney
Copy link
Member

Merged, thanks! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants