Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Jan 2, 2025
1 parent bbd58a6 commit 6583e53
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 8 additions & 3 deletions js/src/vue/EntitySelector/EntitySelector.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
/* global hotkeys, typewatch, initTooltips */
import {ref} from 'vue';
import {onMounted, ref} from 'vue';
import TreeView from "../Components/TreeView.vue";
const props = defineProps({
Expand Down Expand Up @@ -43,6 +43,7 @@
const clear_search_message = __("Clear search");
const select_all_message = __("Select all");
const search_placeholder_message = __("Search entity");
const change_entity_url = ref(null);
// when the shortcut for entity form is called
hotkeys('ctrl+alt+e, option+command+e', async function(e) {
Expand All @@ -56,7 +57,7 @@
const entity_data = ref([]);
$.ajax({
url: CFG_GLPI.root_doc + "/ajax/entitytreesons.php",
url: window.CFG_GLPI.root_doc + "/ajax/entitytreesons.php",
type: "GET",
}).then((data) => {
entity_data.value = data;
Expand All @@ -68,6 +69,10 @@
folder_open: 'ti ti-stack-2',
item: 'ti ti-stack',
};
onMounted(() => {
change_entity_url.value = `${window.CFG_GLPI.root_doc}/Session/ChangeEntity`;
})
</script>

<template>
Expand All @@ -87,7 +92,7 @@
</span>
</div>

<form :id="`switch_to_full_structure_${rand}`" method="post" :action="`${CFG_GLPI.root_doc}/Session/ChangeEntity`">
<form :id="`switch_to_full_structure_${rand}`" method="post" :action="change_entity_url">
<input type="hidden" name="full_structure" value="true">
<input type="hidden" name="_glpi_csrf_token" :value="csrf_token" />
</form>
Expand Down
4 changes: 1 addition & 3 deletions templates/layout/parts/profile_selector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,13 @@
<div class="dropdown dropstart" id="entity-tree-dropdown-{{ rand }}">
</div>

<script type="text/javascript">
$(function() {
<script type="module">
window.Vue.createApp(window.Vue.components['EntitySelector/EntitySelector'].component, {
current_entity: '{{ current_entity|e('js') }}',
current_entity_short: '{{ current_entity_short|e('js') }}',
rand: '{{ rand }}',
target: '{{ target }}',
csrf_token: '{{ csrf_token() }}',
}).mount('#entity-tree-dropdown-{{ rand }}');
});
</script>
{% endif %}

0 comments on commit 6583e53

Please sign in to comment.