Skip to content

Commit

Permalink
New feature: View adele mod settings
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderJacob committed Jan 24, 2024
1 parent d5894cd commit e9a3283
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$PAGE->requires->js_call_amd('local_adele/app-lazy', 'init');

echo <<<'EOT'
<div id="local-adele-app">
<div id="local-adele-app" name="local-adele-app">
<router-view></router-view>
</div>
EOT;
Expand Down
1 change: 1 addition & 0 deletions lang/en/local_adele.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
$string['btncancel'] = 'cancel';
$string['btnupdate_positions'] = 'update positions';
$string['btntoggle'] = 'change view';
$string['btnreload'] = 'Reload Page';

// From Strings.
$string['fromlearningtitel'] = 'Learning Path Titel';
Expand Down
26 changes: 16 additions & 10 deletions vue3/components/NotFound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,34 @@

<template>
<div class="NotFound">
<h2>{{ strings.route_not_found_site_name }}</h2>
<h3>{{ strings.route_not_found }}</h3>
<h2>{{ store.state.strings.route_not_found_site_name }}</h2>
<h3>{{ store.state.strings.route_not_found }}</h3>

<div class="learninggoals-edit-add">
<router-link
:to="{ name: 'learninggoals-edit-overview' }"
tag="button"
class="btn btn-primary"
>
{{ strings.learninggoal_form_title_add }}
{{ store.state.strings.btnreload }}
</router-link>
</div>
</div>
</template>

<script>
import { mapState } from 'vuex';
<script setup>
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { useStore } from 'vuex'
const store = useStore()
const router = useRouter()

export default {
name: "NotFound",
computed: mapState(['strings']),
created: function() {
}
onMounted(() => {
if(router.value == undefined && store.state.view){
router.push({ name: 'learninggoals-edit-overview' });
}
});



</script>
20 changes: 11 additions & 9 deletions vue3/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ function init() {

app.use(store);
const localAdeleAppElement = document.getElementById('local-adele-app');
const viewAttributeValue = localAdeleAppElement.getAttribute('view');
store.state.view = viewAttributeValue;
const pathAttributeValue = localAdeleAppElement.getAttribute('learningpath');
store.state.learningGoalID = pathAttributeValue;
const userAttributeValue = localAdeleAppElement.getAttribute('user');
store.state.user = userAttributeValue;

app.use(router);
app.mount('#local-adele-app');
if (localAdeleAppElement) {
const viewAttributeValue = localAdeleAppElement.getAttribute('view');
store.state.view = viewAttributeValue;
const pathAttributeValue = localAdeleAppElement.getAttribute('learningpath');
store.state.learningGoalID = pathAttributeValue;
const userAttributeValue = localAdeleAppElement.getAttribute('user');
store.state.user = userAttributeValue;

app.use(router);
app.mount('#local-adele-app');
}
}

export { init };

0 comments on commit e9a3283

Please sign in to comment.