coffee-cup 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -1
- data/app/assets/javascripts/coffee_cup/views/base.coffee +4 -1
- metadata +7 -6
data/README.md
CHANGED
@@ -116,8 +116,25 @@ the following :
|
|
116
116
|
constructor: -> # This code will be shared between the New and Edit actions.
|
117
117
|
```
|
118
118
|
|
119
|
+
### Loading a partial
|
120
|
+
|
121
|
+
You can use the method ```loadPartial``` to make an AJAX call to the server requesting html content.
|
122
|
+
|
123
|
+
```coffeescript
|
124
|
+
# app/assets/javascripts/app/views/users/index.coffee
|
125
|
+
@view "Users.Index",
|
126
|
+
loadUserProfile: -> @loadPartial 'http://app.dev/users/show', 'myCallbackMethod', '#id-of-the-root-element'
|
127
|
+
|
128
|
+
myCallbackMethod: (data) -> $('body').append(data)
|
129
|
+
```
|
130
|
+
|
131
|
+
This method will call the url by adding the parameter ```layout=none```. After receiving the response, it will call
|
132
|
+
the callback method in the current context.
|
133
|
+
|
134
|
+
The last parameter is optional and will be used to restrict the received html content with a jQuery ```find```.
|
135
|
+
|
119
136
|
|
120
137
|
Copyright
|
121
138
|
---------
|
122
139
|
|
123
|
-
Copyright (c)
|
140
|
+
Copyright (c) 2013 De Marque inc. See LICENSE for further details.
|
@@ -20,7 +20,10 @@ class @ActionView
|
|
20
20
|
|
21
21
|
|
22
22
|
receivePartial: (data, caller, callback, rootTag) ->
|
23
|
-
|
23
|
+
if rootTag isnt ''
|
24
|
+
partial = $('<div>' + data + '</div>').find(rootTag).html()
|
25
|
+
else
|
26
|
+
partial = data
|
24
27
|
|
25
28
|
caller[callback](partial)
|
26
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffee-cup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
requirement: &
|
15
|
+
requirement: &2163118740 !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
@@ -21,9 +21,9 @@ dependencies:
|
|
21
21
|
prerelease: false
|
22
22
|
type: :development
|
23
23
|
name: rake
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2163118740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
requirement: &
|
26
|
+
requirement: &2163118240 !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - ! '>='
|
29
29
|
- !ruby/object:Gem::Version
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
prerelease: false
|
33
33
|
type: :development
|
34
34
|
name: rspec
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2163118240
|
36
36
|
description: Coffee Cup set the foundations of a Rails like structure for your all
|
37
37
|
your CoffeeScript code.
|
38
38
|
email:
|
@@ -83,3 +83,4 @@ specification_version: 3
|
|
83
83
|
summary: Coffee Cup set the foundations of a Rails like structure for your all your
|
84
84
|
CoffeeScript code.
|
85
85
|
test_files: []
|
86
|
+
has_rdoc:
|