-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
f8f926d
commit b6cf000
Showing
28 changed files
with
764 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
services: | ||
EzSystems\EzPlatformAdminUi\Search\AbstractPagerContentToDataMapper: | ||
abstract: true | ||
autowire: true | ||
public: false | ||
|
||
EzSystems\EzPlatformAdminUi\Search\PagerSearchContentToDataMapper: | ||
parent: EzSystems\EzPlatformAdminUi\Search\AbstractPagerContentToDataMapper | ||
autowire: true | ||
public: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(function(global, doc) { | ||
const languageSelector = doc.querySelector('.ez-search-form__language-selector'); | ||
const submitForm = (event) => { | ||
event.target.closest('form').submit(); | ||
}; | ||
|
||
if (!languageSelector) { | ||
return; | ||
} | ||
|
||
languageSelector.addEventListener('change', submitForm, false); | ||
})(window, document); |
77 changes: 77 additions & 0 deletions
77
src/bundle/Resources/public/js/scripts/button.translation.edit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
(function(global, doc) { | ||
class EditTranslation { | ||
constructor(config) { | ||
this.container = config.container; | ||
this.toggler = config.container.querySelector('.ez-btn--translations-list-toggler'); | ||
this.translationsList = config.container.querySelector('.ez-translation-selector__list-wrapper'); | ||
this.listTriangle = config.container.querySelector('.ez-translation-selector__list-triangle'); | ||
|
||
this.hideTranslationsList = this.hideTranslationsList.bind(this); | ||
this.showTranslationsList = this.showTranslationsList.bind(this); | ||
this.setPosition = this.setPosition.bind(this); | ||
} | ||
|
||
setPosition() { | ||
const togglerRect = this.toggler.getBoundingClientRect(); | ||
const translationsListRect = this.translationsList.getBoundingClientRect(); | ||
const topPosition = togglerRect.top + togglerRect.height / 2 - translationsListRect.height / 2; | ||
const leftPosition = togglerRect.left - translationsListRect.width - 10; | ||
|
||
if (topPosition + translationsListRect.height > window.innerHeight) { | ||
this.translationsList.style.bottom = 0; | ||
this.translationsList.style.top = 'auto'; | ||
|
||
const translationsListRect = this.translationsList.getBoundingClientRect(); | ||
const listTriangleTopPosition = | ||
((togglerRect.top + togglerRect.height / 2 - translationsListRect.top) / translationsListRect.height) * 100; | ||
|
||
this.listTriangle.style.top = listTriangleTopPosition < 90 ? `${listTriangleTopPosition}%` : '90%'; | ||
} else { | ||
this.translationsList.style.top = `${topPosition}px`; | ||
this.translationsList.style.bottom = 'auto'; | ||
this.listTriangle.style.top = '50%'; | ||
} | ||
|
||
this.translationsList.style.left = `${leftPosition}px`; | ||
|
||
this.translationsList.classList.remove('ez-translation-selector__list-wrapper--visually-hidden'); | ||
} | ||
|
||
hideTranslationsList(event) { | ||
const closestTranslationSelector = event.target.closest('.ez-translation-selector'); | ||
const clickedOnTranslationsList = closestTranslationSelector && closestTranslationSelector.isSameNode(this.container); | ||
const clickedOnDraftConflictModal = event.target.closest('.ez-modal--version-draft-conflict'); | ||
|
||
if (clickedOnTranslationsList || clickedOnDraftConflictModal) { | ||
return; | ||
} | ||
|
||
this.translationsList.classList.add('ez-translation-selector__list-wrapper--hidden'); | ||
this.translationsList.classList.add('ez-translation-selector__list-wrapper--visually-hidden'); | ||
|
||
global.removeEventListener('scroll', this.setPosition, false); | ||
doc.removeEventListener('click', this.hideTranslationsList, false); | ||
} | ||
|
||
showTranslationsList() { | ||
this.translationsList.classList.remove('ez-translation-selector__list-wrapper--hidden'); | ||
|
||
this.setPosition(); | ||
|
||
global.addEventListener('scroll', this.setPosition, false); | ||
doc.addEventListener('click', this.hideTranslationsList, false); | ||
} | ||
|
||
init() { | ||
this.toggler.addEventListener('click', this.showTranslationsList, false); | ||
} | ||
} | ||
|
||
const translationSelectors = doc.querySelectorAll('.ez-translation-selector'); | ||
|
||
translationSelectors.forEach((translationSelector) => { | ||
const editTranslation = new EditTranslation({ container: translationSelector }); | ||
|
||
editTranslation.init(); | ||
}); | ||
})(window, document); |
64 changes: 64 additions & 0 deletions
64
src/bundle/Resources/public/scss/_translation-selector.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.ez-translation-selector { | ||
&__list-wrapper { | ||
display: block; | ||
position: fixed; | ||
opacity: 1; | ||
text-align: left; | ||
background-color: $ez-color-secondary; | ||
padding: calculateRem(9px); | ||
border-radius: calculateRem(4px); | ||
|
||
&--hidden { | ||
display: none; | ||
} | ||
|
||
&--visually-hidden { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
&__list-triangle { | ||
position: absolute; | ||
right: 0; | ||
top: 50%; | ||
transform: translate(100%, -50%); | ||
|
||
&:after { | ||
content: ''; | ||
width: 0; | ||
height: 0; | ||
border-style: solid; | ||
border-width: calculateRem(5px) 0 calculateRem(5px) calculateRem(5px); | ||
border-color: transparent transparent transparent $ez-color-secondary; | ||
position: absolute; | ||
z-index: 1; | ||
} | ||
} | ||
|
||
&__title { | ||
color: $ez-white; | ||
font-size: calculateRem(16px); | ||
line-height: 2; | ||
font-weight: bold; | ||
} | ||
|
||
&__list { | ||
display: flex; | ||
flex-direction: column; | ||
background-color: $ez-ground-base; | ||
padding: calculateRem(8px); | ||
max-height: calculateRem(300px); | ||
overflow: auto; | ||
|
||
.ez-btn--content-edit { | ||
background-color: $ez-white; | ||
color: $ez-color-secondary; | ||
padding: calculateRem(9px) calculateRem(24px); | ||
text-align: left; | ||
|
||
&:not(:last-child) { | ||
margin-bottom: calculateRem(8px); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.