autochthon 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +160 -0
- data/Rakefile +6 -0
- data/autochthon.gemspec +28 -0
- data/bin/console +7 -0
- data/config.ru +3 -0
- data/lib/autochthon.rb +28 -0
- data/lib/autochthon/backend/active_record.rb +36 -0
- data/lib/autochthon/backend/fetching_all.rb +20 -0
- data/lib/autochthon/backend/redis.rb +19 -0
- data/lib/autochthon/backend/simple.rb +15 -0
- data/lib/autochthon/engine.rb +9 -0
- data/lib/autochthon/tasks/rails.rake +28 -0
- data/lib/autochthon/version.rb +3 -0
- data/lib/autochthon/web.rb +55 -0
- data/public/bundle.js +79 -0
- data/public/index.erb +16 -0
- data/vendor/assets/javascripts/autochthon/application.js.erb +3 -0
- data/vendor/assets/javascripts/autochthon/autochthon.js +140 -0
- data/web/package.json +22 -0
- data/web/src/Dialog.jsx +61 -0
- data/web/src/Translations.jsx +61 -0
- data/web/src/callbacks.js +17 -0
- data/web/src/main.jsx +54 -0
- data/web/src/store.js +17 -0
- data/web/webpack.config.js +22 -0
- metadata +144 -0
@@ -0,0 +1,17 @@
|
|
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
ADDED
@@ -0,0 +1,54 @@
|
|
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
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
});
|
@@ -0,0 +1,22 @@
|
|
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
|
+
};
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: autochthon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Sokolnicki
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sinatra-contrib
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: i18n
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Sinatra app for managing I18n translations stored in YAML files, database
|
84
|
+
or Redis
|
85
|
+
email:
|
86
|
+
- adam.sokolnicki@gmail.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- autochthon.gemspec
|
97
|
+
- bin/console
|
98
|
+
- config.ru
|
99
|
+
- lib/autochthon.rb
|
100
|
+
- lib/autochthon/backend/active_record.rb
|
101
|
+
- lib/autochthon/backend/fetching_all.rb
|
102
|
+
- lib/autochthon/backend/redis.rb
|
103
|
+
- lib/autochthon/backend/simple.rb
|
104
|
+
- lib/autochthon/engine.rb
|
105
|
+
- lib/autochthon/tasks/rails.rake
|
106
|
+
- lib/autochthon/version.rb
|
107
|
+
- lib/autochthon/web.rb
|
108
|
+
- public/bundle.js
|
109
|
+
- public/index.erb
|
110
|
+
- vendor/assets/javascripts/autochthon/application.js.erb
|
111
|
+
- vendor/assets/javascripts/autochthon/autochthon.js
|
112
|
+
- web/package.json
|
113
|
+
- web/src/Dialog.jsx
|
114
|
+
- web/src/Translations.jsx
|
115
|
+
- web/src/callbacks.js
|
116
|
+
- web/src/main.jsx
|
117
|
+
- web/src/store.js
|
118
|
+
- web/webpack.config.js
|
119
|
+
homepage: https://github.com/asok/autochthon
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.5.1
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Sinatra app for managing I18n translations
|
143
|
+
test_files: []
|
144
|
+
has_rdoc:
|