wiselinks 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +30 -0
- data/VERSION +1 -1
- data/lib/assets/javascripts/wiselinks.js.coffee +7 -5
- data/wiselinks.gemspec +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -24,6 +24,36 @@ Then modify your `application.js` or `application.js.coffee` file to use Wiselin
|
|
24
24
|
$(document).ready ->
|
25
25
|
window.wiselinks = new Wiselinks()
|
26
26
|
|
27
|
+
Or more complex:
|
28
|
+
|
29
|
+
#= require jquery
|
30
|
+
#= require jquery.role
|
31
|
+
#= require wiselinks
|
32
|
+
|
33
|
+
$(document).ready ->
|
34
|
+
window.wiselinks = new Wiselinks($('@content'))
|
35
|
+
|
36
|
+
$(document).off('page:loading').on(
|
37
|
+
'page:loading'
|
38
|
+
(event, url, target, render) ->
|
39
|
+
console.log("Wiselinks loading: #{url} to #{target} within '#{render}'")
|
40
|
+
# start loading animation
|
41
|
+
)
|
42
|
+
|
43
|
+
$(document).off('page:success').on(
|
44
|
+
'page:success'
|
45
|
+
(event, data, status) ->
|
46
|
+
console.log("Wiselinks status: '#{status}'")
|
47
|
+
# stop loading animation
|
48
|
+
)
|
49
|
+
|
50
|
+
$(document).off('page:error').on(
|
51
|
+
'page:error'
|
52
|
+
(event, data, status) ->
|
53
|
+
console.log("Wiselinks status: '#{status}'")
|
54
|
+
# stop loading animation and show error message
|
55
|
+
)
|
56
|
+
|
27
57
|
##Events
|
28
58
|
|
29
59
|
While using Wiselinks you **can rely** on `DOMContentLoaded` or `jQuery.ready()` to trigger your JavaScript code, but Wiselinks gives you some additional useful event to deal with the lifecycle of the page:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -53,7 +53,10 @@ class Wiselinks
|
|
53
53
|
|
54
54
|
_call: (url, target, render = 'template') ->
|
55
55
|
self = this
|
56
|
-
|
56
|
+
|
57
|
+
$target = if target? then $(target) else self.$target
|
58
|
+
|
59
|
+
$(document).trigger('page:loading', [url, $target.selector, render])
|
57
60
|
|
58
61
|
$.ajax(
|
59
62
|
url: url
|
@@ -61,13 +64,12 @@ class Wiselinks
|
|
61
64
|
'X-Render': render
|
62
65
|
success: (data, status, xhr) ->
|
63
66
|
document.title = xhr.getResponseHeader('X-Title')
|
64
|
-
|
65
|
-
$target = if target? then $(target) else self.$target
|
67
|
+
|
66
68
|
$target.html(data)
|
67
69
|
|
68
|
-
$(document).trigger('page:success', data, status)
|
70
|
+
$(document).trigger('page:success', [data, status])
|
69
71
|
error: (xhr, status, error)->
|
70
|
-
$(document).trigger('page:error', status, error)
|
72
|
+
$(document).trigger('page:error', [status, error])
|
71
73
|
dataType: "html"
|
72
74
|
)
|
73
75
|
|
data/wiselinks.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "wiselinks"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Igor Alexandrov", "Alexey Solilin", "Julia Egorova"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-20"
|
13
13
|
s.email = "igor.alexandrov@gmail.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wiselinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-12-
|
14
|
+
date: 2012-12-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: shoulda
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: 1629275520541992617
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
none: false
|
121
121
|
requirements:
|