Git Product home page Git Product logo

sails-hook-cms's Introduction

Sails admin panel

Join the chat at https://gitter.im/juanpasolano/sails-hook-cms

Beaware: This hook is still in a very early stage and not in a very active development.

Why

The objective of this sails hook is to provide an easy way to create a simple CMS for your model's collections.
The hook reads the models schema to build simple CRUD operations and UI CMS.

Installation

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 or in the gitter chat room.

sails-hook-cms's People

Contributors

juanpasolano avatar gitter-badger avatar

Watchers

James Cloos avatar Muh Isfhani Ghiath avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.