Skip to content

Commit 63dbc44

Browse files
author
Nikhil R
committed
docs(admin centre): Add docs, edit functions
Remove validation check because it’s a search database.
1 parent 386ee24 commit 63dbc44

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

docs/admin_center.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
##Admin Center
2+
3+
The controller and views for admin center are pre loaded with the blank-app. So, when you create a new app using `sailor create "app_name"` these files are within the new folders.
4+
5+
###Admin center structure
6+
7+
There is one controller named `admin.lua` and a views folder named "admin" inside which are three files. One is `dashboard.lp` which is the views file for the autogen and config editor functions. `index.lp` is for logging into the admin center. Third file is `error.lp`.
8+
9+
###Getting started
10+
First open `conf/conf.lua`. Change these two parameters:
11+
12+
-- the default value for this is "false"
13+
enable_admin = "true"
14+
15+
-- the defaullt password is empty
16+
admin_password = "someDifficultPassword"
17+
18+
After running the `start-server.lua`, visit <a href="http://localhost:8080/?r=admin">here</a>. Enter the password set it in the config file in the above setup. You would be
19+
re-directed to `localhost:8000/?r=admin/dashboard`.
20+
The autogen functions are located on the left and the fields from the config file are on the right. You can edit any of the config editor values and then press `submit` button
21+
at the bottom of the screen.
22+
23+
###Autogen Functions
24+
25+
The first autogen function is to Generate a model based on a table existing in the database. This is a very handy function to automatically generate the model file.
26+
Enter the table name and press enter.
27+
28+
There would be a success message ` Model generated with success.`.
29+
To create the methods for CRUD operations in the controller, use the next autogen function.
30+
To Generate CRUD, enter the name of the `model` created in the previous step. This would be same as the name of the table.
31+
32+
###Config editor
33+
34+
Config editor is basically a long form which when saved, writes data into the config file. The existing values can be edited and then saved at the end. The main file edited here is `conf/conf.lua`.
35+
36+
After making necessary changes, don't forget to logout and also disable admin in production servers.

test/dev-app/models/test.lua

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
local val = require "valua"
2-
3-
41
local test ={}
52

6-
test.attributes={
7-
{id = "safe"},
8-
{name = val:new().not_empty() },
9-
{email = val:new().not_empty() }
10-
}
11-
123
test.type = "testing"
134

145
test.keys = {

0 commit comments

Comments
 (0)