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

WEBUI-1616: rtl support (Hebrew and Arabic) #2409

Open
wants to merge 37 commits into
base: maintenance-3.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
588dacc
WEBUI-1616: rtl phase1
rakeshkumar1019 Jan 3, 2025
add552e
WEBUI-1616: rtl phase2
rakeshkumar1019 Jan 3, 2025
193bbd5
WEBUI-1616: remove rtl-setup code from index.jsp
rakeshkumar1019 Jan 3, 2025
d12f650
ELEMENTS-1779: provide RTL Support for WebUI (Hebrew and Arabic) - Pa…
rakeshkumar1019 Jan 5, 2025
5ca503c
WEBUI-1616: removed rtl-setup.js file from index.html
rakeshkumar1019 Jan 5, 2025
15e478d
WEBUI-1616: revert right-drawer$=[[_isRTL]] from index.html
rakeshkumar1019 Jan 6, 2025
dfb343f
WEBUI-1616: left: 0 on nuxeo-app
rakeshkumar1019 Jan 6, 2025
7faf088
WEBUI-1616: revert left: 0 on nuxeo-app
rakeshkumar1019 Jan 6, 2025
1cf0053
WEBUI-1616: chnages in nuxeo-app
rakeshkumar1019 Jan 6, 2025
09506b2
WEBUI-1616: chnages in nuxeo-app
rakeshkumar1019 Jan 6, 2025
d2dcf8d
WEBUI-1616: chnages in nuxeo-app
rakeshkumar1019 Jan 6, 2025
53659e3
WEBUI-1616: revert index.js
rakeshkumar1019 Jan 6, 2025
6374c33
WEBUI-1616: revert nuxeo-app & nuxeo-page
rakeshkumar1019 Jan 6, 2025
e394ff5
WEBUI-1616: revert nuxeo-app & nuxeo-page
rakeshkumar1019 Jan 6, 2025
559f0c7
WEBUI-1616: revert nuxeo-app & nuxeo-page
rakeshkumar1019 Jan 6, 2025
3b045d6
inline js
rakeshkumar1019 Jan 6, 2025
bdbea78
build
rakeshkumar1019 Jan 6, 2025
cfff511
build
rakeshkumar1019 Jan 6, 2025
678ed09
WEBUI-1616: revert a11y action
rakeshkumar1019 Jan 6, 2025
69ae125
WEBUI-1616: final code
rakeshkumar1019 Jan 6, 2025
9b9c8b7
WEBUI-1616: final code
rakeshkumar1019 Jan 6, 2025
5f8e9a0
WEBUI-1616: admin.js ftest
rakeshkumar1019 Jan 6, 2025
6b864fe
WEBUI-1616: nuxeo-menu-icon tooltip
rakeshkumar1019 Jan 7, 2025
20e1bde
WEBUI-1616: ftest browser & search
rakeshkumar1019 Jan 7, 2025
f0de379
WEBUI-1616: responsive rtl
rakeshkumar1019 Jan 7, 2025
b8ab5e8
WEBUI-1616: review comments
rakeshkumar1019 Jan 7, 2025
1dee7c7
WEBUI-1616: text number combination handle for rtl
rakeshkumar1019 Jan 14, 2025
b83834c
WEBUI-1616: toast messages for rtl
rakeshkumar1019 Jan 14, 2025
86a9f3b
WEBUI-1616: note editor, suggester & page items
rakeshkumar1019 Jan 15, 2025
9a12240
WEBUI-1616: nuxeo document tree
rakeshkumar1019 Jan 21, 2025
5d2e7d1
Merge branch 'maintenance-3.1.x' into task-WEBUI-1616-rtl-support
rakeshkumar1019 Jan 21, 2025
a1b256b
WEBUI-1616: nuxeo picture formats
rakeshkumar1019 Jan 21, 2025
038f279
WEBUI-1616: build artifact
rakeshkumar1019 Jan 21, 2025
df3a2f0
WEBUI-1616: revert nuxeo document tree
rakeshkumar1019 Jan 22, 2025
4643aad
WEBUI-1616: nuxeo document tree
rakeshkumar1019 Jan 22, 2025
3e425a9
WEBUI-1616: nuxeo-note-editor
rakeshkumar1019 Jan 23, 2025
63a78dc
webui-1616: document page & suggester
rakeshkumar1019 Jan 23, 2025
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
53 changes: 51 additions & 2 deletions elements/nuxeo-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,33 @@ Polymer({
width: var(--nuxeo-sidebar-width);
height: 53px;
top: var(--nuxeo-app-top);
left: 0;
z-index: 102;
box-sizing: border-box;
outline: none;
background-color: var(--nuxeo-sidebar-background);
}

:host([dir='rtl']) #logo {
left: auto;
right: 0;
}

:host([dir='ltr']) #logo {
left: 0;
right: auto;
}

#logo img {
width: var(--nuxeo-sidebar-width);
height: 53px;
}

:host([dir='rtl']) #logo {

Choose a reason for hiding this comment

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

duplicate property. already mentioned in 153

right: 0px;
height: 53px;
left: auto;
}

/* menu */
#menu {
@apply --nuxeo-sidebar;
Expand Down Expand Up @@ -211,6 +226,11 @@ Polymer({
cursor: pointer;
}

:host([dir='rtl']) #drawer .toggle {
left: -16px;
right: auto;
}

#drawer .toggle iron-icon {
visibility: hidden;
color: var(--nuxeo-drawer-background);
Expand All @@ -235,6 +255,11 @@ Polymer({
background-color: var(--nuxeo-drawer-background);
}

:host([dir='rtl']) #drawer iron-pages {
margin-right: var(--nuxeo-sidebar-width);
margin-left: 0;
}

#drawer nuxeo-menu-item:hover,
#drawer list-item:hover {
@apply --nuxeo-block-hover;
Expand Down Expand Up @@ -323,6 +348,7 @@ Polymer({
drawer-width="[[drawerWidth]]"
responsive-width="720px"
edge-swipe-sensitivity="0"
right-drawer$="[[_isRTL]]"
>
<div slot="drawer" role="list">
<!-- logo -->
Expand Down Expand Up @@ -394,7 +420,7 @@ Polymer({
</iron-pages>

<div class="toggle" on-tap="_closeDrawer" hidden$="[[!drawerOpened]]">
<iron-icon icon="icons:chevron-left"></iron-icon>
<iron-icon icon="[[toggleChevronIcon]]"></iron-icon>
</div>
</div>
</div>
Expand Down Expand Up @@ -597,6 +623,13 @@ Polymer({
_routedSearch: {
type: Object,
},

_isRTL: {
type: Boolean,
value: false,
reflectToAttribute: true,
observer: '_directionChanged',
},
},

listeners: {
Expand Down Expand Up @@ -641,6 +674,7 @@ Polymer({
],

ready() {
this._checkRtl();
this.$.drawerPanel.closeDrawer();
this.drawerWidth = this.sidebarWidth = getComputedStyle(this).getPropertyValue('--nuxeo-sidebar-width');
this.$.drawerPanel.$.drawer.addEventListener('transitionend', () => {
Expand Down Expand Up @@ -675,6 +709,21 @@ Polymer({
});
},

_checkRtl() {
const dir = document.documentElement.getAttribute('dir');
this._isRTL = dir === 'rtl';
},

_directionChanged(isRTL) {
if (isRTL) {
this.$.drawerPanel.setAttribute('right-drawer', '');
this.toggleChevronIcon = 'icons:chevron-right';
} else {
this.$.drawerPanel.removeAttribute('right-drawer');
this.toggleChevronIcon = 'icons:chevron-left';
}
},

_resetTaskSelection() {
this.currentTask = null;
this.currentTaskId = null;
Expand Down
30 changes: 29 additions & 1 deletion elements/nuxeo-app/nuxeo-menu-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Polymer({

<a href$="[[_href(urlFor, route, link)]]">
<paper-icon-button noink id="button" name$="[[name]]" aria-labelledby="tooltip"></paper-icon-button>
<nuxeo-tooltip for="button" position="right" offset="0" animation-delay="0" id="tooltip"
<nuxeo-tooltip for="button" position="[[_tooltipPosition]]" offset="0" animation-delay="0" id="tooltip"
>[[i18n(label)]]</nuxeo-tooltip
>
<template is="dom-if" if="[[badge]]">
Expand Down Expand Up @@ -126,10 +126,38 @@ Polymer({
badge: {
type: String,
},

_isRTL: {
type: Boolean,
value: false,
},

_tooltipPosition: {
type: String,
value: 'left',
},
},

observers: ['_srcOrIcon(icon, src)'],

ready() {
this._checkRtl();
this._handleTooltipPosition(this._isRTL);
},

_checkRtl() {
const dir = document.documentElement.getAttribute('dir');
this._isRTL = dir === 'rtl';
},

_handleTooltipPosition(isRTL) {
if (!isRTL) {
this._tooltipPosition = 'right';
} else {
this._tooltipPosition = 'left';
}
},

_srcOrIcon() {
if (this.src && this.src.length > 0) {
this.$.button.icon = '';
Expand Down
20 changes: 20 additions & 0 deletions elements/nuxeo-app/nuxeo-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Polymer({
overflow-x: auto;
}

:host([dir='rtl']) .toolbar {
border-right: 1px solid var(--divider-color);
}

#tabs {
flex: 0 0 auto;
background: var(--nuxeo-app-header-background);
Expand All @@ -67,6 +71,10 @@ Polymer({
z-index: 1;
}

:host([dir='rtl']) #tabs {
border-right: 1px solid var(--divider-color);
}

#header::slotted(*) {
overflow-x: hidden;
}
Expand All @@ -81,6 +89,12 @@ Polymer({
padding-left: 16px;
}

:host([dir="rtl"]) #header::slotted(*), /* Chrome, Safari */
:host([dir="rtl"]) #toolbar::slotted(*) {
padding-right: 16px;
padding-left: 64px;
}

@media (max-width: 720px) {
#header::slotted(*), /* chrome, safari */
#toolbar::slotted(*) {
Expand All @@ -105,4 +119,10 @@ Polymer({
`,

is: 'nuxeo-page',
ready() {
if (!this.hasAttribute('dir')) {
const direction = document.documentElement.getAttribute('dir');
this.setAttribute('dir', direction);
}
},
});
12 changes: 12 additions & 0 deletions elements/nuxeo-browser/nuxeo-breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ import { microTask } from '@polymer/polymer/lib/utils/async.js';
@apply --layout-horizontal;
}

:host([dir='rtl']) .breadcrumb {
margin: 0.5em 0 0 1em;
}

.doc-path {
width: 100%;
white-space: nowrap;
Expand All @@ -74,6 +78,10 @@ import { microTask } from '@polymer/polymer/lib/utils/async.js';
border-radius: 2px;
}

:host([dir='rtl']) .current-icon iron-icon {
margin: 0.3rem 0 0 0.5rem;
}

#ancestors {
max-width: 100%;
list-style-type: none;
Expand Down Expand Up @@ -158,6 +166,10 @@ import { microTask } from '@polymer/polymer/lib/utils/async.js';
connectedCallback() {
super.connectedCallback();
this.addEventListener('iron-resize', this._resize);
if (!this.hasAttribute('dir')) {
const direction = document.documentElement.getAttribute('dir');
this.setAttribute('dir', direction);
}
}

disconnectedCallback() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ Polymer({
nuxeo-document-create-shortcuts {
--nuxeo-document-create-shortcut-margin: 0 0 16px 0;
}

:host([dir='rtl']) #tray {

Choose a reason for hiding this comment

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

place it below the #tray css for better visibility

left: 32px;
right: auto;
overflow: hidden;
}
</style>

<nuxeo-document id="defaultDoc" doc-path="[[parent.path]]" enrichers="permissions, subtypes" response="{{parent}}">
Expand Down Expand Up @@ -128,6 +134,13 @@ Polymer({
'create-document': '_hideShortcuts',
},

ready() {
if (!this.hasAttribute('dir')) {
const direction = document.documentElement.getAttribute('dir');
this.setAttribute('dir', direction);
}
},

_parentChanged() {
if (this.parent) {
if (
Expand Down
36 changes: 33 additions & 3 deletions elements/nuxeo-document-tree/nuxeo-document-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ Polymer({
}
}

:host([dir='rtl']) {
--nuxeo-tree-children-theme: {
padding-right: 1em;
}
}

.content {
padding: 5px 0;
overflow: auto;
Expand Down Expand Up @@ -96,6 +102,10 @@ Polymer({
margin-top: -0.07rem;
}

:host([dir='rtl']) iron-icon {
margin-right: 0;
}

[toggle] {
cursor: pointer;
}
Expand Down Expand Up @@ -176,12 +186,12 @@ Polymer({
<div class="content" role="tree">
<div class="parents" hidden$="[[_noPermission]]">
<a href$="[[urlFor('document', '/')]]" class="layout horizontal" hidden$="[[_hideRoot(document)]]">
<span aria-hidden="true"><iron-icon icon="icons:chevron-left"></iron-icon></span>
<span aria-hidden="true"><iron-icon icon="[[toggleChevronIcon]]"></iron-icon></span>
<span class="parent">[[i18n('browse.root')]]</span>
</a>
<template is="dom-repeat" items="[[parents]]" as="item">
<a href$="[[urlFor(item)]]">
<span><iron-icon icon="icons:chevron-left"></iron-icon></span>
<span><iron-icon icon="[[toggleChevronIcon]]"></iron-icon></span>
<span class="parent">[[item.title]]</span>
</a>
</template>
Expand Down Expand Up @@ -248,11 +258,21 @@ Polymer({
type: Boolean,
value: false,
},
_isRtl: {
type: Boolean,
value: false,
observer: '_onRtlChange',
},
},

observers: ['_fetchDocument(docPath, visible)'],

ready() {
if (!this.hasAttribute('dir')) {
const direction = document.documentElement.getAttribute('dir');
this.setAttribute('dir', direction);
}
this._checkRtl();
window.addEventListener('nuxeo-documents-deleted', (e) => {
if (e.detail.documents) {
this.removeDocuments(e.detail.documents);
Expand Down Expand Up @@ -287,6 +307,15 @@ Polymer({
};
},

_checkRtl() {
const dir = document.documentElement.getAttribute('dir');
this._isRtl = dir === 'rtl';
},

_onRtlChange() {
this.toggleChevronIcon = this._isRtl ? 'icons:chevron-right' : 'icons:chevron-left';
},

_hideRoot(doc) {
return this.rootDocPath !== '/' || (doc && doc.type && doc.type === 'Root');
},
Expand Down Expand Up @@ -347,7 +376,8 @@ Polymer({
},

_expandIcon(opened) {
return `hardware:keyboard-arrow-${opened ? 'down' : 'right'}`;
const iconDirection = this._isRtl ? 'left' : 'right';
return `hardware:keyboard-arrow-${opened ? 'down' : iconDirection}`;
},

_icon(opened) {
Expand Down
6 changes: 6 additions & 0 deletions elements/nuxeo-home.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@
},
},

ready() {
if (!this.hasAttribute('dir')) {
this.setAttribute('dir', getComputedStyle(this).direction);
}
},

observers: ['_processTask(_selection)'],

_processTask() {
Expand Down
Loading
Loading