Skip to content

Commit

Permalink
Merge pull request #28 from Unikka/bugfix/resolve-js-issues
Browse files Browse the repository at this point in the history
Fix: Prevent javascript errors in code base
  • Loading branch information
markusguenther committed Aug 18, 2023
2 parents 3eb20aa + 21abb89 commit d5b7732
Show file tree
Hide file tree
Showing 7 changed files with 2,079 additions and 1,508 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-node@v2
with:
cache: yarn
node-version: 14
node-version: 16
- run: yarn install
- run: yarn semantic-release
env:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
16
45 changes: 29 additions & 16 deletions Resources/Private/Javascript/Main.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import { UserModule, UserMenu } from './Components'
import { isNil } from './Helper'
import {UserModule, UserMenu} from './Components'
import {isNil} from './Helper'

document.addEventListener('DOMContentLoaded', function () {
const userModuleContainer = document.querySelector(
'.neos-module-administration-users'
)
if (!isNil(userModuleContainer)) {
Array.from(userModuleContainer.querySelectorAll('.neos-table')).forEach(
(_userModule) => {
if (!isNil(_userModule)) {
new UserModule(_userModule)
const initialize = () => {
const userModuleContainer = document.querySelector(
'.neos-module-administration-users'
)
if (!isNil(userModuleContainer)) {
Array.from(userModuleContainer.querySelectorAll('.neos-table')).forEach(
(_userModule) => {
if (!isNil(_userModule)) {
new UserModule(_userModule)
}
}
}
)
}

const userMenuContainer = document.querySelector(
'#neos-top-bar .neos-user-menu'
)
if (!isNil(userMenuContainer)) {
new UserMenu(userMenuContainer)
}
}

const userMenuContainer = document.querySelector(
'#neos-top-bar .neos-user-menu'
)
if (!isNil(userMenuContainer)) {
new UserMenu(userMenuContainer)
if (window.Typo3Neos.I18n.initialized) {
initialize()
} else {
const interval = setInterval(() => {
if (window.Typo3Neos.I18n.initialized) {
clearInterval(interval)
initialize()
}
}, 50)
}
})
8 changes: 4 additions & 4 deletions Resources/Private/Javascript/Templates/ImpersonateButton.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {isNil} from "../Helper"

const impersonateIcon = '<i class="fas fa-random icon-white"></i>'
const localizedTooltip = !isNil(window.Typo3Neos) ?
window.Typo3Neos.I18n.translate('tooltip.impersonateUserButton', 'Login as this user', 'Unikka.LoginAs') :
'Login as this user';

const ImpersonateButton = (identifier, disabled) => {
const localizedTooltip = !isNil(window.Typo3Neos) ?
window.Typo3Neos.I18n.translate('tooltip.impersonateUserButton', 'Login as this user', 'Unikka.LoginAs') :
'Login as this user';
const attributesObject = {
'data-neos-toggle': 'tooltip',
'data-original-title': localizedTooltip,
'title': localizedTooltip,
'data-user-identifier': identifier,
class: 'neos-button neos-button-primary impersonate-user',
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/Javascript/Main.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
"cz-adapter-eslint": "^0.3.0",
"parcel": "^2.5.0",
"prettier": "^2.2.1",
"process": "^0.11.10",
"semantic-release": "^17.0.8"
},
"engines": {
"node": "14"
"node": "16"
},
"browserslist": "> 0.25%, not dead",
"config": {
Expand Down
3,525 changes: 2,041 additions & 1,484 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit d5b7732

Please sign in to comment.