joosy 1.0.0.RC1 → 1.0.0.RC2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -4
- data/README.md +8 -68
- data/app/assets/javascripts/joosy/core/application.js.coffee +1 -0
- data/app/assets/javascripts/joosy/core/form.js.coffee +38 -13
- data/app/assets/javascripts/joosy/core/helpers/form.js.coffee +4 -1
- data/app/assets/javascripts/joosy/core/joosy.js.coffee +0 -5
- data/app/assets/javascripts/joosy/core/modules/log.js.coffee +2 -2
- data/app/assets/javascripts/joosy/core/page.js.coffee +3 -1
- data/app/assets/javascripts/joosy/core/resource/collection.js.coffee +5 -5
- data/app/assets/javascripts/joosy/core/resource/generic.js.coffee +4 -0
- data/lib/joosy/rails/version.rb +1 -1
- data/lib/joosy.rb +7 -0
- data/lib/rails/generators/joosy/application_generator.rb +1 -1
- data/lib/rails/generators/joosy/templates/app/helpers/application.js.coffee +1 -1
- data/lib/rails/generators/joosy/templates/app.js.coffee +1 -1
- data/lib/rails/generators/joosy/templates/{app_resources_predefiner.js.coffee.erb → app_railties.js.coffee.erb} +3 -3
- data/spec/javascripts/joosy/core/form_spec.js.coffee +32 -0
- data/spec/javascripts/joosy/core/helpers/forms_spec.js.coffee +3 -3
- data/spec/javascripts/joosy/core/joosy_spec.js.coffee +1 -1
- data/spec/javascripts/joosy/core/modules/log_spec.js.coffee +2 -2
- data/spec/javascripts/joosy/core/modules/module_spec.js.coffee +1 -1
- data/spec/javascripts/joosy/core/page_spec.js.coffee +1 -1
- data/spec/javascripts/joosy/core/resource/rest_collection_spec.js.coffee +9 -1
- metadata +21 -21
data/Gemfile.lock
CHANGED
@@ -19,7 +19,7 @@ GIT
|
|
19
19
|
PATH
|
20
20
|
remote: .
|
21
21
|
specs:
|
22
|
-
joosy (
|
22
|
+
joosy (1.0.0.RC1)
|
23
23
|
coffee-rails
|
24
24
|
haml_coffee_assets
|
25
25
|
i18n-js
|
@@ -82,7 +82,7 @@ GEM
|
|
82
82
|
guard-coffeescript (0.5.7)
|
83
83
|
coffee-script (>= 2.2.0)
|
84
84
|
guard (>= 0.8.3)
|
85
|
-
haml_coffee_assets (0.
|
85
|
+
haml_coffee_assets (0.9.1)
|
86
86
|
execjs (>= 1.2.9)
|
87
87
|
sprockets (>= 2.0.3)
|
88
88
|
tilt (>= 1.3.3)
|
@@ -95,8 +95,7 @@ GEM
|
|
95
95
|
jquery-rails (2.0.2)
|
96
96
|
railties (>= 3.2.0, < 5.0)
|
97
97
|
thor (~> 0.14)
|
98
|
-
json (1.
|
99
|
-
json (1.6.6-java)
|
98
|
+
json (1.7.3)
|
100
99
|
mail (2.4.4)
|
101
100
|
i18n (>= 0.4.0)
|
102
101
|
mime-types (~> 1.16)
|
data/README.md
CHANGED
@@ -2,78 +2,18 @@
|
|
2
2
|
|
3
3
|
## What is Joosy
|
4
4
|
|
5
|
-
Joosy is a
|
5
|
+
Joosy is a javascript framework. Being a harmonious extensions to Rails it introduces everything you like about this framework right to your browser. Ready conventions set, extensive CoffeeScript, HAML support, Helpers, seamless backend integration, automatic code generation and more.
|
6
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
|
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
8
|
|
9
|
-
|
9
|
+
Besides Rails, Joosy is based on top of [CoffeeScript](http://coffeescript.org/), [jQuery](http://jquery.com/) and [Sugar.js](http://sugarjs.com/) in role of ActiveSupport.
|
10
10
|
|
11
|
-
Finally, Joosy boosts your development drastically.
|
11
|
+
Finally, Joosy boosts your development drastically. Just like the Rails do.
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
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/).
|
13
|
+
* [Joosy basics](http://guides.joosy.ws/guides/basics/getting-started.html): introduction and architecture highlights
|
14
|
+
* [Joosy vs X](http://guides.joosy.ws/guides/basics/joosy-vs-x.html): comparison to Backbone and Ember.js
|
15
|
+
* [Joosy guides](http://guides.joosy.ws/): set of articles that will help you to learn the framework.
|
16
|
+
* [Joosy API](http://api.joosy.ws/): Codo-documented API of Joosy.
|
77
17
|
|
78
18
|
### Hello world app
|
79
19
|
|
@@ -163,16 +163,26 @@ class Joosy.Form extends Joosy.Module
|
|
163
163
|
else
|
164
164
|
data = resource.data
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
input.
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
166
|
+
filler = (data, scope) =>
|
167
|
+
Object.each data, (key, val) =>
|
168
|
+
key = @concatFieldName scope, key
|
169
|
+
input = @fields.filter("[name='#{key}']:not(:file),[name='#{key.underscore()}']:not(:file),[name='#{key.camelize(false)}']:not(:file)")
|
170
|
+
if input.length > 0
|
171
|
+
unless input.is ':checkbox'
|
172
|
+
input.val val
|
173
|
+
else
|
174
|
+
if val
|
175
|
+
input.attr 'checked', 'checked'
|
176
|
+
else
|
177
|
+
input.removeAttr 'checked'
|
178
|
+
if Object.isObject val
|
179
|
+
filler val, key
|
180
|
+
# TODO: decide how to make these cases compatible with Rails
|
181
|
+
# else if val instanceof Joosy.Resource.REST
|
182
|
+
# #filler val.data, key
|
183
|
+
# else if val instanceof Joosy.Resource.RESTCollection
|
184
|
+
|
185
|
+
filler data, resource.__entityName
|
176
186
|
|
177
187
|
@__markMethod(options?.method || 'PUT') if resource.id()
|
178
188
|
|
@@ -300,12 +310,12 @@ class Joosy.Form extends Joosy.Module
|
|
300
310
|
if field.indexOf(".") != -1
|
301
311
|
splited = field.split '.'
|
302
312
|
field = splited.shift()
|
303
|
-
if @__resource
|
313
|
+
if @resourceName || @__resource
|
304
314
|
name = @resourceName || @__resource.__entityName
|
305
315
|
field = name + "[#{field}]"
|
306
316
|
field += "[#{f}]" for f in splited
|
307
317
|
|
308
|
-
else if @__resource
|
318
|
+
else if @resourceName || @__resource
|
309
319
|
name = @resourceName || @__resource.__entityName
|
310
320
|
field = name + "[#{field}]"
|
311
321
|
|
@@ -335,4 +345,19 @@ class Joosy.Form extends Joosy.Module
|
|
335
345
|
else
|
336
346
|
result["#{scope}[#{key}]"] = value
|
337
347
|
|
338
|
-
result
|
348
|
+
result
|
349
|
+
|
350
|
+
concatFieldName: (wrapper, name) ->
|
351
|
+
items = @splitFieldName(wrapper).concat @splitFieldName(name)
|
352
|
+
"#{items[0]}[#{items.slice(1).join('][')}]"
|
353
|
+
|
354
|
+
splitFieldName: (name) ->
|
355
|
+
items = name.split('][')
|
356
|
+
first = items[0].split('[')
|
357
|
+
if first.length == 2
|
358
|
+
if first[0].isBlank()
|
359
|
+
items.splice 0, 1, first[1]
|
360
|
+
else
|
361
|
+
items.splice 0, 1, first[0], first[1]
|
362
|
+
items[items.length - 1] = items[items.length - 1].split(']')[0]
|
363
|
+
items
|
@@ -18,6 +18,9 @@ Joosy.helpers 'Application', ->
|
|
18
18
|
delete options.extendIds
|
19
19
|
@tag 'input', Joosy.Module.merge {type: type, name: d.name, id: d.id}, options
|
20
20
|
|
21
|
+
#
|
22
|
+
# @private
|
23
|
+
#
|
21
24
|
class Form
|
22
25
|
constructor: (@context, @resource, @options) ->
|
23
26
|
label: (method, options={}, content='') -> @context.label(@resource, method, Joosy.Module.merge(extendIds: @options.extendIds, options), content)
|
@@ -58,7 +61,7 @@ Joosy.helpers 'Application', ->
|
|
58
61
|
@radioButton = (resource, method, tagValue, options={}) -> input 'radio', resource, method, Joosy.Module.merge(value: tagValue, options)
|
59
62
|
|
60
63
|
@checkBox = (resource, method, options={}, checkedValue=1, uncheckedValue=0) ->
|
61
|
-
spy =
|
64
|
+
spy = @tag 'input', Joosy.Module.merge(name: description(resource, method).name, value: uncheckedValue, type: 'hidden')
|
62
65
|
box = input 'checkbox', resource, method, Joosy.Module.merge(value: checkedValue, options)
|
63
66
|
|
64
67
|
spy+box
|
@@ -21,7 +21,7 @@ Joosy.Modules.Log =
|
|
21
21
|
# Runs `log` if debug is active
|
22
22
|
#
|
23
23
|
debug: (args...) ->
|
24
|
-
return unless Joosy.debug
|
24
|
+
return unless Joosy.Application.debug
|
25
25
|
@log args...
|
26
26
|
|
27
27
|
#
|
@@ -31,6 +31,6 @@ Joosy.Modules.Log =
|
|
31
31
|
# @param [String] string Message to log
|
32
32
|
#
|
33
33
|
debugAs: (context, string, args...) ->
|
34
|
-
return unless Joosy.debug
|
34
|
+
return unless Joosy.Application.debug
|
35
35
|
context = Joosy.Module.__className(context) || 'unknown context'
|
36
36
|
@debug "#{context}> #{string}", args...
|
@@ -131,7 +131,9 @@ class Joosy.Page extends Joosy.Module
|
|
131
131
|
# $.get '/rumbas', (@data) => complete()
|
132
132
|
#
|
133
133
|
@fetch: (callback) ->
|
134
|
-
@::__fetch =
|
134
|
+
@::__fetch = (complete) ->
|
135
|
+
@data = {}
|
136
|
+
callback.call(this, complete)
|
135
137
|
|
136
138
|
#
|
137
139
|
# Sets the several separate methods that will fetch data in parallel.
|
@@ -39,11 +39,6 @@ class Joosy.Resource.Collection extends Joosy.Module
|
|
39
39
|
#
|
40
40
|
@model: (model) -> @::model = model
|
41
41
|
|
42
|
-
#
|
43
|
-
# Modelized data storage
|
44
|
-
#
|
45
|
-
data: []
|
46
|
-
|
47
42
|
#
|
48
43
|
# If model param was empty it will fallback to `@model`
|
49
44
|
# If both param and `@model` were empty it will throw an exception.
|
@@ -52,6 +47,11 @@ class Joosy.Resource.Collection extends Joosy.Module
|
|
52
47
|
#
|
53
48
|
constructor: (model=false) ->
|
54
49
|
@model = model if model
|
50
|
+
|
51
|
+
#
|
52
|
+
# Modelized data storage
|
53
|
+
#
|
54
|
+
@data = []
|
55
55
|
|
56
56
|
if !@model
|
57
57
|
throw new Error "#{Joosy.Module.__className @}> model can't be empty"
|
@@ -29,6 +29,10 @@ class Joosy.Resource.Generic extends Joosy.Module
|
|
29
29
|
|
30
30
|
__source: false
|
31
31
|
|
32
|
+
#
|
33
|
+
# Clears the identity map cache. Recomended to be called during layout switch to
|
34
|
+
# ensure correct garbage collection.
|
35
|
+
#
|
32
36
|
@resetIdentity: ->
|
33
37
|
Joosy.Resource.Generic.identity = {}
|
34
38
|
|
data/lib/joosy/rails/version.rb
CHANGED
data/lib/joosy.rb
CHANGED
@@ -10,7 +10,7 @@ module Joosy
|
|
10
10
|
|
11
11
|
template "app.js.coffee", "#{file_path}.js.coffee"
|
12
12
|
|
13
|
-
template "
|
13
|
+
template "app_railties.js.coffee.erb", "#{file_path}_railties.js.coffee.erb"
|
14
14
|
|
15
15
|
empty_directory file_path
|
16
16
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
#
|
4
4
|
#= require_tree ./<%= file_name %>/helpers
|
5
5
|
#= require_tree ./<%= file_name %>/templates
|
6
|
+
#= require ./<%= file_name %>_railties
|
6
7
|
#= require_tree ./<%= file_name %>/resources
|
7
|
-
#= require ./<%= file_name %>_resources_predefiner
|
8
8
|
#= require_tree ./<%= file_name %>/widgets
|
9
9
|
#= require_tree ./<%= file_name %>/layouts
|
10
10
|
#= require_tree ./<%= file_name %>/pages
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# Whitelist here modules and sub-modules which resources should be predefined
|
2
|
-
# e.g. ['front', 'front/products'
|
2
|
+
# e.g. [nil, 'front', 'front/products'] if you have
|
3
3
|
# Front::SomeController and Front::Products::AnotherController
|
4
4
|
# with the associated namespaces in your routes
|
5
5
|
# and want to predefine resources with no namespace
|
6
6
|
|
7
|
-
# Joosy.defineResources <%= "<%= Joosy
|
7
|
+
# Joosy.defineResources <%= "<%= Joosy.resources [nil, '" + file_name + "'] %" + ">" %>
|
8
8
|
|
9
9
|
# or predefine all resources
|
10
10
|
|
11
|
-
Joosy.defineResources <%= "<%= Joosy
|
11
|
+
Joosy.defineResources <%= "<%= Joosy.resources %" + ">" %>
|
@@ -6,6 +6,8 @@ describe "Joosy.Form", ->
|
|
6
6
|
@nudeForm = "<form id='nude'><input name='test[foo]'/><input name='test[bar]'/><input name='test[bool]' type='checkbox' value='1'/></form>"
|
7
7
|
@putForm = "<form id='put' method='put'><input name='test[camel_baz]'/></form>"
|
8
8
|
@moreForm = "<form id='more' method='put'><input name='test[ololo]'/></form>"
|
9
|
+
@nestedForm = "<form id='nested'><input name='test[zee][capped][test]'/></form>"
|
10
|
+
@exactForm = "<form id='nested'><input name='test[EXact][MATCH]'/></form>"
|
9
11
|
|
10
12
|
@ground.find('#sidebar').after(@nudeForm).after(@putForm).after(@moreForm)
|
11
13
|
|
@@ -23,6 +25,11 @@ describe "Joosy.Form", ->
|
|
23
25
|
bar: 'bar'
|
24
26
|
camelBaz: 'baz'
|
25
27
|
bool: true
|
28
|
+
zee:
|
29
|
+
capped:
|
30
|
+
test: 'test'
|
31
|
+
EXact:
|
32
|
+
MATCH: 'works'
|
26
33
|
|
27
34
|
afterEach ->
|
28
35
|
@server.restore()
|
@@ -65,6 +72,8 @@ describe "Joosy.Form", ->
|
|
65
72
|
@nudeForm = new Joosy.Form @nudeForm
|
66
73
|
@putForm = new Joosy.Form @putForm
|
67
74
|
@moreForm = new Joosy.Form @moreForm
|
75
|
+
@nestedForm = new Joosy.Form @nestedForm
|
76
|
+
@exactForm = new Joosy.Form @exactForm
|
68
77
|
|
69
78
|
it "should fill form, set proper action and method and store resource", ->
|
70
79
|
@nudeForm.fill @resource
|
@@ -82,6 +91,10 @@ describe "Joosy.Form", ->
|
|
82
91
|
expect(@putForm.container.attr('method').toLowerCase()).toEqual 'post'
|
83
92
|
expect(@putForm.container.attr 'action').toEqual '/tests/1'
|
84
93
|
|
94
|
+
it "should fill form with any properties", ->
|
95
|
+
@exactForm.fill @resource
|
96
|
+
expect(@exactForm.fields[0].value).toEqual 'works'
|
97
|
+
|
85
98
|
it "should fill form with decorator", ->
|
86
99
|
@moreForm.fill @resource,
|
87
100
|
decorator: (e) ->
|
@@ -102,6 +115,25 @@ describe "Joosy.Form", ->
|
|
102
115
|
action: resource.memberPath(from: 'calculate')
|
103
116
|
expect(@nudeForm.container.attr 'action').toEqual '/tests/someId/calculate'
|
104
117
|
|
118
|
+
it "should handle field name properly", ->
|
119
|
+
expect(@nudeForm.concatFieldName 'resource', 'key').toEqual 'resource[key]'
|
120
|
+
expect(@nudeForm.concatFieldName 'resource', 'key[key1]').toEqual 'resource[key][key1]'
|
121
|
+
expect(@nudeForm.concatFieldName 'resource[key]', 'key1').toEqual 'resource[key][key1]'
|
122
|
+
expect(@nudeForm.concatFieldName 'resource[key]', 'key1[key2]').toEqual 'resource[key][key1][key2]'
|
123
|
+
expect(@nudeForm.concatFieldName 'resource[key]', '[key1][key2]').toEqual 'resource[key][key1][key2]'
|
124
|
+
expect(@nudeForm.concatFieldName 'resource', 'key[]').toEqual 'resource[key][]'
|
125
|
+
expect(@nudeForm.concatFieldName 'resource[]', 'key1').toEqual 'resource[][key1]'
|
126
|
+
expect(@nudeForm.concatFieldName 'resource[]', 'key1[]').toEqual 'resource[][key1][]'
|
127
|
+
expect(@nudeForm.concatFieldName 'resource[]', '[][]').toEqual 'resource[][][]'
|
128
|
+
expect(@nudeForm.concatFieldName '[resource]', '[]').toEqual 'resource[]'
|
129
|
+
expect(@nudeForm.concatFieldName '[resource]', '[key]').toEqual 'resource[key]'
|
130
|
+
expect(@nudeForm.concatFieldName '[resource][key]', '[key1][key2]').toEqual 'resource[key][key1][key2]'
|
131
|
+
expect(@nudeForm.concatFieldName '[][]', '[][]').toEqual '[][][]' # oops
|
132
|
+
|
133
|
+
it "should fill nested attributes", ->
|
134
|
+
@nestedForm.fill @resource
|
135
|
+
expect(@nestedForm.fields[0].value).toEqual 'test'
|
136
|
+
|
105
137
|
describe "Callbacks", ->
|
106
138
|
|
107
139
|
beforeEach ->
|
@@ -39,7 +39,7 @@ describe "Joosy.Helpers.Form", ->
|
|
39
39
|
it "renders checkBox", ->
|
40
40
|
tags = h.checkBox('a', 'b', {a: 'b'}).match(/<[^>]+>/g)
|
41
41
|
|
42
|
-
expect(tags[0]).toBeTag 'input', '', value: '0',
|
42
|
+
expect(tags[0]).toBeTag 'input', '', value: '0', name: 'a[b]', type: 'hidden'
|
43
43
|
expect(tags[1]).toBeTag 'input', '', value: '1', id: 'a_b', name: 'a[b]', type: 'checkbox', a: 'b'
|
44
44
|
|
45
45
|
it "renders radioButton", ->
|
@@ -69,7 +69,7 @@ describe "Joosy.Helpers.Form", ->
|
|
69
69
|
it "renders checkBox", ->
|
70
70
|
tags = form.checkBox('b', {a: 'b'}).match(/<[^>]+>/g)
|
71
71
|
|
72
|
-
expect(tags[0]).toBeTag 'input', '', value: '0',
|
72
|
+
expect(tags[0]).toBeTag 'input', '', value: '0', name: 'test[b]', type: 'hidden'
|
73
73
|
expect(tags[1]).toBeTag 'input', '', value: '1', id: 'test_b', name: 'test[b]', type: 'checkbox', a: 'b'
|
74
74
|
|
75
75
|
it "renders radioButton", ->
|
@@ -93,7 +93,7 @@ describe "Joosy.Helpers.Form", ->
|
|
93
93
|
it "renders checkBox", ->
|
94
94
|
tags = form.checkBox('b', {a: 'b'}).match(/<[^>]+>/g)
|
95
95
|
|
96
|
-
expect(tags[0]).toBeTag 'input', '', value: '0',
|
96
|
+
expect(tags[0]).toBeTag 'input', '', value: '0', name: 'test[b]', type: 'hidden'
|
97
97
|
expect(tags[1]).toBeTag 'input', '', value: '1', id: 'test_1_b', name: 'test[b]', type: 'checkbox', a: 'b'
|
98
98
|
|
99
99
|
it "renders radioButton", ->
|
@@ -9,7 +9,7 @@ describe "Joosy.Modules.Log", ->
|
|
9
9
|
@box.log 'message', 'appendix'
|
10
10
|
|
11
11
|
it "should log debug messages into console", ->
|
12
|
-
Joosy.debug = true
|
12
|
+
Joosy.Application.debug = true
|
13
13
|
@box.debug 'debug message'
|
14
|
-
Joosy.debug = false
|
14
|
+
Joosy.Application.debug = false
|
15
15
|
@box.debug 'unseen debug message'
|
@@ -43,5 +43,5 @@ describe "Joosy.Module", ->
|
|
43
43
|
expect(TestModule[callback].getCall(0).calledOn(Klass)).toBeTruthy()
|
44
44
|
|
45
45
|
it "should have minimal set of properties", ->
|
46
|
-
expect(Object.extended(Joosy.Module).keys()).toEqual ['__namespace__', '__className', 'hasAncestor', 'merge', 'include', 'extend']
|
46
|
+
expect(Object.extended(Joosy.Module).keys()).toEqual ['__namespace__', '__className', 'hasAncestor', 'alias', 'aliasStatic', 'merge', 'include', 'extend']
|
47
47
|
expect(Object.extended(Joosy.Module.prototype).keys()).toEqual []
|
@@ -17,7 +17,7 @@ describe "Joosy.Page", ->
|
|
17
17
|
|
18
18
|
|
19
19
|
it "should have appropriate accessors", ->
|
20
|
-
callback_names = ['
|
20
|
+
callback_names = ['beforePaint', 'paint', 'afterPaint', 'erase']
|
21
21
|
callback_names.each (func) =>
|
22
22
|
@TestPage[func] 'callback'
|
23
23
|
expect(@TestPage::['__' + func]).toEqual 'callback'
|
@@ -28,4 +28,12 @@ describe "Joosy.Resource.RESTCollection", ->
|
|
28
28
|
|
29
29
|
expect(@collection.data.length).toEqual 3
|
30
30
|
expect(@collection.data[0].constructor == Test).toBeTruthy()
|
31
|
-
expect(@collection.data[0].data.name).toEqual 'test3'
|
31
|
+
expect(@collection.data[0].data.name).toEqual 'test3'
|
32
|
+
|
33
|
+
it "should use own storage", ->
|
34
|
+
class TestsCollection extends Joosy.Resource.RESTCollection
|
35
|
+
@model Test
|
36
|
+
collection = new TestsCollection()
|
37
|
+
collection.add 'test'
|
38
|
+
expect(collection.data).toEqual ['test']
|
39
|
+
expect(collection.hasOwnProperty 'data').toBeTruthy()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joosy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.RC2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,11 +12,11 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-05-
|
15
|
+
date: 2012-05-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
19
|
-
requirement: &
|
19
|
+
requirement: &70270595054760 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 3.1.0
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70270595054760
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: coffee-rails
|
30
|
-
requirement: &
|
30
|
+
requirement: &70270595054340 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70270595054340
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: jquery-rails
|
41
|
-
requirement: &
|
41
|
+
requirement: &70270595053880 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ! '>='
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: '0'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *70270595053880
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: haml_coffee_assets
|
52
|
-
requirement: &
|
52
|
+
requirement: &70270595053460 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ! '>='
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: '0'
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *70270595053460
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: i18n-js
|
63
|
-
requirement: &
|
63
|
+
requirement: &70270595053040 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
@@ -68,10 +68,10 @@ dependencies:
|
|
68
68
|
version: '0'
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *70270595053040
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: guard
|
74
|
-
requirement: &
|
74
|
+
requirement: &70270595052620 !ruby/object:Gem::Requirement
|
75
75
|
none: false
|
76
76
|
requirements:
|
77
77
|
- - ! '>='
|
@@ -79,10 +79,10 @@ dependencies:
|
|
79
79
|
version: '0'
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
|
-
version_requirements: *
|
82
|
+
version_requirements: *70270595052620
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: guard-coffeescript
|
85
|
-
requirement: &
|
85
|
+
requirement: &70270595052200 !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
87
|
requirements:
|
88
88
|
- - ! '>='
|
@@ -90,10 +90,10 @@ dependencies:
|
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
|
-
version_requirements: *
|
93
|
+
version_requirements: *70270595052200
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: guard-sprockets
|
96
|
-
requirement: &
|
96
|
+
requirement: &70270595051780 !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - ! '>='
|
@@ -101,10 +101,10 @@ dependencies:
|
|
101
101
|
version: '0'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
|
-
version_requirements: *
|
104
|
+
version_requirements: *70270595051780
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: jasmine
|
107
|
-
requirement: &
|
107
|
+
requirement: &70270595051360 !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
109
109
|
requirements:
|
110
110
|
- - ! '>='
|
@@ -112,7 +112,7 @@ dependencies:
|
|
112
112
|
version: '0'
|
113
113
|
type: :development
|
114
114
|
prerelease: false
|
115
|
-
version_requirements: *
|
115
|
+
version_requirements: *70270595051360
|
116
116
|
description: A gem wrapper to include Joosy via the asset pipeline.
|
117
117
|
email: boris@roundlake.ru
|
118
118
|
executables: []
|
@@ -181,7 +181,7 @@ files:
|
|
181
181
|
- lib/rails/generators/joosy/templates/app/widgets/template.js.coffee
|
182
182
|
- lib/rails/generators/joosy/templates/app_controller.rb
|
183
183
|
- lib/rails/generators/joosy/templates/app_preloader.js.coffee.erb
|
184
|
-
- lib/rails/generators/joosy/templates/
|
184
|
+
- lib/rails/generators/joosy/templates/app_railties.js.coffee.erb
|
185
185
|
- lib/rails/generators/joosy/templates/preload.html.erb
|
186
186
|
- lib/rails/generators/joosy/templates/preload.html.haml
|
187
187
|
- lib/rails/generators/joosy/widget_generator.rb
|