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
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/components/item/item-options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Directive, ElementRef, EventEmitter, Input, Output, Renderer } from '@angular/core';

import { Platform } from '../../platform/platform';
import { isPresent} from '../../util/util';
import { ITEM_SIDE_FLAG_LEFT, ITEM_SIDE_FLAG_RIGHT, ItemSliding } from './item-sliding';

Expand Down Expand Up @@ -39,14 +40,23 @@ export class ItemOptions {
*/
@Output() ionSwipe: EventEmitter<ItemSliding> = new EventEmitter<ItemSliding>();

constructor(private _elementRef: ElementRef, private _renderer: Renderer) {}
constructor(private _elementRef: ElementRef, private _renderer: Renderer, private _plt: Platform) {}

/**
* @hidden
*/
getSides(): number {
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)

case 'left':
return ITEM_SIDE_FLAG_LEFT;
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 '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

}
}
return ITEM_SIDE_FLAG_RIGHT;
}
Expand Down