youthtree-js 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/coffeescripts/youth_tree.coffee +1 -3
- data/coffeescripts/youth_tree/gallery.coffee +12 -12
- data/javascripts/youth_tree.js +0 -1
- data/javascripts/youth_tree/gallery.js +9 -9
- data/lib/youthtree-js.rb +1 -1
- data/youthtree-js.gemspec +2 -2
- metadata +5 -5
data/Rakefile
CHANGED
@@ -23,7 +23,7 @@ desc "Compiles the javascript from Coffeescript to Javascript"
|
|
23
23
|
task :compile_scripts do
|
24
24
|
Dir["coffeescripts/**/*.coffee"].each do |cs|
|
25
25
|
output = File.dirname(cs).gsub("coffeescripts", "javascripts")
|
26
|
-
system "coffee", "-
|
26
|
+
system "coffee", "--no-wrap", "-o", output, "-c", cs
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -3,35 +3,35 @@ YouthTree.withNS 'Gallery', (ns) ->
|
|
3
3
|
class InnerGallery
|
4
4
|
|
5
5
|
constructor: (selector) ->
|
6
|
-
@selector
|
7
|
-
@items
|
8
|
-
@urls
|
6
|
+
@selector = selector
|
7
|
+
@items = $ @selector
|
8
|
+
@urls = @items.map(-> @href).toArray()
|
9
9
|
@bindEvents()
|
10
10
|
|
11
11
|
bindEvents: ->
|
12
|
-
self
|
12
|
+
self = @
|
13
13
|
@items.click (e) ->
|
14
14
|
e.preventDefault()
|
15
15
|
self.showFor @
|
16
16
|
false
|
17
17
|
|
18
18
|
showFor: (element) ->
|
19
|
-
href
|
20
|
-
index
|
19
|
+
href = element.href
|
20
|
+
index = @urls.indexOf href
|
21
21
|
if index >= 0
|
22
22
|
@showImages @urls.slice(index).concat(@urls.slice(0, index))
|
23
23
|
|
24
24
|
showImages: (images) ->
|
25
|
-
$.facybox
|
25
|
+
$.facybox images: images
|
26
26
|
|
27
|
-
ns.galleries
|
27
|
+
ns.galleries = {}
|
28
28
|
|
29
|
-
ns.create
|
30
|
-
gallery
|
31
|
-
ns.galleries[name]
|
29
|
+
ns.create = (name, selector) ->
|
30
|
+
gallery = new InnerGallery selector
|
31
|
+
ns.galleries[name] = gallery
|
32
32
|
gallery
|
33
33
|
|
34
|
-
ns.get
|
34
|
+
ns.get = (name) ->
|
35
35
|
ns.galleries[name]
|
36
36
|
|
37
37
|
|
data/javascripts/youth_tree.js
CHANGED
@@ -6,11 +6,15 @@ YouthTree.withNS('Gallery', function(ns) {
|
|
6
6
|
this.urls = this.items.map(function() {
|
7
7
|
return this.href;
|
8
8
|
}).toArray();
|
9
|
+
this.bindEvents();
|
9
10
|
return this;
|
10
11
|
};
|
11
12
|
InnerGallery.prototype.bindEvents = function() {
|
12
|
-
|
13
|
-
|
13
|
+
var self;
|
14
|
+
self = this;
|
15
|
+
return this.items.click(function(e) {
|
16
|
+
e.preventDefault();
|
17
|
+
self.showFor(this);
|
14
18
|
return false;
|
15
19
|
});
|
16
20
|
};
|
@@ -18,16 +22,13 @@ YouthTree.withNS('Gallery', function(ns) {
|
|
18
22
|
var href, index;
|
19
23
|
href = element.href;
|
20
24
|
index = this.urls.indexOf(href);
|
21
|
-
|
22
|
-
return showImages(this.urls.slice(index).concat(this.urls.slice(0, index)));
|
23
|
-
}
|
25
|
+
return index >= 0 ? this.showImages(this.urls.slice(index).concat(this.urls.slice(0, index))) : null;
|
24
26
|
};
|
25
27
|
InnerGallery.prototype.showImages = function(images) {
|
26
28
|
return $.facybox({
|
27
29
|
images: images
|
28
30
|
});
|
29
31
|
};
|
30
|
-
|
31
32
|
ns.galleries = {};
|
32
33
|
ns.create = function(name, selector) {
|
33
34
|
var gallery;
|
@@ -35,8 +36,7 @@ YouthTree.withNS('Gallery', function(ns) {
|
|
35
36
|
ns.galleries[name] = gallery;
|
36
37
|
return gallery;
|
37
38
|
};
|
38
|
-
ns.get = function(name) {
|
39
|
+
return (ns.get = function(name) {
|
39
40
|
return ns.galleries[name];
|
40
|
-
};
|
41
|
-
return ns.get;
|
41
|
+
});
|
42
42
|
});
|
data/lib/youthtree-js.rb
CHANGED
data/youthtree-js.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{youthtree-js}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Darcy Laycock"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-21}
|
13
13
|
s.description = %q{Shared Javascript tools across YouthTree apps.}
|
14
14
|
s.email = %q{sutto@sutto.net}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youthtree-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Darcy Laycock
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-21 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|