Skip to content

Commit

Permalink
add admin app basics
Browse files Browse the repository at this point in the history
  • Loading branch information
rlucke committed Jun 28, 2024
1 parent 9e654ac commit a92230b
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
vendor/
composer.lock
package-lock.json
package-lock.json
dist/
15 changes: 14 additions & 1 deletion KIToolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@

require_once __DIR__ . '/vendor/autoload.php';

class KIToolbox extends StudIPPlugin implements StandardPlugin
class KIToolbox extends StudIPPlugin implements StandardPlugin, SystemPlugin
{
public function __construct()
{
parent::__construct();

$perm = $GLOBALS['perm'];
if ($perm->have_perm('root')) {
$item = new Navigation($this->_('KI-Toolbox konfigurieren'), PluginEngine::getLink($this, array(), 'admin'));
if (Navigation::hasItem('/admin/config') && !Navigation::hasItem('/admin/config/kitoolbox')) {
Navigation::addItem('/admin/config/kitoolbox', $item);
}
}

PageLayout::addScript($this->getPluginUrl() . '/dist/kitoolbox.js', [
'type' => 'module',
'rel' => 'preload',
]);

PageLayout::addScript($this->getPluginUrl() . '/dist/kitoolbox-admin.js', [
'type' => 'module',
'rel' => 'preload',
]);

PageLayout::addStylesheet($this->getPluginUrl() . '/dist/kitoolbox.css');
}

Expand Down
16 changes: 16 additions & 0 deletions app/controllers/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

class AdminController extends StudipController
{

public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
Navigation::activateItem('/admin/config/kitoolbox');
}

public function index_action()
{

}
}
3 changes: 1 addition & 2 deletions app/controllers/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
use CoursewareSnapshots\Models\Snapshot;

class IndexController extends StudipController
{

Expand All @@ -19,7 +19,6 @@ public function index_action()

}


protected function getHelpbarContent()
{
$description = 'Lorem ipsum';
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div id="kitoolbox-admin-app">
</div>
22 changes: 1 addition & 21 deletions dist/kitoolbox.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/KIToolboxAdminApp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<h1>the ki toolbox admin app...</h1>
</template>
<script>
export default {}
</script>
22 changes: 22 additions & 0 deletions src/kitoolbox-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createApp } from 'vue'
import App from './KIToolboxAdminApp.vue'
import { createGettext } from 'vue3-gettext';
import translations from './locales/translations.json';
import { createPinia } from 'pinia';

const app = createApp(App);

const gettext = createGettext({
availableLanguages: {
en: "English",
de: "Deutsch",
},
defaultLanguage: "de",
translations: translations,
});
app.use(gettext);

const pinia = createPinia();
app.use(pinia);

app.mount('#kitoolbox-admin-app');
1 change: 0 additions & 1 deletion src/kitoolbox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createApp } from 'vue'
import App from './KIToolboxApp.vue'
import './kitoolbox.css';
import { createGettext } from 'vue3-gettext';
import translations from './locales/translations.json';
import { createPinia } from 'pinia';
Expand Down
1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default defineConfig(({ mode }) => {
rollupOptions: {
input: {
kitoolbox: 'src/kitoolbox.js',
'kitoolbox-admin': 'src/kitoolbox-admin.js',
},
output: {
entryFileNames: `[name].js`,
Expand Down

0 comments on commit a92230b

Please sign in to comment.