sails-hook-cms
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "sails-hook-cms", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A simple sails admin panel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,1 +11,45 @@ # Sails admin panel | ||
Install using `npm i sails-hook-cms` and then navigate to `http://localhost:1337/admin` | ||
##Routes | ||
This hooks introduces a couple of routes to your application. | ||
- `http://localhost:1337/admin` or home | ||
- `http://localhost:1337/admin/:model` A list of items | ||
- `http://localhost:1337/admin/:model/create` The form to create a new item | ||
- `http://localhost:1337/admin/:model/edit/:modelId` The form to edit an item | ||
##Options | ||
I want this hook to work as plug and play. However if you want more control over the CMS I want to be able to provide those configurations to set things up. | ||
I decided not to make a `config/cms.js` file yet since I think the model declaration could serve better for grain control configuraitons. | ||
Having for example a model Book. We can start to modify how its `/admin/:model` list view renders. | ||
In this case we have overrided the model.name with a label *Libro* and removed the createdAt and updatedAt fields. | ||
``` | ||
module.exports = { | ||
//Setting this variable will tell the gook how to render | ||
cms: { | ||
//You can override the model name with label | ||
label: "Libro", | ||
//Sometimes you dont want to put your createdAt and updatedAt | ||
//so we toggle them in the list view | ||
createdAt:false, | ||
updatedAt:false, | ||
id:true | ||
}, | ||
attributes: { | ||
name: 'string', | ||
description: 'text', | ||
danum: 'integer', | ||
dafloat: 'float', | ||
dadate: 'date', | ||
dadatetime: 'datetime', | ||
dabool: 'boolean', | ||
darray: 'array', | ||
dajson: 'json' | ||
} | ||
}; | ||
``` | ||
##Intentions | ||
I would like to have a minimal API but still have a decent flexibility. | ||
Any suggestions are welcome on the issues page. |
19242
55