0.2.8 • Published 10 years ago
auto-admin v0.2.8
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
0.2.8
10 years ago
0.2.7
10 years ago
0.2.6
10 years ago
0.2.5
10 years ago
0.2.4
10 years ago
0.2.3
10 years ago
0.2.2
10 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.0
10 years ago
0.0.9
10 years ago
0.0.8
10 years ago
0.0.7
10 years ago
0.0.6
10 years ago
0.0.5
10 years ago
0.0.4
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago