An admin for SailsJS
npm install sails-hook-crud-admin``bash`
npm install sails-hook-crud-admin --save
Navigate to http://localhost:1337/administrator/ to access the admin interface.
Login with the credentials
username: `admin` and password `access@crud-2018`.
Note: It is adviced to change this password as soon as you can.
If you want one of your fields to be a picture for example, in the config file you select its renderer property for that field to be picture.
button which is going to open a modal with a form to fill in.Updating an existing item
From your details of a model you can also update your existing model instances. This is pretty straightforward, you only need to click the Update button in the row of the desired item which is going to open a modal with a form in it.Removing an existing item
From your details of a model you can also remove your existing model instances. You click the
Remove button in the row of the desired item which is going to open a modal to confirm the elimination.Users and Permissions
Adding a new group with rights
Creating a new group with rights is really easy you just need to go to the Permissions Dashboard and from there click the CRUD Group model box. This will take to its details screen where you get access to the create modal.To create a new group, you give it a name and select the permissions it is going to have.
Assigning permissions is a pretty simple process. You check the actions options for the desired resources. The defined actions are
create, update, read, delete, *.
The last one (*) means any of the previous actions.
The resources are defined based on the existing models of your app plus the CRUD models of the administrator.
Adding a new user
The process of creating a new user is simple. You just go to the Permissions Dashboard and from there click the
CRUD User model box. This will take to its details screen where you get access to the create user modal.To create a new user, you give it a name and select the groups it is going belong to.
Configuring the Admin
Customization
To customize things like labels and texts from buttons, and your models you need to create crudAdmin.js file like following and make your desired changes.
This file goes under the config directory.##
`js
/**
* Custom configuration
* (sails.config.crudAdmin)
*/
module.exports.crudAdmin = {
general: {
labels: {
home: 'Inicio',
actions: 'Acciones',
createFormTitle: 'Crear item',
updateFormTitle: 'Actualizar Item',
removeFormTitle: 'Remover Item',
createFormMessage: 'Crear un nuevo item',
updateFormMessage: 'Actualizar un item existente',
removeFormMessage: 'Esta seguro que lo quiere remover?',
},
buttons: {
update: 'Actualizar',
create: 'Crear',
remove: 'Remover',
seeDetails: 'Ver detalles',
},
},
models: {
author: {
valueTemplate: '<%= author.name %>',
label: 'Autor',
fields: {
name: {
label: 'Nombre',
},
books: {
label: 'Libros',
valueTemplate:
},
createdAt: {
label: 'Creado'
},
updatedAt: {
label: 'Actualizado'
},
}
},
book: {
valueTemplate: '<%= book.title %>',
label: 'Libro',
fields: {
title: {
label: 'Titulo',
},
description: {
renderer: 'textarea',
},
picture: {
valueTemplate: ,
renderer: 'picture',
},
status: {
label: 'Estado',
},
author: {
label: 'Autor',
valueTemplate: '<%= author.name %>',
},
createdAt: {
label: 'Creado',
},
updatedAt: {
label: 'Actualizado',
},
}
},
}
};``See the list of contributors who participated in this project.