Skip to content

Commit

Permalink
add more docs of website and boards and general
Browse files Browse the repository at this point in the history
  • Loading branch information
lukovdm committed Nov 1, 2023
1 parent d86a625 commit 76b7202
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
26 changes: 26 additions & 0 deletions website/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# General things to do
In this file we will document general things that have to be done for all apps.

## Translations
The entire website is written in English. All code is English, all comments are English and all strings are English. For us to still have Dutch text on the website we thus make use of the [i18n tools of django](https://docs.djangoproject.com/en/4.2/topics/i18n/).

### Mark as translatable
Thus, to mark a string as to translate we wrap the `_( )` function around it. This function is imported using the following line:
```python
from django.utils.translation import gettext_lazy as _
```
For any more advanced translation things, look at the documentation. You can have separate singular and plural translations and many more options if needed.

### Do translations
To now translate any strings that need translating follow the following steps:
1. cd to the folder of the app you want to translate
2. Run `../manage.py makemessages -a --no-obsolete`, this add any new lines to translate to the `locale/nl/LC_MESSAGES/django.po` file.
3. Use the [poedit](https://poedit.net/) program to open the `django.po` file and edit any translation necessary.
4. Save the file.
5. Profit

##### Remarks
Poedit sometimes throws random errors, these can usually be ignored.

## Multilingual Field
TODO
11 changes: 11 additions & 0 deletions website/boards/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Boards
The boards app allows connecting boards to members.

## Functionality
The boards app consists of one page, the boards list page. The boards list page lists all boards with their members and associated images. Also for the current board, the email addresses of the current board are shown if the user that looks at it is logged in. Furthermore, board members can add a little bio and image of themselves to the page to add personality and details for members to look at.

## How its build
This page, unlike other pages was build by making a django cms plugin, not a django cms app. Making it a plugin means that it can be included in any page and have other plugins around it. It does not allow for subpages to be added, but this was not needed.

### Model
The model of this page is built upon the usual group and group membership pattern. As our group we have a board and as the group membership we have a board membership. A board membership can either reference a member, or it is just a name.
32 changes: 23 additions & 9 deletions website/website/DOCS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
# Core app
This is the core app of the website. It describes the settings, the templates and the main static files.

### Settings
## Settings
The settings are build up of four files, `base.py`, `development.py`, `production.py` and `__init.py`. The `base.py` file
describes settings that are the same during development and on production. Most of these options are either from django
itself or from django-cms.
describes settings that are the same during development and on production. Most of these options are either from django itself or from django-cms.

#### Production
Most of the settings in the production settings are set using environment variables. These are again set in the
`config/secrets.env` file on the server. It allows us to have secret variables that only people that have access to the
server can see.
### Production
Most of the settings in the production settings are set using environment variables. These are again set in the `config/secrets.env` file on the server. It allows us to have secret variables that only people that have access to the server can see.

Also whenever an error occurs there should be an error send to `ADMINS` variable.
Also, whenever an error occurs there should be an error send to `ADMINS` variable.

##### Adding an app
### Adding an app
When adding an app, remember to also add it to the `INSTALLED_APPS` in `base.py`

## Templates
The website has two main templates that pages are based of off. We have the `fullpage` template, which contains the template for the front page. And we have the `page` template, for all other pages.

All pages are base on one template, `base.html`. This template loads in any necessary css and js, adds messages, the footer and the easter egg. It also defines two blocks in which other templates can place content to load it onto the page. These are the `header` and `middle` block. The footer is build by adding 3 static placeholders such that they can be edited in the cms and are the same on every page.

Next we have the `base_contained.html` template. This template just adds the white container to a page and makes a new block for content called `pagecontent`. This between template has been added since the member list page does not have a white container and we thus needed a base without. But, all other pages do need a white container. The members list does not directly use `base.html`, instead it uses `page_empty.html` as it also includes the default header and menu bar.

Both the `page` and `fullpage` templates have two version, one for the cms and one not for the cms. The page for the cms has placeholder tags where content can be added. The non cms pages don't have these placeholders and can be use by the apps we make.

The menu is a separate template as it is the same in both `fullpage` and `page`, but included differently. It is based upon the django cms menu template.

## Slideshows
The full page template makes use of random images for the frontpage every time you open the website. These images can be added in the django admin in the slideshow admin. This also means that we have a slideshow model in our website. This model is located in the website app. Not the nicest place but it works. To add the slideshow image to the context of a template we use a context processor to add a slideshow iamge to the context of every page. This is context processor can be found in `website/website/context_processors.py` and the setting to add it is in the base settings file.

## Menu
The menu uses the django cms menu system. We only change one thing, when creating the menu structure we add a property `is_home` to every node, to determine if a node is the home page. When rendering the menu in the template we use this `is_home` property to make it blue to highlight the home page. For further information look at the [django cms menu docs](https://docs.django-cms.org/en/latest/reference/navigation.html).

0 comments on commit 76b7202

Please sign in to comment.