Skip to content
Snippets Groups Projects
JS-README.md 2.07 KiB
Newer Older
# Which JavaScript files does Portal need to run?

The important JavaScript files can be found in `/portal/static/js/`!
This is mostly Mithril.js.

## `/portal/static/js/components`

[TODO] furtherly explain the components

This is where the frontend components are located. The components are divided into two categories: `pages` and `pieces`. **Mithril.js** uses `pages` to render the main content of the website, while `pieces` are used to render smaller components that are used in multiple places. `pieces` then are embedded into `pages`.

This could help you around
+ [Mithril.js documentation](https://mithril.js.org/)
+ [Convert plain HTML to Mithril](https://arthurclemens.github.io/mithril-template-converter/index.html)



### `/portal/static/js/components/pages`



Generally, everything having its own tab in the Navbar is a `page`. They are the first components that are rendered when the website is loaded.

+ `Base.mjs`
+ `Fachschaftssitzung.mjs`
+ `FsServices.mjs`
+ `Login.mjs`
hanke's avatar
hanke committed
+ `Me.mjs`
+ `Start.mjs`
+ `UniServices.mjs`
+ `Unlock.mjs`

### `/portal/static/js/components/pieces`

These are the smaller components that are embedded in multiple places.


+ `AccountRequired.mjs`
+ `Agenda.mjs`
+ `BoxedButton.mjs`
+ `ButtonAndTextLink.mjs`
+ `Nav.mjs`
+ `NavPageLink.mjs`
+ `PasswordinVault.mjs`
+ `ServiceLink.mjs`
+ `Toast.mjs`
+ `UnlockRequired`

## `/portal/static/js/model`

### `/portal/static/js/model/Service.mjs`

This renders an individual service.

### `/portal/static/js/model/Services.mjs`

This renders the list of our services.

## `/portal/static/js/account.mjs`

Here, after the login, a session token is created and stored in the `LocalStorage`.
It also responsible for ensuring the validity and non-expiry of the session token.
Users get logged in and logged out here.

## `/portal/static/js/gitlab.mjs`

Arcane magic. We get our Fachschaftssitzung protocols here.
Also, there's some yapping about the Same Origin Policy, might be interesting, but misses a TL;DR.

## `/portal/static/js/portal.mjs`

This is the main file that initializes the Mithril.js app and sets up the routing.