Giter VIP home page Giter VIP logo

auto-admin's Introduction

Auto Admin

Fast and automatic administration maker.

Developped for sailsjs and use reactjs(ES6)

Installation

$ npm install auto-admin --save

Example

sails-isomorphic-react-admin-example

Usage

app.js

import React from 'react';
import Router, {HistoryLocation} from 'react-router';
import {Routes} from 'auto-admin';

Router.run(Routes(), HistoryLocation, Root => {
  React.render(<Root {...window.__ReactInitState__} />, document.body);
  delete window.__ReactInitState__;
});

Overwrite routes

routes.js

"use strict";

import React from 'react'
import {RouteHandler, Route} from 'react-router'
import {Home, List, Create, Update} from 'auto-admin'

module.exports = (
  <Route handler={RouteHandler}>
    <Route name="home" path="/admin" handler={Home} />
    <Route name="list" path="/admin/:identity" handler={List} />
    <Route name="create" path="/admin/:identity/new" handler={Create} />
    <Route name="update" path="/admin/:identity/:id" handler={Update} />
  </Route>
);

Personalize your form with newforms-bootstrap

form.js

"use strict";

import React from 'react'
import {Container, Row, Field} from 'newforms-bootstrap'

export const comment = (
  <Container autoColumns="md">
    <h1>Comments</h1>
    <hr />
    <p className="text-right">
      <button className="btn btn-default">Save</button>
    </p>
    <Row>
      <Field name="name" md="8"/>
      <Field name="post"/>
    </Row>
    <Row>
      <Field name="message"/>
    </Row>
  </Container>
);

app.js

import React from 'react';
import Router, {HistoryLocation} from 'react-router';
import {Routes} from 'auto-admin'
import * as modelsForm from './forms'

Router.run(Routes(), HistoryLocation, Root => {
  React.render(<Root {...window.__ReactInitState__} models={modelsForm} />, document.body);
  delete window.__ReactInitState__;
});

Change your Layout

layout.js

"use strict";

import React from 'react'

export default class {
  render() {
    return (
      <div>
        {this.props.children}
      </div>
    )
  }
}

app.js

import React from 'react';
import Router, {HistoryLocation} from 'react-router';
import {Routes} from 'auto-admin'
import Layout from './layout';

Router.run(Routes(), HistoryLocation, Root => {
  React.render(<Root {...window.__ReactInitState__} layout={Layout} />, document.body);
  delete window.__ReactInitState__;
});

License

MIT © 2015 contributors

auto-admin's People

Contributors

wi2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dgsosa

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.