feat: Add placeholder documentation
All checks were successful
Build Docker / Build SLDs Image (push) Successful in 19s
Build Docker / Build Main Image (push) Successful in 21s

This commit is contained in:
Nathan Woodburn 2023-11-20 11:37:40 +11:00
parent cd1253d0fd
commit e2522a61d6
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 139 additions and 6 deletions

134
PLACEHOLDERS.md Normal file
View File

@ -0,0 +1,134 @@
# Template Placeholders
- [Template Placeholders](#template-placeholders)
- [Colours](#colours)
- [Background colour (bg\_colour)](#background-colour-bg_colour)
- [Text colour (text\_colour)](#text-colour-text_colour)
- [Foreground colour (fg\_colour)](#foreground-colour-fg_colour)
- [Parts](#parts)
- [Avatar](#avatar)
- [HNSChat](#hnschat)
- [Location](#location)
- [Email](#email)
- [Footer (footer)](#footer-footer)
- [Text Placeholders](#text-placeholders)
- [Main domain (main\_domain)](#main-domain-main_domain)
- [Data (data)](#data-data)
- [Crypto Address Placeholders](#crypto-address-placeholders)
- [Icons](#icons)
- [Full parts](#full-parts)
- [Address only](#address-only)
## Colours
### Background colour (bg_colour)
Use #000000 for the background colour as the app overwrites this colour
### Text colour (text_colour)
Use #1fffff for the background colour as the app overwrites this colour
### Foreground colour (fg_colour)
Use #f1ffff for the background colour as the app overwrites this colour
## Parts
### Avatar
`avatar` can be used to get the avatar of the user.
If the user doesn't have an avatar this is just
```html
<h1>domain.shakecities/</h1>
```
If the user does have an avatar this is
```html
<img src='avatar-url' width='200vw' height='200vw' style='border-radius: 50%;margin-right: 5px;'>
```
### HNSChat
If the user has a HNSChat name set this will return
```html
<a href='https://hns.chat/#message:username' target='_blank'>
<img src='hns_icon' width='20px' height='20px' style='margin-right: 5px;'>
username/
</a>
```
### Location
If the user has a location set this will return
```html
<img src='location_icon' width='20px' height='30px' style='margin-right: 5px;'>
location
```
### Email
If the user has a email set this will return
```html
<a href='mailto:email@example'>
<img src='email_icon' width='30px' height='20px' style='margin-right: 5px;margin-left:-10px;'>
email@example
</a>
```
### Footer (footer)
This is the Shakecities footer. It will always be the same "Powered by Shakecities"
## Text Placeholders
### Main domain (main_domain)
`main_domain` can be used to get the main domain of the site e.g. shakecities.com
### Data (data)
`data` can be used to get the data of the site.
This is the main body
## Crypto Address Placeholders
### Icons
These are the icons for the crypto addresses.
There are 2 versions of each icon. One with a contrast to the foreground colour and one without.
These return the path to the image of the icon (eg. `assets/img/HNS.png`)
They are as follows:
- hns_icon
- hns_icon_invert
- btc_icon
- btc_icon_invert
- eth_icon
- eth_icon_invert
### Full parts
These are the full parts for the crypto addresses.
They return both the icon and the address.
For example `hns` returns
```html
<img src='hns_icon' width='20px' height='20px' style='margin-right: 5px;'>hs1...
```
The list of full parts are:
- hns
- btc
- eth
- hns_invert
- btc_invert
- eth_invert
### Address only
These are plain text addresses without the icon.
Eg. `hns_address` returns
```html
hs1...
```
They are as follows:
- hns_address
- btc_address
- eth_address

View File

@ -21,7 +21,8 @@ python3 -m pip install -r requirements.txt
python3 template.py city_new python3 template.py city_new
``` ```
Visit http://127.0.0.1:5000/ to view the template Visit http://127.0.0.1:5000/ to view the template
Here is a list of placeholders you can use [PLACEHOLDERS.md](PLACEHOLDERS.md)
### Deployment ### Deployment

View File

@ -75,16 +75,14 @@ def render(data,db_object):
eth_address = eth eth_address = eth
if hns != "": if hns != "":
hns = "<img src='" + hns_icon + "' width='20px' height='20px' style='margin-right: 5px;'>" + hns hns = "<img src='" + hns_icon + "' width='20px' height='20px' style='margin-right: 5px;'>" + hns
if btc != "":
btc = "<img src='" + btc_icon + "' width='20px' height='25px' style='margin-right: 5px;'>" + btc
if eth != "":
eth = "<img src='" + eth_icon + "' width='20px' height='30px' style='margin-right: 5px;'>" + eth
if hns != "":
hns_invert = "<img src='" + hns_icon_invert + "' width='20px' height='20px' style='margin-right: 5px;'>" + hns_address hns_invert = "<img src='" + hns_icon_invert + "' width='20px' height='20px' style='margin-right: 5px;'>" + hns_address
if btc != "": if btc != "":
btc = "<img src='" + btc_icon + "' width='20px' height='25px' style='margin-right: 5px;'>" + btc
btc_invert = "<img src='" + btc_icon_invert + "' width='20px' height='25px' style='margin-right: 5px;'>" + btc_address btc_invert = "<img src='" + btc_icon_invert + "' width='20px' height='25px' style='margin-right: 5px;'>" + btc_address
if eth != "": if eth != "":
eth = "<img src='" + eth_icon + "' width='20px' height='30px' style='margin-right: 5px;'>" + eth
eth_invert = "<img src='" + eth_icon_invert + "' width='20px' height='30px' style='margin-right: 5px;'>" + eth_address eth_invert = "<img src='" + eth_icon_invert + "' width='20px' height='30px' style='margin-right: 5px;'>" + eth_address
hide_addresses = False hide_addresses = False
if hns == "" and btc == "" and eth == "": if hns == "" and btc == "" and eth == "":