autochthon 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,61 +0,0 @@
1
- import React from "react";
2
- import { Table } from "restful-material";
3
- import { Paper,
4
- SelectField,
5
- MenuItem } from "material-ui";
6
- import callbacks from "./callbacks";
7
- import store from "./store";
8
- import Dialog from "./Dialog";
9
-
10
- let spec = {
11
- 'Locale': {key: 'locale'},
12
- 'Key': {key: 'key'},
13
- 'Value': {key: 'value'}
14
- };
15
-
16
- module.exports = React.createClass({
17
- mixins: [callbacks],
18
-
19
- getInitialState() {
20
- return {
21
- translations: [],
22
- openDialog: false,
23
- translationToEdit: new Map()
24
- };
25
- },
26
-
27
- _onAll(translations) {
28
- this.setState({translations: translations});
29
- },
30
-
31
- _onCellClick(row, col) {
32
- if(col == 3)
33
- this.refs.dialog.show(this.refs.table.getResource(row));
34
- },
35
-
36
- componentWillMount() {
37
- store.all().then(this._onAll, this.onFailure);
38
- },
39
-
40
- _onUpdate(translation) {
41
- this.refs.table.forceUpdate();
42
- },
43
-
44
- render() {
45
- return(
46
- <div>
47
- <Paper style={{padding: 10}}>
48
- <div>
49
- <Table
50
- spec={spec}
51
- ref="table"
52
- tableProps={{onCellClick: this._onCellClick}}
53
- resources={this.state.translations || []} />
54
- </div>
55
- </Paper>
56
-
57
- <Dialog ref="dialog" onSuccess={this._onUpdate} />
58
- </div>
59
- );
60
- }
61
- });
data/web/src/callbacks.js DELETED
@@ -1,17 +0,0 @@
1
- import React from "react";
2
-
3
- module.exports = {
4
- contextTypes: {
5
- info: React.PropTypes.object
6
- },
7
-
8
- onSuccess(xhr) {
9
- this.context.info.show('Success', 'OK');
10
- return xhr;
11
- },
12
-
13
- onFailure(xhr) {
14
- this.context.info.show('Something went wrong');
15
- return xhr;
16
- }
17
- };
data/web/src/main.jsx DELETED
@@ -1,54 +0,0 @@
1
- import React from "react";
2
- import DOM from "react-dom";
3
- import Router, {Route, DefaultRoute, Redirect } from "react-router";
4
- import Restful from "restful-material";
5
- import { CircularProgress, Styles, RaisedButton } from "material-ui";
6
-
7
- let router = Router.create();
8
-
9
- Restful.configure({
10
- ajax: {
11
- url: document.querySelector('meta[name="path"]').content,
12
- beforeSend: (xhr)=> {
13
- DOM.render(<CircularProgress size={4} />, document.getElementById('spinner'));
14
- },
15
- onFailure: (xhr)=> {
16
- console.log(xhr);
17
- return xhr;
18
- },
19
- onCompleted: ()=> {
20
- DOM.unmountComponentAtNode(document.getElementById('spinner'));
21
- }
22
- }
23
- });
24
-
25
- import injectTapEventPlugin from "react-tap-event-plugin";
26
- import Translations from "./Translations";
27
-
28
- injectTapEventPlugin();
29
-
30
- let AppRoutes = (
31
- <Route name="root" path="/">
32
- <DefaultRoute handler={Translations} />
33
- </Route>
34
- );
35
-
36
- router.addRoutes(AppRoutes);
37
-
38
- let App = React.createClass({
39
- mixins: [Restful.Info.Mixin],
40
-
41
- render() {
42
- return (
43
- <div>
44
- {this.infoComponent()}
45
- {this.props.children}
46
- </div>
47
- );
48
- }
49
- });
50
-
51
- router.run(function(Handler) {
52
- DOM.render(<App> <Handler /> </App>,
53
- document.getElementById("content"));
54
- });
data/web/src/store.js DELETED
@@ -1,17 +0,0 @@
1
- import { createStore } from "restful-material";
2
-
3
- module.exports = createStore({
4
- all() {
5
- return this.GET('translations').
6
- then(data =>
7
- data.map(t => Object.keys(t).reduce((o, k) => o.set(k, t[k]), new Map())));
8
- },
9
-
10
- update(t) {
11
- return this.POST('translations', {
12
- locale: t.get('locale'),
13
- key: t.get('key'),
14
- value: t.get('value')
15
- });
16
- }
17
- });
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- entry: [
3
- 'babel-core/polyfill',
4
- './src/main.jsx'
5
- ],
6
-
7
- output: {
8
- filename: 'bundle.js',
9
- path: '../public/',
10
- hash: true
11
- },
12
-
13
- module: {
14
- loaders: [
15
- { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader' }
16
- ]
17
- },
18
-
19
- resolve: {
20
- extensions: ['', '.js', '.jsx']
21
- }
22
- };
File without changes