Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit fea8e7f

Browse files
committed
initial commit - while_loading needs help
0 parents  commit fea8e7f

File tree

158 files changed

+172762
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+172762
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.bundle/
2+
log/*.log
3+
pkg/
4+
test/dummy/db/*.sqlite3
5+
test/dummy/log/*.log
6+
test/dummy/tmp/
7+
test/dummy/.sass-cache
8+
.DS_Store

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format documentation

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
gem 'opal-react', path: "../opal-react" #git: "https://github.com/catprintlabs/react.rb.git", :branch => 'opal-0.8' #
2+
gem 'opal', git: "https://github.com/catprintlabs/opal.git"
3+
gem 'opal-browser'
4+
gem 'react-rails', path: "../react-rails"
5+
gemspec

Gemfile.lock

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
GIT
2+
remote: https://github.com/catprintlabs/opal.git
3+
revision: 3682db6f2b23a584787a68d5338a7ee9cb35565a
4+
specs:
5+
opal (0.7.1)
6+
hike (~> 1.2)
7+
sourcemap (~> 0.1.0)
8+
sprockets (>= 2.2.3, < 4.0.0)
9+
tilt (~> 1.4)
10+
11+
PATH
12+
remote: .
13+
specs:
14+
reactive_record (0.0.1)
15+
opal-browser
16+
opal-rails
17+
pry
18+
rails (~> 3.2.13)
19+
react-rails
20+
therubyracer
21+
22+
PATH
23+
remote: ../opal-react
24+
specs:
25+
opal-react (0.0.2)
26+
opal
27+
opal-activesupport
28+
29+
PATH
30+
remote: ../react-rails
31+
specs:
32+
react-rails (1.0.0)
33+
coffee-script-source (~> 1.8)
34+
connection_pool
35+
execjs
36+
rails (>= 3.2)
37+
tilt
38+
39+
GEM
40+
remote: http://rubygems.org/
41+
specs:
42+
actionmailer (3.2.21)
43+
actionpack (= 3.2.21)
44+
mail (~> 2.5.4)
45+
actionpack (3.2.21)
46+
activemodel (= 3.2.21)
47+
activesupport (= 3.2.21)
48+
builder (~> 3.0.0)
49+
erubis (~> 2.7.0)
50+
journey (~> 1.0.4)
51+
rack (~> 1.4.5)
52+
rack-cache (~> 1.2)
53+
rack-test (~> 0.6.1)
54+
sprockets (~> 2.2.1)
55+
activemodel (3.2.21)
56+
activesupport (= 3.2.21)
57+
builder (~> 3.0.0)
58+
activerecord (3.2.21)
59+
activemodel (= 3.2.21)
60+
activesupport (= 3.2.21)
61+
arel (~> 3.0.2)
62+
tzinfo (~> 0.3.29)
63+
activeresource (3.2.21)
64+
activemodel (= 3.2.21)
65+
activesupport (= 3.2.21)
66+
activesupport (3.2.21)
67+
i18n (~> 0.6, >= 0.6.4)
68+
multi_json (~> 1.0)
69+
arel (3.0.3)
70+
builder (3.0.4)
71+
capybara (2.4.4)
72+
mime-types (>= 1.16)
73+
nokogiri (>= 1.3.3)
74+
rack (>= 1.0.0)
75+
rack-test (>= 0.5.4)
76+
xpath (~> 2.0)
77+
coderay (1.1.0)
78+
coffee-script-source (1.9.1.1)
79+
connection_pool (2.2.0)
80+
diff-lcs (1.2.5)
81+
erubis (2.7.0)
82+
execjs (2.5.2)
83+
factory_girl (4.5.0)
84+
activesupport (>= 3.0.0)
85+
factory_girl_rails (4.5.0)
86+
factory_girl (~> 4.5.0)
87+
railties (>= 3.0.0)
88+
hike (1.2.3)
89+
i18n (0.7.0)
90+
journey (1.0.4)
91+
jquery-rails (3.1.2)
92+
railties (>= 3.0, < 5.0)
93+
thor (>= 0.14, < 2.0)
94+
json (1.8.3)
95+
libv8 (3.16.14.7)
96+
mail (2.5.4)
97+
mime-types (~> 1.16)
98+
treetop (~> 1.4.8)
99+
method_source (0.8.2)
100+
mime-types (1.25.1)
101+
mini_portile (0.6.2)
102+
multi_json (1.11.1)
103+
nokogiri (1.6.6.2)
104+
mini_portile (~> 0.6.0)
105+
opal-activesupport (0.1.0)
106+
opal (>= 0.5.0, < 1.0.0)
107+
opal-browser (0.1.0.beta1)
108+
opal (>= 0.5.5)
109+
paggio
110+
opal-jquery (0.3.0)
111+
opal (~> 0.7.0)
112+
opal-rails (0.7.0)
113+
jquery-rails
114+
opal (~> 0.7.0)
115+
opal-activesupport (>= 0.0.5)
116+
opal-jquery (~> 0.3.0.beta1)
117+
opal-rspec (~> 0.4.0)
118+
rails (>= 3.2, < 5.0)
119+
opal-rspec (0.4.2)
120+
opal (~> 0.7.0)
121+
paggio (0.2.4)
122+
polyglot (0.3.5)
123+
pry (0.10.1)
124+
coderay (~> 1.1.0)
125+
method_source (~> 0.8.1)
126+
slop (~> 3.4)
127+
rack (1.4.5)
128+
rack-cache (1.2)
129+
rack (>= 0.4)
130+
rack-ssl (1.3.4)
131+
rack
132+
rack-test (0.6.3)
133+
rack (>= 1.0)
134+
rails (3.2.21)
135+
actionmailer (= 3.2.21)
136+
actionpack (= 3.2.21)
137+
activerecord (= 3.2.21)
138+
activeresource (= 3.2.21)
139+
activesupport (= 3.2.21)
140+
bundler (~> 1.0)
141+
railties (= 3.2.21)
142+
railties (3.2.21)
143+
actionpack (= 3.2.21)
144+
activesupport (= 3.2.21)
145+
rack-ssl (~> 1.3.2)
146+
rake (>= 0.8.7)
147+
rdoc (~> 3.4)
148+
thor (>= 0.14.6, < 2.0)
149+
rake (10.4.2)
150+
rdoc (3.12.2)
151+
json (~> 1.4)
152+
ref (1.0.5)
153+
rspec-core (3.3.0)
154+
rspec-support (~> 3.3.0)
155+
rspec-expectations (3.3.0)
156+
diff-lcs (>= 1.2.0, < 2.0)
157+
rspec-support (~> 3.3.0)
158+
rspec-mocks (3.3.0)
159+
diff-lcs (>= 1.2.0, < 2.0)
160+
rspec-support (~> 3.3.0)
161+
rspec-rails (3.3.0)
162+
actionpack (>= 3.0, < 4.3)
163+
activesupport (>= 3.0, < 4.3)
164+
railties (>= 3.0, < 4.3)
165+
rspec-core (~> 3.3.0)
166+
rspec-expectations (~> 3.3.0)
167+
rspec-mocks (~> 3.3.0)
168+
rspec-support (~> 3.3.0)
169+
rspec-support (3.3.0)
170+
slop (3.6.0)
171+
sourcemap (0.1.1)
172+
sprockets (2.2.3)
173+
hike (~> 1.2)
174+
multi_json (~> 1.0)
175+
rack (~> 1.0)
176+
tilt (~> 1.1, != 1.3.0)
177+
sqlite3 (1.3.10)
178+
therubyracer (0.12.2)
179+
libv8 (~> 3.16.14.0)
180+
ref
181+
thor (0.19.1)
182+
tilt (1.4.1)
183+
treetop (1.4.15)
184+
polyglot
185+
polyglot (>= 0.3.1)
186+
tzinfo (0.3.44)
187+
xpath (2.0.0)
188+
nokogiri (~> 1.3)
189+
190+
PLATFORMS
191+
ruby
192+
193+
DEPENDENCIES
194+
capybara
195+
factory_girl_rails
196+
opal!
197+
opal-react!
198+
react-rails!
199+
reactive_record!
200+
rspec-rails
201+
sqlite3
202+
203+
BUNDLED WITH
204+
1.10.2

MIT-LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2015 YOURNAME
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.rdoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= ReactiveRecord
2+
3+
This project rocks and uses MIT-LICENSE.

Rakefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
begin
2+
require 'bundler/setup'
3+
rescue LoadError
4+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5+
end
6+
7+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
8+
load 'rails/tasks/engine.rake'
9+
Bundler::GemHelper.install_tasks
10+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
11+
require 'rspec/core'
12+
require 'rspec/core/rake_task'
13+
desc "Run all specs in spec directory (excluding plugin specs)"
14+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
15+
16+
require 'opal/rspec/rake_task'
17+
require 'bundler'
18+
Bundler.require
19+
20+
# Add our opal/ directory to the load path
21+
#Opal.append_path File.expand_path('../lib', __FILE__)
22+
23+
Opal::RSpec::RakeTask.new(:spec_opal) do |s|
24+
s.sprockets.paths.tap { s.sprockets.clear_paths }[0..-2].each { |path| s.sprockets.append_path path}
25+
s.main = 'sprockets_runner'
26+
s.append_path 'spec-opal'
27+
end
28+
29+
task :default => [:spec, :spec_opal]

app/assets/images/reactive_record/.gitkeep

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a manifest file that'll be compiled into application.js, which will include all the files
2+
// listed below.
3+
//
4+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6+
//
7+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8+
// the compiled file.
9+
//
10+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11+
// GO AFTER THE REQUIRES BELOW.
12+
//
13+
//= require jquery
14+
//= require jquery_ujs
15+
//= require_tree .
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the top of the
9+
* compiled file, but it's generally better to create a new file per style scope.
10+
*
11+
*= require_self
12+
*= require_tree .
13+
*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ReactiveRecord
2+
class ApplicationController < ActionController::Base
3+
end
4+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module ReactiveRecord
2+
3+
class ReactiveRecordController < ActionController::Base #ApplicationController
4+
5+
#todo make sure this is right... looks like model.id always returns the attribute value of the primary key regardless of what the key is.
6+
7+
def fetch
8+
@data = Hash.new {|hash, key| hash[key] = Hash.new}
9+
params[:pending_fetches].each do |fetch_item|
10+
if parent = Object.const_get(fetch_item[0]).send("find_by_#{fetch_item[1]}", fetch_item[2])
11+
@data[fetch_item[0]][parent.id] ||= ReactiveRecord::Cache.build_json_hash parent
12+
fetch_association(parent, fetch_item[3..-1])
13+
end
14+
end
15+
render :json => @data
16+
end
17+
18+
def fetch_association(item, associations)
19+
@data[item.class.name][item.id] ||= ReactiveRecord::Cache.build_json_hash(item)
20+
unless associations.empty?
21+
association_value = item.send(associations.first)
22+
if association_value.respond_to? :each
23+
association_value.each do |item|
24+
fetch_association(item, associations[1..-1])
25+
end
26+
else
27+
fetch_association(association_value, associations[1..-1])
28+
end
29+
end
30+
end
31+
32+
end
33+
34+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ReactiveRecord
2+
module ApplicationHelper
3+
end
4+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>ReactiveRecord</title>
5+
<%= stylesheet_link_tag "reactive_record/application", :media => "all" %>
6+
<%= javascript_include_tag "reactive_record/application" %>
7+
<%= csrf_meta_tags %>
8+
</head>
9+
<body>
10+
11+
<%= yield %>
12+
13+
</body>
14+
</html>

config/routes.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ReactiveRecord::Engine.routes.draw do
2+
root to: "reactive_record#fetch"
3+
end

lib/Gemfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
source "http://rubygems.org"
2+
3+
# Declare your gem's dependencies in reactive_record.gemspec.
4+
# Bundler will treat runtime dependencies like base dependencies, and
5+
# development dependencies will be added by default to the :development group.
6+
gemspec
7+
8+
# jquery-rails is used by the dummy application
9+
gem "jquery-rails"
10+
11+
# Declare any dependencies that are still in development here instead of in
12+
# your gemspec. These might include edge Rails or gems from your path or
13+
# Git. Remember to move these dependencies to your gemspec before releasing
14+
# your gem to rubygems.org.
15+
16+
# To use debugger
17+
# gem 'debugger'

0 commit comments

Comments
 (0)