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 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", "-c", "--no-wrap", cs, "-o", output
26
+ system "coffee", "--no-wrap", "-o", output, "-c", cs
27
27
  end
28
28
  end
29
29
 
@@ -1,4 +1,2 @@
1
1
  Shuriken.as 'YouthTree'
2
-
3
- # Export it in the global scope.
4
- @YT: YouthTree
2
+ @YT = YouthTree
@@ -3,35 +3,35 @@ YouthTree.withNS 'Gallery', (ns) ->
3
3
  class InnerGallery
4
4
 
5
5
  constructor: (selector) ->
6
- @selector: selector
7
- @items: $ @selector
8
- @urls: @items.map(-> @href).toArray()
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: element.href
20
- index: @urls.indexOf href
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 {images: images}
25
+ $.facybox images: images
26
26
 
27
- ns.galleries: {}
27
+ ns.galleries = {}
28
28
 
29
- ns.create: (name, selector) ->
30
- gallery: new InnerGallery selector
31
- ns.galleries[name]: gallery
29
+ ns.create = (name, selector) ->
30
+ gallery = new InnerGallery selector
31
+ ns.galleries[name] = gallery
32
32
  gallery
33
33
 
34
- ns.get: (name) ->
34
+ ns.get = (name) ->
35
35
  ns.galleries[name]
36
36
 
37
37
 
@@ -1,3 +1,2 @@
1
1
  Shuriken.as('YouthTree');
2
- // Export it in the global scope.
3
2
  this.YT = YouthTree;
@@ -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
- return this.items.click(function() {
13
- showFor(this);
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
- if (index >= 0) {
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
@@ -1,5 +1,5 @@
1
1
  class YouthTreeJS
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.2.0".freeze
3
3
 
4
4
  def self.register_framework!
5
5
  Barista::Framework.register 'youthtree', File.expand_path('../coffeescripts', File.dirname(__FILE__))
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.1.1"
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-06-12}
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
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-06-12 00:00:00 +08:00
18
+ date: 2010-08-21 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21