Verified Commit 034ecf48 authored by Jakob Moser's avatar Jakob Moser
Browse files

Add contributing guide

parent e4093a1b
Loading
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
# Contributing

## Add or change links

The most common change requirement will probably be adding a link to a service (or deleting or otherwise changing it). To do so, one needs to create a `Service` object and put it in the right place.

The simplest `Service` object looks like this:

```js
new Service(
    "Meeting",
    "https://fachschaft.cl.uni-heidelberg.de/meet",
    "fa-solid fa-phone-volume",
)
```

It has a human-readable name (“Meeting”), the URL to link to (https://fachschaft.cl.uni-heidelberg.de/meet) and a Font Awesome icon name. To find an icon, browse the Font Awesome collection, click the icon, and copy the `class` (e.g. if the HTML code is `<i class="fa-solid fa-alarm-clock"></i>`, copy `fa-solid fa-alarm-clock`)

* [Font Awesome 7 Free Collection](https://fontawesome.com/v7/search?ic=free-collection)

There are optional attributes when creating a `Service`:

```js
new Service(
    "Mailinglisten",
    "https://lists.cl.uni-heidelberg.de/",
    "fa-solid fa-envelopes-bulk",
    "Geteilter Account", // Name of the account you need to log in, often "CL-Account", sometimes "Uni-ID", sometimes something else
    false, // If true, shows "Freischaltung erforderlich"
    true,  // If true, shows "Passwort im Tresor"
)
```

Now, you need to figure out where to put this service. For this, use a browser to navigate to the portal page and look at the path of the URI (everything after `https://portal.fachschaft.cl.uni-heidelberg.de`, e.g., in `https://portal.fachschaft.cl.uni-heidelberg.de/uni-services`, the path would be `/uni-services`).

Then, there are two cases:

### Path is `/` or `/fs-services`

Open the services file:

* [`portal/static/js/model/services.mjs`](./portal/static/js/model/services.mjs)

Put the `Service` you created in that list. The first five entries are also shown on `/`, all services are shown on `/fs-services` in alphabetic order.

### Path is anything else

Open the main Portal JavaScript file:

* [`portal/static/js/portal.mjs`](./portal/static/js/portal.mjs)

In there, you see a mapping from path segments to page names. In the case of `/uni-services`, that would be `UniServices` from the corresponding file `UniServices.mjs`. All these files are stored in the `pages/` directory.

* [`portal/static/js/components/pages/` directory](./portal/static/js/components/pages/)

Wrap the service you created in a `ServiceLink`, and put it in the list:

```js
m(
    ServiceLink,
    new Service(
        "Meeting",
        "https://fachschaft.cl.uni-heidelberg.de/meet",
        "fa-solid fa-phone-volume",
    )
)
```

## How to move around in this repo

To find out where your changes should go to implement a particular feature or fix a bug, read the architecture documentation. This document will also link to further documentation and code as needed.