maccman-bowline 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.1
@@ -1,4 +1,6 @@
1
1
  (function($){
2
+ var init = false;
3
+
2
4
  $.bowline = {
3
5
  setup: function(name, el){
4
6
  var rb = eval("bowline_" + name + "_setup");
@@ -18,6 +20,20 @@
18
20
  return rb(el);
19
21
  },
20
22
 
23
+ helper: function(){
24
+ return(
25
+ bowline_helper.apply(
26
+ bowline_helper,
27
+ arguments
28
+ )
29
+ );
30
+ },
31
+
32
+ ready: function(func){
33
+ if(init) return func();
34
+ $(document).bind('loaded.bowline', func);
35
+ },
36
+
21
37
  setupForms: function(){
22
38
  // $('form').bind('submit', function(e){
23
39
  // var src = $(this).attr('src').split('.');
@@ -30,32 +46,33 @@
30
46
 
31
47
  // A lot of JS libs require hashes
32
48
  // without any functions in them
33
- rubyHash: function( hsh ) {
49
+ _rubyHash: function( hsh ) {
34
50
  res = {};
35
- $.each(hsh, function(key, value){
51
+ var key;
52
+ for(key in hsh){
53
+ var value = hsh[key];
36
54
  if(typeof(value) != 'function'){
37
55
  res[key] = value;
38
- }
39
- });
56
+ }
57
+ }
40
58
  return res;
41
59
  }
42
60
  },
43
61
 
44
- $.helper = function(){
45
- return(
46
- bowline_helper.apply(
47
- bowline_helper,
48
- arguments
49
- )
50
- );
51
- };
62
+ window.bowline_loaded = function(){
63
+ init = true;
64
+ $(document.body).trigger('loaded.bowline');
65
+ }
52
66
 
53
67
  $.fn.bowline = function(name, options){
54
- $(this).chain(options);
55
- $.bowline.setup(name, $(this));
56
- $(this).data('bowline', name);
57
- $(this).trigger('setup.bowline');
58
- return this;
68
+ var self = $(this);
69
+ $.bowline.ready(function(){
70
+ self.chain(options);
71
+ $.bowline.setup(name, self);
72
+ self.data('bowline', name);
73
+ self.trigger('setup.bowline');
74
+ });
75
+ return self;
59
76
  };
60
77
 
61
78
  $.fn.invoke = function(){
@@ -77,14 +94,14 @@
77
94
 
78
95
  $.fn.updateCollection = function( items ){
79
96
  items = $.map(items, function(n){
80
- return $.bowline.rubyHash(n);
97
+ return $.bowline._rubyHash(n);
81
98
  });
82
99
  $(this).items('replace', items);
83
100
  $(this).trigger('update.bowline');
84
101
  };
85
102
 
86
103
  $.fn.updateSingleton = function( item ){
87
- item = $.bowline.rubyHash(item);
104
+ item = $.bowline._rubyHash(item);
88
105
  $(this).item('replace', item);
89
106
  $(this).trigger('update.bowline');
90
107
  };
@@ -95,6 +112,5 @@
95
112
  script.attr('type', 'text/ruby');
96
113
  script.attr('src', '../script/init');
97
114
  $('head').append(script);
98
- $(document.body).trigger('loaded.bowline');
99
115
  })
100
116
  })(jQuery)
data/bowline.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{bowline}
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alex MacCaw"]
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  "MIT-LICENSE",
21
21
  "README.txt",
22
22
  "Rakefile",
23
+ "VERSION",
23
24
  "assets/jquery.bowline.js",
24
25
  "assets/jquery.chain.js",
25
26
  "assets/jquery.js",
@@ -2,7 +2,7 @@ module Bowline
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maccman-bowline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
@@ -46,6 +46,7 @@ files:
46
46
  - MIT-LICENSE
47
47
  - README.txt
48
48
  - Rakefile
49
+ - VERSION
49
50
  - assets/jquery.bowline.js
50
51
  - assets/jquery.chain.js
51
52
  - assets/jquery.js