0.0.39 • Published 10 years ago

auja v0.0.39

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Auja-Node.js

Node.js back-end implementation of Auja admin framework created by Label305 (https://github.com/label305).

Related repositories

  • Auja - The frontend JavaScript GUI

Setup

Auja-Node.js is available on the NPM package manager for Node.js

npm install auja --save

Usage

Auja used 3 main types:

  • Main
  • Menu
  • Page

Each of these classes have implemented the aujaSerialize() method which returns valid JSON, accepted by the Auja JavaScript implementation.

Main

The Main class is used to define the main view of Auja. Here's an example of a main:

var Auja = require('auja');

var logoutButton = new Auja.Button()
	.setText("Logout")
	.setConfirmationMessage("Are you sure?")
	.setTarget("/logout")
	.setMethod("GET");

var main = new Auja.Main()
	.setTitle("Auja Admin Backend")
	.setAuthenticated(true)
	.setColor("primary", "#AABBCC")
	.setColor("secondary", "#CCBBAA")
	.setUsername("My User")
	.addButton(logoutButton)
	.aujaSerialize(); // only do after adding all items

return main; // or use express: return res.json(main);

Menu

The Menu class is used to define menus in Auja. Here's an example of a menu:

var Auja = require('auja');

var linkMenuItem = new Auja.LinkMenuItem()
	.setText("Add user")
	.setIcon("ion-person-add")
	.setTarget("/users/create");

var spacerMenuItem = new Auja.SpacerMenuItem()
	.setText("Users");

var searchable = new Auja.Searchable() // this is a resource property
	.setTarget("/search?s=%s");

var resourceMenuItem = new Auja.ResourceMenuItem()
	.setTarget("/users")
	.addProperty(searchable);

var menu = new Auja.Menu()
	.addMenuItem(linkMenuItem)
	.addMenuItem(spacerMenuItem)
	.addMenuItem(resourceMenuItem)
	.aujaSerialize(); // only do after adding all items

return menu; // or use express: return res.json(menu);

Page

The Page class is used to define pages in Auja. Here's an example of a page with a header and a form:

var Auja = require('auja');

var deleteButton = new Auja.Button()
	.setText("Delete user")
	.setTarget("/users/delete");

var header = new Auja.PageHeader()
	.setText("The Header")
	.addButton(deleteButton);

var textFormItem = new Auja.FormItem.TextFormItem()
	.setLabel("Text")
	.setName("text")
	.setValue("A Text Here");

var checkboxFormItem = new Auja.FormItem.CheckboxFormItem()
	.setLabel("Checkbox")
	.setName("checkbox")
	.setChecked(true);

var selectFormItem = new Auja.FormItem.SelectFormItem()
	.setLabel("Select")
	.setName("select")
	.addOption(new Auja.FormItem.SelectOption("option1", "Option1"));

var form = new Auja.Form()
	.setMethod('POST')
	.setAction('/postMe')
	.addFormItem(textFormItem)
	.addFormItem(checkboxFormItem)
	.addFormItem(selectFormItem);

var page = new Auja.Page()
	.addPageComponent(header)
	.addPageComponent(form)
	.aujaSerialize();
	
return page; // or use express: return res.json(page);

Contribute

You can contribute the following ways:

  • Write tests
  • Add file upload form type
  • Add more examples and details to the documentation
  • Rewrite code
  • Add more code! (just add anything you want and do a pull request)

Licence

This licence reflects the licence of Auja by Label305 B.V.

Copyright 2015 Chris ter Beke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

0.0.39

10 years ago

0.0.38

10 years ago

0.0.37

10 years ago

0.0.35

10 years ago

0.0.34

10 years ago

0.0.33

10 years ago

0.0.32

10 years ago

0.0.31

10 years ago

0.0.30

10 years ago

0.0.29

10 years ago

0.0.28

10 years ago

0.0.27

10 years ago

0.0.26

10 years ago

0.0.25

10 years ago

0.0.24

10 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago