Skip to content

Commit

Permalink
style: Vanilla JS cleansing
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Sep 12, 2023
1 parent 6de56cf commit 37bf74b
Show file tree
Hide file tree
Showing 46 changed files with 31 additions and 258 deletions.
7 changes: 0 additions & 7 deletions lib/Rozier/src/Resources/app/Lazyload.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import AttributeValuePosition from './components/attribute-values/AttributeValue
import NodeTypeFieldEdit from './components/node-type-fields/NodeTypeFieldEdit'
import CustomFormFieldsPosition from './components/custom-form-fields/CustomFormFieldsPosition'
import NodeTreeContextActions from './components/trees/NodeTreeContextActions'
import Import from './components/import/Import'
import NodeEditSource from './components/node/NodeEditSource'
import InputLengthWatcher from './widgets/InputLengthWatcher'
import ChildrenNodesField from './widgets/ChildrenNodesField'
Expand Down Expand Up @@ -364,13 +363,7 @@ export default class Lazyload {

// Switch checkboxes
this.initBootstrapSwitches()

window.Rozier.getMessages()

if (typeof window.Rozier.importRoutes !== 'undefined' && window.Rozier.importRoutes !== null) {
window.Rozier.import = new Import(window.Rozier.importRoutes)
window.Rozier.importRoutes = null
}
}

generalUnbind(objects) {
Expand Down
2 changes: 0 additions & 2 deletions lib/Rozier/src/Resources/app/api/DocumentApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export function getDocumentsByIds({ ids = [] }) {
}
})
.catch((error) => {
// TODO
// Log request error or display a message
throw new Error(error.response.data.humanMessage)
})
Expand Down Expand Up @@ -77,7 +76,6 @@ export function getDocuments({ searchTerms, filters, filterExplorerSelection, mo
}
})
.catch((error) => {
// TODO
// Log request error or display a message
throw new Error(error)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ export default class AttributeValuePosition {
constructor() {
this.$list = $('.attribute-value-forms > .uk-sortable')
this.currentRequest = null

// Bind methods
this.onSortableChange = this.onSortableChange.bind(this)

this.init()
}

Expand Down
119 changes: 0 additions & 119 deletions lib/Rozier/src/Resources/app/components/import/Import.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default class NodeEditSource {
this.$dropdown = null
this.$input = null

// Binded methods
this.onInputKeyDown = this.onInputKeyDown.bind(this)
this.onInputKeyUp = this.onInputKeyUp.bind(this)
this.inputFocus = this.inputFocus.bind(this)
Expand Down
26 changes: 9 additions & 17 deletions lib/Rozier/src/Resources/app/components/panels/EntriesPanel.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
import $ from 'jquery'

/**
* Entries panel
*/
export default class EntriesPanel {
constructor() {
this.$adminMenuNav = $('#admin-menu-nav')
this.adminMenuNav = document.getElementById('admin-menu-nav')
this.replaceSubNavs()
}

replaceSubNavs() {
this.$adminMenuNav.find('.uk-nav-sub').each((index, element) => {
let subMenu = $(element)

subMenu.attr('style', 'display:block;')

const top = subMenu.offset().top
const height = subMenu.height()

subMenu.removeAttr('style')
/** @var {HTMLElement} element */
this.adminMenuNav.querySelectorAll('.uk-nav-sub').forEach((element) => {
element.style.display = 'block'
const top = element.getBoundingClientRect().top
const height = element.getBoundingClientRect().height
element.style.display = null

if (top + height + 20 > $(window).height()) {
subMenu.parent().addClass('reversed-nav')
if (top + height + 20 > window.innerHeight) {
element.parentElement.classList.add('reversed-nav')
}
})
}
Expand Down
8 changes: 3 additions & 5 deletions lib/Rozier/src/Resources/app/components/tabs/MainTreeTabs.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import $ from 'jquery'

const STORAGE_KEY = 'roadiz.currentMainTreeTab'

export default class MainTreeTabs {
constructor() {
this.onTabChange = this.onTabChange.bind(this)
this.tabsMenu = $('#tree-menu')
const treeMenu = document.getElementById('tree-menu')
const currentTabId = window.localStorage.getItem(STORAGE_KEY)

if (this.tabsMenu) {
window.UIkit.tab(this.tabsMenu, {
if (treeMenu) {
this.tabsMenu = window.UIkit.tab(treeMenu, {
connect: '#tree-container',
swiping: false,
active: currentTabId ? Number.parseInt(currentTabId) : 0,
Expand Down
11 changes: 0 additions & 11 deletions lib/Rozier/src/Resources/app/containers/TagsEditorContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@
group-label="name"
@tag="addTag"
@input="tagsUpdateValue">

<!--<template slot="option" scope="props">-->
<!--<div class="option__desc">-->
<!--<span class="option__name">{{ props.option.name }}</span>-->
<!--<span class="option__children">-->
<!--{{ props.option.children }}-->

<!--</span>-->
<!--</div>-->
<!--</template>-->

</multiselect>
<pre class="language-json"><code>{{ value }}</code></pre>
</div>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

34 changes: 0 additions & 34 deletions lib/Rozier/src/Resources/app/less/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,6 @@
* @author Adrien Scholaert <adrien@rezo-zero.com>
*/

/* -------- FONTS -------- */
@font-face {
font-family: 'Roadiz';
src: url('../fonts/roadiz-sans/RoadizSans-Light.woff2') format('woff2'),
url('../fonts/roadiz-sans/RoadizSans-Light.woff') format('woff');
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Roadiz';
src: url('../fonts/roadiz-sans/RoadizSans-Regular.woff2') format('woff2'),
url('../fonts/roadiz-sans/RoadizSans-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Roadiz';
src: url('../fonts/roadiz-sans/RoadizSans-Medium.woff2') format('woff2'),
url('../fonts/roadiz-sans/RoadizSans-Medium.woff') format('woff');
font-weight: bold;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Roadiz Mono';
src: url('../fonts/roadiz-sans/RoadizSans-Mono.woff2') format('woff2'),
url('../fonts/roadiz-sans/RoadizSans-Mono.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}

html,
body,
h1, h2, h3, h4, h5, h6,
Expand Down
3 changes: 0 additions & 3 deletions lib/Rozier/src/Resources/app/less/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@


/* -------- FONTS -------- */

//@main-font: 'Roadiz', system-ui;
//@roadiz-mono-font: 'Roadiz Mono', monospace;
@main-font: system-ui;
@roadiz-mono-font: monospace;
@roadiz-light: 300;
Expand Down
7 changes: 1 addition & 6 deletions lib/Rozier/src/Resources/app/widgets/ChildrenNodesField.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ export default class ChildrenNodesField {

treeAvailable() {
let $nodeTree = this.$fields.find('.nodetree-widget')

if ($nodeTree.length) {
return true
} else {
return false
}
return !!$nodeTree.length
}

onQuickAddClick(event) {
Expand Down
2 changes: 0 additions & 2 deletions lib/Rozier/src/Resources/app/widgets/NodeTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default class NodeTree {
constructor() {
// Selectors
this.$content = $('.content-node-tree')
this.$elements = null
this.$dropdown = null

// Methods
Expand All @@ -23,7 +22,6 @@ export default class NodeTree {
*/
init() {
this.contentHeight = this.$content.actual('outerHeight')

if (this.contentHeight >= window.Rozier.windowHeight - 400) this.dropdownFlip()
}

Expand Down
1 change: 0 additions & 1 deletion lib/Rozier/src/Resources/app/widgets/SaveButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default class SaveButtons {

// Bind method
this.onClick = this.onClick.bind(this)

this.bindKeyboard()

if (this.$button.length && this.$actionMenu.length) {
Expand Down
5 changes: 1 addition & 4 deletions lib/Rozier/src/Resources/app/widgets/YamlEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import $ from 'jquery'
*/
export default class YamlEditor {
/**
* @param $textarea
* @param {jQuery} $textarea
* @param index
*/
constructor($textarea, index) {
Expand Down Expand Up @@ -59,9 +59,6 @@ export default class YamlEditor {
this.init()
}

/**
* Init
*/
init() {
if (this.$textarea.length) {
this.editor.on('change', this.textareaChange)
Expand Down
4 changes: 2 additions & 2 deletions lib/Rozier/src/Resources/views/partials/css-inject.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<link href="{{ asset('css/vendor.c385c7e785cae6757716.css', 'Rozier') }}" rel="stylesheet">
<link href="{{ asset('css/vendor.00b2be12b114cc414b2c.css', 'Rozier') }}" rel="stylesheet">

<link href="{{ asset('css/app.02cad77caad05b1c36f6.css', 'Rozier') }}" rel="stylesheet">
<link href="{{ asset('css/app.bd1efb846a65ba8724e5.css', 'Rozier') }}" rel="stylesheet">



Expand Down
Loading

0 comments on commit 37bf74b

Please sign in to comment.