auja v0.0.39
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.
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago