Skip to content

Instantly share code, notes, and snippets.

@akyoto
Last active June 30, 2018 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akyoto/4bf40df09ec23ca4267f5997278fed1a to your computer and use it in GitHub Desktop.
Save akyoto/4bf40df09ec23ca4267f5997278fed1a to your computer and use it in GitHub Desktop.
notify.moe | Task for new contributors | Make your own page and menu item in the sidebar!

Task for new contributors

This task assumes that you have installed 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)
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)
component FooBar
	h1 Hi!
  • foobar.scarlet (styles)
.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:

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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment