Updated docs
This commit is contained in:
parent
c4d2880fb3
commit
9172b11132
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- [About](ABOUT.md)
|
- [Installation](README.md#installation)
|
||||||
|
- [Task for new contributors](docs/new-contributor-task.md)
|
||||||
- [Issues](https://github.com/animenotifier/notify.moe/projects/10)
|
- [Issues](https://github.com/animenotifier/notify.moe/projects/10)
|
||||||
- [Code Style](CODE_STYLE.md)
|
- [Code Style](docs/code-style.md)
|
||||||
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
||||||
|
|
||||||
## Communication
|
## Communication
|
||||||
|
|
||||||
|
63
docs/new-contributor-task.md
Normal file
63
docs/new-contributor-task.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# Task for new contributors
|
||||||
|
|
||||||
|
This task assumes that you have [installed](https://github.com/animenotifier/notify.moe#installation) notify.moe already, started the server with the `run` tool and have the code open in Visual Studio Code.
|
||||||
|
|
||||||
|
# Step 1: Create a new page
|
||||||
|
|
||||||
|
Let's call it `foobar`. Create a new directory under `pages`, called `foobar`. Then create the following files inside it:
|
||||||
|
|
||||||
|
* foobar.go (controller)
|
||||||
|
|
||||||
|
```go
|
||||||
|
package foobar
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/aerogo/aero"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get ...
|
||||||
|
func Get(ctx *aero.Context) string {
|
||||||
|
return ctx.HTML("Hey it's me, foobar!")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* foobar.pixy (template)
|
||||||
|
|
||||||
|
```pixy
|
||||||
|
component FooBar
|
||||||
|
h1 Hi!
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
* foobar.scarlet (styles)
|
||||||
|
|
||||||
|
```scarlet
|
||||||
|
.foobar
|
||||||
|
// Will be used later!
|
||||||
|
```
|
||||||
|
|
||||||
|
`foobar.pixy` and `foobar.scarlet` are currently not used but we'll deal with that later.
|
||||||
|
|
||||||
|
## Step 2: Route your page
|
||||||
|
|
||||||
|
Your page needs to become available on the `/foobar` route. Let's add it to `pages/index.go`, inside `Configure`:
|
||||||
|
|
||||||
|
```go
|
||||||
|
l.Page("/foobar", foobar.Get)
|
||||||
|
```
|
||||||
|
|
||||||
|
Your IDE should automatically insert the needed package import upon saving the file.
|
||||||
|
|
||||||
|
## Step 3: Add sidebar button
|
||||||
|
|
||||||
|
Inside `layout/sidebar/sidebar.pixy`, add a new button inside the `Sidebar` component:
|
||||||
|
|
||||||
|
```pixy
|
||||||
|
SidebarButton("Foobar", "/foobar", "plus")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 4: Confirm it's there!
|
||||||
|
|
||||||
|
Navigate to `beta.notify.moe` and you should see the button to access your newly made page! Yay!
|
||||||
|
|
||||||
|
Feel free to play around with the code now. You can utilize pixy components by using the `components` package inside your controller.
|
Loading…
Reference in New Issue
Block a user