joosy 0.1.0.alpha → 1.0.0.RC1
Sign up to get free protection for your applications and to get access to all the features.
- data/.codoopts +5 -0
- data/.gitignore +2 -0
- data/Gemfile +15 -2
- data/Gemfile.lock +102 -81
- data/Guardfile +16 -16
- data/LICENSE +22 -0
- data/MIT-LICENSE +2 -2
- data/README.md +118 -0
- data/app/assets/javascripts/joosy/core/application.js.coffee +53 -0
- data/app/assets/javascripts/joosy/core/form.js.coffee +338 -0
- data/app/assets/javascripts/joosy/core/helpers/form.js.coffee +72 -0
- data/app/assets/javascripts/joosy/core/helpers/view.js.coffee +42 -0
- data/app/assets/javascripts/joosy/core/helpers/widgets.js.coffee +14 -0
- data/app/assets/javascripts/joosy/core/joosy.js.coffee +184 -0
- data/app/assets/javascripts/joosy/core/layout.js.coffee +168 -0
- data/app/assets/javascripts/joosy/core/modules/container.js.coffee +124 -0
- data/app/assets/javascripts/joosy/core/modules/events.js.coffee +122 -0
- data/app/assets/javascripts/joosy/core/modules/filters.js.coffee +39 -0
- data/app/assets/javascripts/joosy/core/modules/log.js.coffee +36 -0
- data/app/assets/javascripts/joosy/core/modules/module.js.coffee +117 -0
- data/app/assets/javascripts/joosy/core/modules/renderer.js.coffee +200 -0
- data/app/assets/javascripts/joosy/core/modules/time_manager.js.coffee +46 -0
- data/app/assets/javascripts/joosy/core/modules/widgets_manager.js.coffee +87 -0
- data/app/assets/javascripts/joosy/core/page.js.coffee +387 -0
- data/app/assets/javascripts/joosy/core/preloader.js.coffee +13 -0
- data/app/assets/javascripts/joosy/core/resource/collection.js.coffee +175 -0
- data/app/assets/javascripts/joosy/core/resource/generic.js.coffee +303 -0
- data/app/assets/javascripts/joosy/core/resource/rest.js.coffee +244 -0
- data/app/assets/javascripts/joosy/core/resource/rest_collection.js.coffee +24 -0
- data/app/assets/javascripts/joosy/core/router.js.coffee +201 -0
- data/app/assets/javascripts/joosy/core/templaters/rails_jst.js.coffee +37 -0
- data/app/assets/javascripts/joosy/core/widget.js.coffee +85 -0
- data/app/assets/javascripts/joosy/preloaders/caching.js.coffee +169 -0
- data/app/assets/javascripts/joosy/preloaders/inline.js.coffee +56 -0
- data/{vendor → app}/assets/javascripts/joosy.js.coffee +0 -1
- data/app/helpers/joosy/sprockets_helper.rb +39 -12
- data/joosy.gemspec +4 -3
- data/lib/joosy/rails/engine.rb +12 -1
- data/lib/joosy/rails/version.rb +2 -2
- data/lib/joosy.rb +9 -0
- data/lib/rails/generators/joosy/application_generator.rb +15 -3
- data/lib/rails/generators/joosy/joosy_base.rb +2 -2
- data/lib/rails/generators/joosy/layout_generator.rb +8 -1
- data/lib/rails/generators/joosy/page_generator.rb +21 -6
- data/lib/rails/generators/joosy/preloader_generator.rb +14 -7
- data/lib/rails/generators/joosy/resource_generator.rb +29 -0
- data/lib/rails/generators/joosy/templates/app/helpers/application.js.coffee +4 -0
- data/lib/rails/generators/joosy/templates/app/layouts/application.js.coffee +1 -0
- data/lib/rails/generators/joosy/templates/app/layouts/template.js.coffee +1 -1
- data/lib/rails/generators/joosy/templates/app/pages/application.js.coffee +1 -1
- data/lib/rails/generators/joosy/templates/app/pages/template.js.coffee +3 -3
- data/lib/rails/generators/joosy/templates/app/pages/welcome/index.js.coffee +22 -0
- data/lib/rails/generators/joosy/templates/app/resources/template.js.coffee +2 -0
- data/lib/rails/generators/joosy/templates/app/routes.js.coffee +7 -1
- data/lib/rails/generators/joosy/templates/app/templates/layouts/application.jst.hamlc +2 -0
- data/lib/rails/generators/joosy/templates/app/templates/pages/welcome/index.jst.hamlc +7 -0
- data/lib/rails/generators/joosy/templates/app/widgets/template.js.coffee +2 -2
- data/lib/rails/generators/joosy/templates/app.js.coffee +4 -0
- data/lib/rails/generators/joosy/templates/app_preloader.js.coffee.erb +9 -12
- data/lib/rails/generators/joosy/templates/app_resources_predefiner.js.coffee.erb +11 -0
- data/lib/rails/generators/joosy/templates/preload.html.erb +5 -6
- data/lib/rails/generators/joosy/templates/preload.html.haml +3 -5
- data/lib/rails/generators/joosy/widget_generator.rb +8 -1
- data/lib/rails/resources_with_joosy.rb +11 -0
- data/spec/javascripts/helpers/spec_helper.js.coffee +25 -0
- data/spec/javascripts/joosy/core/application_spec.js.coffee +40 -0
- data/spec/javascripts/joosy/core/form_spec.js.coffee +200 -0
- data/spec/javascripts/joosy/core/helpers/forms_spec.js.coffee +103 -0
- data/spec/javascripts/joosy/core/helpers/view_spec.js.coffee +10 -0
- data/spec/javascripts/joosy/core/joosy_spec.js.coffee +97 -0
- data/spec/javascripts/joosy/core/layout_spec.js.coffee +50 -0
- data/spec/javascripts/joosy/core/modules/container_spec.js.coffee +32 -27
- data/spec/javascripts/joosy/core/modules/events_spec.js.coffee +55 -18
- data/spec/javascripts/joosy/core/modules/filters_spec.js.coffee +28 -27
- data/spec/javascripts/joosy/core/modules/log_spec.js.coffee +3 -3
- data/spec/javascripts/joosy/core/modules/module_spec.js.coffee +6 -15
- data/spec/javascripts/joosy/core/modules/renderer_spec.js.coffee +203 -0
- data/spec/javascripts/joosy/core/modules/time_manager_spec.js.coffee +12 -7
- data/spec/javascripts/joosy/core/modules/widget_manager_spec.js.coffee +31 -17
- data/spec/javascripts/joosy/core/page_spec.js.coffee +178 -0
- data/spec/javascripts/joosy/core/resource/collection_spec.js.coffee +84 -0
- data/spec/javascripts/joosy/core/resource/generic_spec.js.coffee +149 -0
- data/spec/javascripts/joosy/core/resource/rest_collection_spec.js.coffee +31 -0
- data/spec/javascripts/joosy/core/resource/rest_spec.js.coffee +171 -0
- data/spec/javascripts/joosy/core/router_spec.js.coffee +143 -0
- data/spec/javascripts/joosy/core/templaters/rails_jst_spec.js.coffee +25 -0
- data/spec/javascripts/joosy/core/widget_spec.js.coffee +40 -0
- data/spec/javascripts/joosy/preloaders/caching_spec.js.coffee +36 -0
- data/spec/javascripts/joosy/preloaders/inline_spec.js.coffee +16 -0
- data/spec/javascripts/support/assets/coolface.jpg +0 -0
- data/spec/javascripts/support/assets/okay.jpg +0 -0
- data/spec/javascripts/support/assets/test.js +1 -0
- data/spec/javascripts/support/sinon-ie-1.3.1.js +82 -0
- data/vendor/assets/javascripts/jquery.form.js +978 -963
- data/vendor/assets/javascripts/metamorph.js +409 -0
- data/vendor/assets/javascripts/sugar.js +1057 -366
- metadata +95 -50
- data/README.rdoc +0 -3
- data/lib/joosy/forms.rb +0 -47
- data/lib/joosy-rails.rb +0 -5
- data/lib/rails/generators/joosy/templates/preload.html.slim +0 -21
- data/tmp/javascripts/.gitignore +0 -1
- data/tmp/spec/javascripts/helpers/.gitignore +0 -1
- data/vendor/assets/javascripts/base64.js +0 -135
- data/vendor/assets/javascripts/inflection.js +0 -656
- data/vendor/assets/javascripts/joosy/core/application.js.coffee +0 -26
- data/vendor/assets/javascripts/joosy/core/form.js.coffee +0 -87
- data/vendor/assets/javascripts/joosy/core/joosy.js.coffee +0 -62
- data/vendor/assets/javascripts/joosy/core/layout.js.coffee +0 -38
- data/vendor/assets/javascripts/joosy/core/modules/container.js.coffee +0 -51
- data/vendor/assets/javascripts/joosy/core/modules/events.js.coffee +0 -17
- data/vendor/assets/javascripts/joosy/core/modules/filters.js.coffee +0 -39
- data/vendor/assets/javascripts/joosy/core/modules/log.js.coffee +0 -12
- data/vendor/assets/javascripts/joosy/core/modules/module.js.coffee +0 -28
- data/vendor/assets/javascripts/joosy/core/modules/time_manager.js.coffee +0 -23
- data/vendor/assets/javascripts/joosy/core/modules/widgets_manager.js.coffee +0 -45
- data/vendor/assets/javascripts/joosy/core/page.js.coffee +0 -136
- data/vendor/assets/javascripts/joosy/core/resource/rest.js.coffee +0 -69
- data/vendor/assets/javascripts/joosy/core/resource/rest_collection.js.coffee +0 -42
- data/vendor/assets/javascripts/joosy/core/router.js.coffee +0 -75
- data/vendor/assets/javascripts/joosy/core/widget.js.coffee +0 -35
- data/vendor/assets/javascripts/joosy/preloader/development.js.coffee +0 -27
- data/vendor/assets/javascripts/joosy/preloader/production.js.coffee +0 -84
data/.codoopts
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in joosy
|
4
|
-
gemspec
|
3
|
+
# Specify your gem's dependencies in joosy.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'jasmine', :git => 'git://github.com/pivotal/jasmine-gem.git'
|
8
|
+
gem 'guard-sprockets', :git => 'git://github.com/roundlake/guard-sprockets.git'
|
9
|
+
gem 'thin'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :test do
|
13
|
+
if RUBY_PLATFORM =~ /linux/
|
14
|
+
gem 'rb-inotify'
|
15
|
+
gem 'libnotify'
|
16
|
+
end
|
17
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,110 +1,127 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/pivotal/jasmine-gem.git
|
3
|
+
revision: c72e8d248d49a1ebe53f31a09ac511194ad4edf1
|
4
|
+
specs:
|
5
|
+
jasmine (1.2.0.rc3)
|
6
|
+
jasmine-core (>= 1.2.0.rc3)
|
7
|
+
rack (~> 1.0)
|
8
|
+
rspec (>= 1.3.1)
|
9
|
+
selenium-webdriver (>= 0.1.3)
|
10
|
+
|
11
|
+
GIT
|
12
|
+
remote: git://github.com/roundlake/guard-sprockets.git
|
13
|
+
revision: 77365fbf48b2af0c93a42fcb05747c174b90d8d7
|
14
|
+
specs:
|
15
|
+
guard-sprockets (0.3.1)
|
16
|
+
guard (~> 1.0.0)
|
17
|
+
sprockets (~> 2.0)
|
18
|
+
|
1
19
|
PATH
|
2
20
|
remote: .
|
3
21
|
specs:
|
4
|
-
joosy
|
22
|
+
joosy (0.1.0.RC3)
|
5
23
|
coffee-rails
|
24
|
+
haml_coffee_assets
|
25
|
+
i18n-js
|
6
26
|
jquery-rails
|
7
|
-
rails (>= 3.
|
27
|
+
rails (>= 3.1.0)
|
8
28
|
|
9
29
|
GEM
|
10
30
|
remote: http://rubygems.org/
|
11
31
|
specs:
|
12
|
-
actionmailer (3.
|
13
|
-
actionpack (= 3.
|
14
|
-
mail (~> 2.
|
15
|
-
actionpack (3.
|
16
|
-
activemodel (= 3.
|
17
|
-
activesupport (= 3.
|
32
|
+
actionmailer (3.2.3)
|
33
|
+
actionpack (= 3.2.3)
|
34
|
+
mail (~> 2.4.4)
|
35
|
+
actionpack (3.2.3)
|
36
|
+
activemodel (= 3.2.3)
|
37
|
+
activesupport (= 3.2.3)
|
18
38
|
builder (~> 3.0.0)
|
19
39
|
erubis (~> 2.7.0)
|
20
|
-
|
21
|
-
rack (~> 1.
|
22
|
-
rack-cache (~> 1.
|
23
|
-
rack-mount (~> 0.8.2)
|
40
|
+
journey (~> 1.0.1)
|
41
|
+
rack (~> 1.4.0)
|
42
|
+
rack-cache (~> 1.2)
|
24
43
|
rack-test (~> 0.6.1)
|
25
|
-
sprockets (~> 2.
|
26
|
-
activemodel (3.
|
27
|
-
activesupport (= 3.
|
44
|
+
sprockets (~> 2.1.2)
|
45
|
+
activemodel (3.2.3)
|
46
|
+
activesupport (= 3.2.3)
|
28
47
|
builder (~> 3.0.0)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
arel (~> 2.2.1)
|
48
|
+
activerecord (3.2.3)
|
49
|
+
activemodel (= 3.2.3)
|
50
|
+
activesupport (= 3.2.3)
|
51
|
+
arel (~> 3.0.2)
|
34
52
|
tzinfo (~> 0.3.29)
|
35
|
-
activeresource (3.
|
36
|
-
activemodel (= 3.
|
37
|
-
activesupport (= 3.
|
38
|
-
activesupport (3.
|
53
|
+
activeresource (3.2.3)
|
54
|
+
activemodel (= 3.2.3)
|
55
|
+
activesupport (= 3.2.3)
|
56
|
+
activesupport (3.2.3)
|
57
|
+
i18n (~> 0.6)
|
39
58
|
multi_json (~> 1.0)
|
40
|
-
arel (
|
59
|
+
arel (3.0.2)
|
41
60
|
builder (3.0.0)
|
42
|
-
childprocess (0.3.
|
61
|
+
childprocess (0.3.1)
|
43
62
|
ffi (~> 1.0.6)
|
44
|
-
coffee-rails (3.
|
63
|
+
coffee-rails (3.2.2)
|
45
64
|
coffee-script (>= 2.2.0)
|
46
|
-
railties (~> 3.
|
65
|
+
railties (~> 3.2.0)
|
47
66
|
coffee-script (2.2.0)
|
48
67
|
coffee-script-source
|
49
68
|
execjs
|
50
69
|
coffee-script-source (1.2.0)
|
70
|
+
daemons (1.1.8)
|
51
71
|
diff-lcs (1.1.3)
|
52
72
|
erubis (2.7.0)
|
53
|
-
|
73
|
+
eventmachine (0.12.10)
|
74
|
+
eventmachine (0.12.10-java)
|
75
|
+
execjs (1.3.0)
|
54
76
|
multi_json (~> 1.0)
|
55
77
|
ffi (1.0.11)
|
56
78
|
ffi (1.0.11-java)
|
57
|
-
guard (0.
|
79
|
+
guard (1.0.1)
|
58
80
|
ffi (>= 0.5.0)
|
59
81
|
thor (~> 0.14.6)
|
60
|
-
guard-coffeescript (0.5.
|
82
|
+
guard-coffeescript (0.5.7)
|
61
83
|
coffee-script (>= 2.2.0)
|
62
84
|
guard (>= 0.8.3)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
sprockets (~> 2)
|
85
|
+
haml_coffee_assets (0.8.5)
|
86
|
+
execjs (>= 1.2.9)
|
87
|
+
sprockets (>= 2.0.3)
|
88
|
+
tilt (>= 1.3.3)
|
68
89
|
hike (1.2.1)
|
69
90
|
i18n (0.6.0)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
jquery-rails (1.0.19)
|
77
|
-
railties (~> 3.0)
|
91
|
+
i18n-js (2.1.2)
|
92
|
+
i18n
|
93
|
+
jasmine-core (1.2.0.rc3)
|
94
|
+
journey (1.0.3)
|
95
|
+
jquery-rails (2.0.2)
|
96
|
+
railties (>= 3.2.0, < 5.0)
|
78
97
|
thor (~> 0.14)
|
79
|
-
json (1.6.
|
80
|
-
json (1.6.
|
81
|
-
mail (2.
|
98
|
+
json (1.6.6)
|
99
|
+
json (1.6.6-java)
|
100
|
+
mail (2.4.4)
|
82
101
|
i18n (>= 0.4.0)
|
83
102
|
mime-types (~> 1.16)
|
84
103
|
treetop (~> 1.4.8)
|
85
|
-
mime-types (1.
|
86
|
-
multi_json (1.0
|
104
|
+
mime-types (1.18)
|
105
|
+
multi_json (1.2.0)
|
87
106
|
polyglot (0.3.3)
|
88
|
-
rack (1.
|
89
|
-
rack-cache (1.
|
107
|
+
rack (1.4.1)
|
108
|
+
rack-cache (1.2)
|
90
109
|
rack (>= 0.4)
|
91
|
-
rack-mount (0.8.3)
|
92
|
-
rack (>= 1.0.0)
|
93
110
|
rack-ssl (1.3.2)
|
94
111
|
rack
|
95
112
|
rack-test (0.6.1)
|
96
113
|
rack (>= 1.0)
|
97
|
-
rails (3.
|
98
|
-
actionmailer (= 3.
|
99
|
-
actionpack (= 3.
|
100
|
-
activerecord (= 3.
|
101
|
-
activeresource (= 3.
|
102
|
-
activesupport (= 3.
|
114
|
+
rails (3.2.3)
|
115
|
+
actionmailer (= 3.2.3)
|
116
|
+
actionpack (= 3.2.3)
|
117
|
+
activerecord (= 3.2.3)
|
118
|
+
activeresource (= 3.2.3)
|
119
|
+
activesupport (= 3.2.3)
|
103
120
|
bundler (~> 1.0)
|
104
|
-
railties (= 3.
|
105
|
-
railties (3.
|
106
|
-
actionpack (= 3.
|
107
|
-
activesupport (= 3.
|
121
|
+
railties (= 3.2.3)
|
122
|
+
railties (3.2.3)
|
123
|
+
actionpack (= 3.2.3)
|
124
|
+
activesupport (= 3.2.3)
|
108
125
|
rack-ssl (~> 1.3.2)
|
109
126
|
rake (>= 0.8.7)
|
110
127
|
rdoc (~> 3.4)
|
@@ -112,30 +129,34 @@ GEM
|
|
112
129
|
rake (0.9.2.2)
|
113
130
|
rdoc (3.12)
|
114
131
|
json (~> 1.4)
|
115
|
-
rspec (2.
|
116
|
-
rspec-core (~> 2.
|
117
|
-
rspec-expectations (~> 2.
|
118
|
-
rspec-mocks (~> 2.
|
119
|
-
rspec-core (2.
|
120
|
-
rspec-expectations (2.
|
121
|
-
diff-lcs (~> 1.1.
|
122
|
-
rspec-mocks (2.
|
123
|
-
rubyzip (0.9.
|
124
|
-
selenium-webdriver (2.
|
132
|
+
rspec (2.9.0)
|
133
|
+
rspec-core (~> 2.9.0)
|
134
|
+
rspec-expectations (~> 2.9.0)
|
135
|
+
rspec-mocks (~> 2.9.0)
|
136
|
+
rspec-core (2.9.0)
|
137
|
+
rspec-expectations (2.9.1)
|
138
|
+
diff-lcs (~> 1.1.3)
|
139
|
+
rspec-mocks (2.9.0)
|
140
|
+
rubyzip (0.9.6.1)
|
141
|
+
selenium-webdriver (2.20.0)
|
125
142
|
childprocess (>= 0.2.5)
|
126
|
-
ffi (~> 1.0
|
127
|
-
multi_json (~> 1.0
|
143
|
+
ffi (~> 1.0)
|
144
|
+
multi_json (~> 1.0)
|
128
145
|
rubyzip
|
129
|
-
sprockets (2.
|
146
|
+
sprockets (2.1.2)
|
130
147
|
hike (~> 1.2)
|
131
148
|
rack (~> 1.0)
|
132
149
|
tilt (~> 1.1, != 1.3.0)
|
150
|
+
thin (1.3.1)
|
151
|
+
daemons (>= 1.0.9)
|
152
|
+
eventmachine (>= 0.12.6)
|
153
|
+
rack (>= 1.0.0)
|
133
154
|
thor (0.14.6)
|
134
155
|
tilt (1.3.3)
|
135
156
|
treetop (1.4.10)
|
136
157
|
polyglot
|
137
158
|
polyglot (>= 0.3.1)
|
138
|
-
tzinfo (0.3.
|
159
|
+
tzinfo (0.3.33)
|
139
160
|
|
140
161
|
PLATFORMS
|
141
162
|
java
|
@@ -144,7 +165,7 @@ PLATFORMS
|
|
144
165
|
DEPENDENCIES
|
145
166
|
guard
|
146
167
|
guard-coffeescript
|
147
|
-
guard-
|
148
|
-
|
149
|
-
|
150
|
-
|
168
|
+
guard-sprockets!
|
169
|
+
jasmine!
|
170
|
+
joosy!
|
171
|
+
thin
|
data/Guardfile
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'coffee_script'
|
2
|
+
|
3
|
+
guard 'coffeescript', :output => 'tmp/spec/javascripts', :all_on_start => true do
|
4
|
+
watch(%r{^spec/javascripts/(.+)[sS]pec\.js\.coffee$})
|
4
5
|
end
|
5
6
|
|
6
|
-
guard 'coffeescript',
|
7
|
-
|
8
|
-
watch(%r{^spec/javascripts/helpers/(.+)\.js\.coffee$})
|
7
|
+
guard 'coffeescript', :output => 'tmp/spec/javascripts/helpers', :all_on_start => true do
|
8
|
+
watch(%r{^spec/javascripts/helpers/(.+)\.js\.coffee$})
|
9
9
|
end
|
10
10
|
|
11
11
|
jquery_path = File.join(Gem.loaded_specs['jquery-rails'].full_gem_path, 'vendor/assets/javascripts')
|
12
|
-
guard 'sprockets',
|
13
|
-
:destination => 'tmp/javascripts',
|
14
|
-
:asset_paths => ['vendor/assets/javascripts', jquery_path] do
|
15
|
-
watch('vendor/assets/javascripts/joosy.js.coffee')
|
16
|
-
end
|
17
12
|
|
18
|
-
guard '
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
guard 'sprockets', :destination => 'tmp/javascripts',
|
14
|
+
:asset_paths => ['app/assets/javascripts', 'vendor/assets/javascripts', jquery_path],
|
15
|
+
:root_file => [
|
16
|
+
'app/assets/javascripts/joosy.js.coffee',
|
17
|
+
'app/assets/javascripts/joosy/preloaders/caching.js.coffee',
|
18
|
+
'app/assets/javascripts/joosy/preloaders/inline.js.coffee'
|
19
|
+
] do
|
20
|
+
watch %r{^app/assets/javascripts/joosy/core.+\.js}
|
21
|
+
watch 'app/assets/javascripts/joosy.js.coffee'
|
22
22
|
end
|
23
23
|
|
24
|
-
puts 'HI! Hit <Enter> to generate all stuff.'
|
24
|
+
puts 'HI! Hit <Enter> to generate all stuff.'
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2012 Round Lake, inc.,
|
4
|
+
Peter Zotov <whitequark@whitequark.org>.
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/MIT-LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Copyright (C) 2011 by Boris Staal <boris@roundlake.ru>,
|
2
|
-
|
1
|
+
Copyright (C) 2011, 2012 by Boris Staal <boris@roundlake.ru>,
|
2
|
+
Peter Zotov <p.zotov@roundlake.ru>.
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
a copy of this software and associated documentation files (the
|
data/README.md
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
![Joosy](http://f.cl.ly/items/2N2J453J2B353F1A0t0I/joocy1.1.png)
|
2
|
+
|
3
|
+
## What is Joosy
|
4
|
+
|
5
|
+
Joosy is a full-featured javascript MVC framework, which mostly follows Rails philosophy, particularly in preferring conventions over configuration. It helps you to avoid boilerplate and makes it easy to maintain and extend the app.
|
6
|
+
|
7
|
+
Joosy allows you to create web apps which work completely in the browser. So that, it helps you to relocate all your Rails Views to the client side. It also helps you with managing the growing quantity of JS code. On another hand, it makes your backend to have exactly one function -- to be a simple REST provider. That leads to easier development support and improves the scalability greatly.
|
8
|
+
|
9
|
+
Joosy doesn't compete with jQuery. It is built on the top of [jQuery](http://jquery.com/), and utilizes [CoffeeScript](http://coffeescript.org/). It either includes [Sugar.js](http://sugarjs.com/) in role of ActiveSupport to make your life even better.
|
10
|
+
|
11
|
+
Finally, Joosy boosts your development drastically.
|
12
|
+
|
13
|
+
### How is Joosy different from X
|
14
|
+
|
15
|
+
We share quite different goals and totally differ in ways to achieve it. While existing MVC frameworks define basic entities for you and leave you alone with application basic patterns and solutions, Joosy tries to give convention for each of them.
|
16
|
+
|
17
|
+
#### [Backbone](http://documentcloud.github.com/backbone/)
|
18
|
+
|
19
|
+
In Backbone or Spine you only have abstract Views, Models and "Packs of …" and you should even decide on your own what's Controller for you. Joosy gives you the ready plan on how to move on to the success. If you ever used Rails you know that feeling: you concentrate on _what_ you create and not on _how_ to structure it.
|
20
|
+
|
21
|
+
#### [Ember](http://emberjs.com/)
|
22
|
+
|
23
|
+
Ember is the closest framework by spirit. But it still doesn't give you enough conventions and is even more abstract than Backbone in several parts. It either limits you to Handlebars. Joosy rendering system is built on top of same solution, Morpher. That said you can bind your variables dynamically just like in Ember. But it allows you to any templates syntax.
|
24
|
+
|
25
|
+
### The Joosy MVC Interpretation
|
26
|
+
|
27
|
+
You probably are familiar with the concept of MVC. It's a pattern to keep code DRY, isolate business logic from the UI. However the concept of Model-View-Controller just doesn't work for browser applications. There are numerous reasons for that that can't be fit into this introduction. Instead we'll tell you what we propose.
|
28
|
+
|
29
|
+
#### Views
|
30
|
+
|
31
|
+
In Joosy views are just views. Set of files (in templates/ folder). They do not differ from Rails and give you quite the same abilities (including helpers!). Besides that Joosy has renderDynamic which allows you to bind your variables to HTML representation tightly. You change variable value, Joosy changes HTML.
|
32
|
+
|
33
|
+
By default Joosy comes with Coffee-Haml (which looks and works pretty much like Ruby Haml). Combined with Sugar.js it will feel very similar to Ruby and server-side and will provide you the easiest migration.
|
34
|
+
|
35
|
+
#### Controllers
|
36
|
+
|
37
|
+
Unlike server-side, client-side has a state. At server-side you only have incoming data and you convert it to output data. At client-side you work with events. To handle correct bootstrap and help you organize your code well, we have 3 entities which play the role of controller. Their organizing functions are similar but they behavior dramatically different at bootstrap.
|
38
|
+
|
39
|
+
They are:
|
40
|
+
|
41
|
+
###### Pages
|
42
|
+
Pages are the heart of the entire application. They are used to fetch data, bind events, setup widgets, trig visual effects, and pass the data to the templates.
|
43
|
+
|
44
|
+
###### Layouts
|
45
|
+
Layouts are mainly used to set a part of your page that won't be reloaded often. Pages are wrapped into Layouts. Just like pages Layouts can bind events and setup widgets. Consider layouts as a bit extended version of what you have in Rails.
|
46
|
+
|
47
|
+
###### Widgets
|
48
|
+
Widgets are needed to keep your code DRY. They help you organize it in reusable modules.
|
49
|
+
|
50
|
+
#### Models
|
51
|
+
|
52
|
+
There are some facts that should be noted to explain it how we understand browser-side models.
|
53
|
+
|
54
|
+
* In most cases you will want to leave your logic on server-side. In a real models.
|
55
|
+
* You rarely want to make 5 HTTP requests instead of 1.
|
56
|
+
* In most cases you will have to give user a Form as a way to change anything.
|
57
|
+
* You'll get different possible set of fields depending on case you use your model at.
|
58
|
+
|
59
|
+
With all that in mind we came up to the fact: you can not reproduce real models in browser nor you should try to. What you need is a comfortable channel between browser and server-side to get structured data, work with that and send it back. That's mainly a transport and interface task while models are MUCH more than that. To solve this task Joosy offers you two things:
|
60
|
+
|
61
|
+
###### Resources
|
62
|
+
Resource is wrapper on top of JSON dump which will help you to get data from server, parse it and structure it. It will trigger 'changed' if you change resource, will map inline hashes in other resources if possible and do all other magic stuff you expect from your model when you read data. Resources either define Collections. In most cases you can say Resources are fully-functional read part of what you get used to as model.
|
63
|
+
|
64
|
+
###### Forms
|
65
|
+
After you got your data as resources and used it to display something, you'll need to change it. While resource defines modification methods like _save_ and _destroy_ most of complex modifications should go through Joosy.Form. It turns your form into AJAX and binds the resource to it. It handles file uploads, it gives you upload progress callback and makes it a dream to handle. Joosy.Form will either understand standard Rails invalidation response and will mark invalidated fields with ".field_with_errors" out of box.
|
66
|
+
|
67
|
+
|
68
|
+
## What is Joosy good for
|
69
|
+
|
70
|
+
Joosy is intended to ease building of modern medium and large-sized browser-based applications, minimize code base while providing more features and what's most important, giving you ready conventions for typical tasks.
|
71
|
+
|
72
|
+
Compare Joosy to Backbone like Rails to Sinatra. While Rails engine is much more powerful, Sinatra still has a lot of cases to be used at. If all you need is to enable some RICHness on one of your pages, Joosy can handle that. But Backbone will do the trick with lesser dependencies. If you need to move complete web-resource to browser Joosy will do the task at its Best.
|
73
|
+
|
74
|
+
## What's next?
|
75
|
+
|
76
|
+
We have a set of guidelines showing you, step-by-step, how to create a Joosy application. Follow them at our [Guides site](http://guides.joosy.ws/).
|
77
|
+
|
78
|
+
### Hello world app
|
79
|
+
|
80
|
+
Add Joosy gem to your Gemfile:
|
81
|
+
|
82
|
+
gem 'joosy'
|
83
|
+
|
84
|
+
Using built-in generators you can quickly generate small app inside your Rails app to see Joosy application from inside a bit.
|
85
|
+
|
86
|
+
rails g joosy:application dummy
|
87
|
+
rails g joosy:preloader dummy
|
88
|
+
|
89
|
+
Now you can `rails s` and see Joosy placeholder at [localhost:3000/dummy](http://localhost:3000/dummy)
|
90
|
+
|
91
|
+
Generated application will consist of one `Layout` and one `Page` both including very basic practices of Joosy.
|
92
|
+
|
93
|
+
# Hacking
|
94
|
+
|
95
|
+
Don't forget to run tests!
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
bundle install
|
99
|
+
rake guard
|
100
|
+
rake jasmine
|
101
|
+
```
|
102
|
+
|
103
|
+
http://localhost:8888/ <- they are here :)
|
104
|
+
|
105
|
+
Credits
|
106
|
+
-------
|
107
|
+
|
108
|
+
<img src="http://roundlake.ru/assets/logo.png" align="right" />
|
109
|
+
|
110
|
+
* Boris Staal ([@_inossidabile](http://twitter.com/#!/_inossidabile))
|
111
|
+
* Andrew Shaydurov
|
112
|
+
* Alexander Pavlenko ([@alerticus](http://twitter.com/#!/alerticus))
|
113
|
+
* Peter Zotov ([@whitequark](http://twitter.com/#!/whitequark))
|
114
|
+
|
115
|
+
LICENSE
|
116
|
+
-------
|
117
|
+
|
118
|
+
It is free software, and may be redistributed under the terms of MIT license.
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#= require joosy/core/joosy
|
2
|
+
|
3
|
+
#
|
4
|
+
# Joosy Application container
|
5
|
+
#
|
6
|
+
# @mixin
|
7
|
+
#
|
8
|
+
Joosy.Application =
|
9
|
+
Pages: {}
|
10
|
+
Layouts: {}
|
11
|
+
Controls: {}
|
12
|
+
|
13
|
+
loading: true
|
14
|
+
identity: true
|
15
|
+
|
16
|
+
#
|
17
|
+
# Starts Joosy application by binding to element and bootstraping routes
|
18
|
+
#
|
19
|
+
# @param [String] name Name of app (the dir its located in)
|
20
|
+
# @param [String] selector jQuery-compatible selector of root application element
|
21
|
+
# @param [Object] options
|
22
|
+
#
|
23
|
+
initialize: (@name, @selector, options={}) ->
|
24
|
+
@[key] = value for key, value of options
|
25
|
+
@templater = new Joosy.Templaters.RailsJST @name
|
26
|
+
|
27
|
+
Joosy.Router.__setupRoutes()
|
28
|
+
|
29
|
+
@sandboxSelector = Joosy.uuid()
|
30
|
+
@content().after "<div id='#{@sandboxSelector}' style='display:none'></div>"
|
31
|
+
@sandboxSelector = '#' + @sandboxSelector
|
32
|
+
|
33
|
+
#
|
34
|
+
# Gets current application root node
|
35
|
+
#
|
36
|
+
content: ->
|
37
|
+
$(@selector)
|
38
|
+
|
39
|
+
#
|
40
|
+
# Gets current application sandbox node
|
41
|
+
#
|
42
|
+
sandbox: ->
|
43
|
+
$(@sandboxSelector)
|
44
|
+
|
45
|
+
#
|
46
|
+
# Switches to given page
|
47
|
+
#
|
48
|
+
# @param [Joosy.Page] page The class (not object) of page to load
|
49
|
+
# @param [Object] params Hash of page params
|
50
|
+
#
|
51
|
+
setCurrentPage: (page, params) ->
|
52
|
+
#if @page not instanceof page
|
53
|
+
@page = new page params, @page
|