flux_on_rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +45 -0
  6. data/Rakefile +1 -0
  7. data/flux_on_rails-1.0.0.gem +0 -0
  8. data/flux_on_rails.gemspec +23 -0
  9. data/lib/flux_on_rails.rb +5 -0
  10. data/lib/flux_on_rails/version.rb +3 -0
  11. data/lib/generators/flux_on_rails/install_generator.rb +51 -0
  12. data/lib/generators/flux_on_rails/templates/actions/example-actions.js +22 -0
  13. data/lib/generators/flux_on_rails/templates/application.js +3 -0
  14. data/lib/generators/flux_on_rails/templates/components/.gitkeep +0 -0
  15. data/lib/generators/flux_on_rails/templates/constants/app-constants.js +5 -0
  16. data/lib/generators/flux_on_rails/templates/dispatcher.js +280 -0
  17. data/lib/generators/flux_on_rails/templates/dispatchers/app-dispatcher.js +29 -0
  18. data/lib/generators/flux_on_rails/templates/form-for.js +1 -0
  19. data/lib/generators/flux_on_rails/templates/react-form-for-object/.bower.json +15 -0
  20. data/lib/generators/flux_on_rails/templates/react-form-for-object/.bowerrc +3 -0
  21. data/lib/generators/flux_on_rails/templates/react-form-for-object/.gitignore +2 -0
  22. data/lib/generators/flux_on_rails/templates/react-form-for-object/README.md +94 -0
  23. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/checkbox-input.react.js +11 -0
  24. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/color-input.react.js +11 -0
  25. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/date-input.react.js +11 -0
  26. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/datetime-input.react.js +11 -0
  27. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/email-input.react.js +11 -0
  28. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/form-errors.react.js +13 -0
  29. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/form-for.react.js +78 -0
  30. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/hidden-input.react.js +10 -0
  31. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/input.react.js +92 -0
  32. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/number-input.react.js +11 -0
  33. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/options-for-select.react.js +10 -0
  34. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/password-input.react.js +11 -0
  35. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/radio-input.react.js +10 -0
  36. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/select-input.react.js +17 -0
  37. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/submit-input.react.js +11 -0
  38. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/text-input.react.js +11 -0
  39. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/textarea-input.react.js +10 -0
  40. data/lib/generators/flux_on_rails/templates/react-form-for-object/components/time-input.react.js +11 -0
  41. data/lib/generators/flux_on_rails/templates/react-form-for-object/example/bower.json +11 -0
  42. data/lib/generators/flux_on_rails/templates/react-form-for-object/example/index.html +6 -0
  43. data/lib/generators/flux_on_rails/templates/react-form-for-object/example/js/app.js +76 -0
  44. data/lib/generators/flux_on_rails/templates/react-form-for-object/example/react/app.jsx +76 -0
  45. data/lib/generators/flux_on_rails/templates/react-form-for-object/gulpfile.js +39 -0
  46. data/lib/generators/flux_on_rails/templates/react-form-for-object/package.json +12 -0
  47. data/lib/generators/flux_on_rails/templates/react-form-for-object/src/bower.json +27 -0
  48. data/lib/generators/flux_on_rails/templates/react-form-for-object/src/form-for.js +362 -0
  49. data/lib/generators/flux_on_rails/templates/react.js +18095 -0
  50. data/lib/generators/flux_on_rails/templates/stores/example-store.js +110 -0
  51. data/lib/generators/flux_on_rails/templates/tasks/react_tasks.rake +14 -0
  52. metadata +122 -0
@@ -0,0 +1,110 @@
1
+ //= require constants/app-constants
2
+ //= require dispatchers/app-dispatcher
3
+
4
+ var ExampleStore = (function () {
5
+ var _examples = [];
6
+ var CHANGE_EVENT = 'change';
7
+ var FAIL_TO_CREATE_EVENT = 'creation-failed';
8
+
9
+ return {
10
+ examples: function() {
11
+ return _examples;
12
+ },
13
+ all: function(type, id) {
14
+ $.ajax({
15
+ url: '/examples',
16
+ type: 'GET'
17
+ })
18
+ .done(function (data) {
19
+ _examples = data.examples;
20
+ this.triggerChange();
21
+ }.bind(this))
22
+ },
23
+ new: function () {
24
+ return {
25
+ name: null
26
+ };
27
+ },
28
+ addChangeEvent: function (callback) {
29
+ $(this).on(CHANGE_EVENT, callback);
30
+ },
31
+ addFailToTakeAction: function (callback) {
32
+ $(this).on(FAIL_TO_CREATE_EVENT, callback);
33
+ },
34
+ triggerChange: function (data) {
35
+ $(this).trigger(CHANGE_EVENT, data);
36
+ },
37
+ triggerFailToTakeAction: function(data) {
38
+ $(this).trigger(FAIL_TO_CREATE_EVENT, data);
39
+ },
40
+ create: function(data) {
41
+ $.ajax({
42
+ url: '/examples',
43
+ type: 'POST',
44
+ data: { example: data }
45
+ })
46
+ .done(function (data) {
47
+ _examples.push(data.example);
48
+ this.triggerChange();
49
+ }.bind(this))
50
+ .fail(function (xhr) {
51
+ this.triggerFailToTakeAction([xhr.responseJSON.errors]);
52
+ }.bind(this));
53
+ },
54
+
55
+ update: function (data) {
56
+ $.ajax({
57
+ url: '/examples/' + data.id,
58
+ type: 'PUT',
59
+ data: {example: data}
60
+ })
61
+ .done(function (data) {
62
+ _examples.forEach(function (examp, i) {
63
+ if (examp.id === data.example.id) {
64
+ _examples[i] = data.example;
65
+ return this.triggerChange();
66
+ }
67
+ }.bind(this))
68
+ }.bind(this))
69
+ .fail(function (xhr) {
70
+ this.triggerFailToTakeAction([xhr.responseJSON.errors]);
71
+ }.bind(this));
72
+ },
73
+
74
+ delete: function (id) {
75
+ $.ajax({
76
+ type: 'DELETE',
77
+ url: '/examples/' + id
78
+ })
79
+ .done(function (data) {
80
+ _examples.forEach(function (examp, i) {
81
+ if (examp.id === id) {
82
+ _examples.splice(i, 1)[0];
83
+ return this.triggerChange();
84
+ }
85
+ }.bind(this));
86
+ }.bind(this))
87
+ .fail(function (xhr) {
88
+ this.triggerFailToTakeAction([xhr.responseJSON.errors]);
89
+ }.bind(this));
90
+ },
91
+
92
+ payload: function (payload) {
93
+ var action = payload.action;
94
+ switch(action.type) {
95
+ case AppConstants.CREATE_EXAMPLE:
96
+ this.create(action.data);
97
+ break;
98
+ case AppConstants.UPDATE_EXAMPLE:
99
+ this.update(action.data);
100
+ break;
101
+ case AppConstants.DESTROY_EXAMPLE:
102
+ this.delete(action.id);
103
+ break;
104
+ default:
105
+ }
106
+ }
107
+ }
108
+ }());
109
+
110
+ AppDispatcher.register(ExampleStore.payload.bind(ExampleStore));
@@ -0,0 +1,14 @@
1
+ namespace :react do
2
+ desc 'watch and jsx transform react components'
3
+ task :build => :clean do
4
+ exec 'jsx app/assets/components app/assets/javascripts/react -x jsx'
5
+ end
6
+ desc 'watch and jsx transform react components'
7
+ task :watch do
8
+ exec 'jsx --watch app/assets/components app/assets/javascripts/react -x jsx'
9
+ end
10
+ desc 'remove trailing white spaces from transformed react components'
11
+ task :clean do
12
+ exec "sed -i '' -e's/[ \t]*$//' app/assets/javascripts/react/*.js"
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flux_on_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Ed Shadi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-14 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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
+ description: Flux and React generators for Rails
42
+ email:
43
+ - edshadi@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - flux_on_rails-1.0.0.gem
54
+ - flux_on_rails.gemspec
55
+ - lib/flux_on_rails.rb
56
+ - lib/flux_on_rails/version.rb
57
+ - lib/generators/flux_on_rails/install_generator.rb
58
+ - lib/generators/flux_on_rails/templates/actions/example-actions.js
59
+ - lib/generators/flux_on_rails/templates/application.js
60
+ - lib/generators/flux_on_rails/templates/components/.gitkeep
61
+ - lib/generators/flux_on_rails/templates/constants/app-constants.js
62
+ - lib/generators/flux_on_rails/templates/dispatcher.js
63
+ - lib/generators/flux_on_rails/templates/dispatchers/app-dispatcher.js
64
+ - lib/generators/flux_on_rails/templates/form-for.js
65
+ - lib/generators/flux_on_rails/templates/react-form-for-object/.bower.json
66
+ - lib/generators/flux_on_rails/templates/react-form-for-object/.bowerrc
67
+ - lib/generators/flux_on_rails/templates/react-form-for-object/.gitignore
68
+ - lib/generators/flux_on_rails/templates/react-form-for-object/README.md
69
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/checkbox-input.react.js
70
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/color-input.react.js
71
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/date-input.react.js
72
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/datetime-input.react.js
73
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/email-input.react.js
74
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/form-errors.react.js
75
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/form-for.react.js
76
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/hidden-input.react.js
77
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/input.react.js
78
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/number-input.react.js
79
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/options-for-select.react.js
80
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/password-input.react.js
81
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/radio-input.react.js
82
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/select-input.react.js
83
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/submit-input.react.js
84
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/text-input.react.js
85
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/textarea-input.react.js
86
+ - lib/generators/flux_on_rails/templates/react-form-for-object/components/time-input.react.js
87
+ - lib/generators/flux_on_rails/templates/react-form-for-object/example/bower.json
88
+ - lib/generators/flux_on_rails/templates/react-form-for-object/example/index.html
89
+ - lib/generators/flux_on_rails/templates/react-form-for-object/example/js/app.js
90
+ - lib/generators/flux_on_rails/templates/react-form-for-object/example/react/app.jsx
91
+ - lib/generators/flux_on_rails/templates/react-form-for-object/gulpfile.js
92
+ - lib/generators/flux_on_rails/templates/react-form-for-object/package.json
93
+ - lib/generators/flux_on_rails/templates/react-form-for-object/src/bower.json
94
+ - lib/generators/flux_on_rails/templates/react-form-for-object/src/form-for.js
95
+ - lib/generators/flux_on_rails/templates/react.js
96
+ - lib/generators/flux_on_rails/templates/stores/example-store.js
97
+ - lib/generators/flux_on_rails/templates/tasks/react_tasks.rake
98
+ homepage: ''
99
+ licenses:
100
+ - MIT
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.0.14
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Flux and React generators and setup for Rails
122
+ test_files: []