formalize-rails 0.0.2 → 0.0.3

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/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .rvmrc
data/README.md CHANGED
@@ -14,11 +14,11 @@ And add `app/assets/stylesheets/application.css`:
14
14
  And add one of these lines to `app/assets/javascripts/application.js`, depending on which javascript
15
15
  framework you are using:
16
16
 
17
- //= dojo.formalize
18
- //= extjs.formalize
19
- //= jquery.formalize
20
- //= mootools.formalize
21
- //= prototype.formalize
22
- //= yui.formalize
17
+ //= require dojo.formalize
18
+ //= require extjs.formalize
19
+ //= require jquery.formalize
20
+ //= require mootools.formalize
21
+ //= require prototype.formalize
22
+ //= require yui.formalize
23
23
 
24
24
  See [formalize.me](http://formalize.me) for more information.
data/Rakefile CHANGED
@@ -1 +1,54 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ desc "Get the newest version of formalize from github"
4
+ task :update do
5
+ require 'open-uri'
6
+
7
+ base_url = "https://raw.github.com/nathansmith/formalize/master/assets"
8
+ target = "vendor/assets"
9
+
10
+ js = %w(dojo.formalize.js dojo.formalize.min.js extjs.formalize.js extjs.formalize.min.js jquery.formalize.js jquery.formalize.min.js mootools.formalize.js mootools.formalize.min.js prototype.formalize.js prototype.formalize.min.js yui.formalize.js yui.formalize.min.js)
11
+ css = %w(formalize.css)
12
+ images = %w(button.png select_arrow.gif)
13
+
14
+ js.each do |file|
15
+ url = File.join(base_url, "js", file)
16
+ path = File.join(target, "javascripts", file)
17
+ File.open(path, 'w') do |t|
18
+ open url do |f|
19
+ f.each_line do |line|
20
+ t << line
21
+ end
22
+ end
23
+ end
24
+ puts "Saved #{path}"
25
+ end
26
+
27
+ images.each do |file|
28
+ url = File.join(base_url, "images", file)
29
+ path = File.join(target, "images/formalize", file)
30
+ File.open(path, 'wb') do |t|
31
+ open url do |f|
32
+ t << f.read
33
+ end
34
+ end
35
+ puts "Saved #{path}"
36
+ end
37
+
38
+
39
+ css.each do |file|
40
+ url = File.join(base_url, "css", file)
41
+ path = File.join(target, "stylesheets", file)
42
+ File.open(path, 'w') do |t|
43
+ open url do |f|
44
+ f.each_line do |line|
45
+ t << line.gsub(%r|url\(.+/([^/]+)\)|, "url(/assets/formalize/\\1)")
46
+ end
47
+ end
48
+ end
49
+ puts "Saved #{path}"
50
+ end
51
+
52
+ puts "Done"
53
+
54
+ end
@@ -1,5 +1,5 @@
1
1
  module Formalize
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -4,26 +4,24 @@
4
4
  Note: This file depends on the YUI library.
5
5
  */
6
6
 
7
- // Module pattern:
8
- // http://yuiblog.com/blog/2007/06/12/module-pattern
9
- var FORMALIZE = (function(window, document, undefined) {
7
+ YUI.add('formalize', function(Y) {
10
8
  // Private constants.
11
9
  var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
10
  var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
11
  var IE6 = parseInt(Y.UA.ie, 10) === 6;
14
12
  var IE7 = parseInt(Y.UA.ie, 10) === 7;
15
13
 
16
- // Expose innards of FORMALIZE.
17
- return {
18
- // FORMALIZE.go
14
+ // Expose innards of Formalize.
15
+ Y.formalize = {
16
+ // Y.formalize.go
19
17
  go: function() {
20
- for (var i in FORMALIZE.init) {
21
- FORMALIZE.init[i]();
18
+ for (var i in Y.formalize.init) {
19
+ Y.formalize.init[i]();
22
20
  }
23
21
  },
24
- // FORMALIZE.init
22
+ // Y.formalize.init
25
23
  init: {
26
- // FORMALIZE.init.full_input_size
24
+ // Y.formalize.init.full_input_size
27
25
  full_input_size: function() {
28
26
  if (!IE7 || !Y.all('textarea, input.input_full')) {
29
27
  return;
@@ -36,7 +34,7 @@ var FORMALIZE = (function(window, document, undefined) {
36
34
  wrapper.append(el.replace(wrapper));
37
35
  });
38
36
  },
39
- // FORMALIZE.init.ie6_skin_inputs
37
+ // Y.formalize.init.ie6_skin_inputs
40
38
  ie6_skin_inputs: function() {
41
39
  // Test for Internet Explorer 6.
42
40
  if (!IE6 || !Y.all('input, select, textarea')) {
@@ -79,7 +77,7 @@ var FORMALIZE = (function(window, document, undefined) {
79
77
  }
80
78
  });
81
79
  },
82
- // FORMALIZE.init.autofocus
80
+ // Y.formalize.init.autofocus
83
81
  autofocus: function() {
84
82
  if (AUTOFOCUS_SUPPORTED || !Y.one('[autofocus]')) {
85
83
  return;
@@ -87,7 +85,7 @@ var FORMALIZE = (function(window, document, undefined) {
87
85
 
88
86
  Y.one('[autofocus]').focus();
89
87
  },
90
- // FORMALIZE.init.placeholder
88
+ // Y.formalize.init.placeholder
91
89
  placeholder: function() {
92
90
  if (PLACEHOLDER_SUPPORTED || !Y.one('[placeholder]')) {
93
91
  // Exit if placeholder is supported natively,
@@ -95,7 +93,7 @@ var FORMALIZE = (function(window, document, undefined) {
95
93
  return;
96
94
  }
97
95
 
98
- FORMALIZE.misc.add_placeholder();
96
+ Y.formalize.misc.add_placeholder();
99
97
 
100
98
  Y.all('[placeholder]').each(function(el) {
101
99
  var text = el.getAttribute('placeholder');
@@ -114,7 +112,7 @@ var FORMALIZE = (function(window, document, undefined) {
114
112
  });
115
113
 
116
114
  el.on('blur', function() {
117
- FORMALIZE.misc.add_placeholder();
115
+ Y.formalize.misc.add_placeholder();
118
116
  });
119
117
 
120
118
  // Prevent <form> from accidentally
@@ -126,14 +124,14 @@ var FORMALIZE = (function(window, document, undefined) {
126
124
  });
127
125
 
128
126
  form.on('reset', function() {
129
- setTimeout(FORMALIZE.misc.add_placeholder, 50);
127
+ setTimeout(Y.formalize.misc.add_placeholder, 50);
130
128
  });
131
129
  });
132
130
  }
133
131
  },
134
- // FORMALIZE.misc
132
+ // Y.formalize.misc
135
133
  misc: {
136
- // FORMALIZE.misc.add_placeholder
134
+ // Y.formalize.misc.add_placeholder
137
135
  add_placeholder: function() {
138
136
  if (PLACEHOLDER_SUPPORTED || !Y.one('[placeholder]')) {
139
137
  // Exit if placeholder is supported natively,
@@ -151,10 +149,4 @@ var FORMALIZE = (function(window, document, undefined) {
151
149
  }
152
150
  }
153
151
  };
154
- // Alias window, document.
155
- })(this, this.document);
156
-
157
- // Automatically calls all functions in FORMALIZE.init
158
- Y.on('domready', function() {
159
- FORMALIZE.go();
160
- });
152
+ }, '1.1', {requires: ['node', 'event']});
@@ -1 +1 @@
1
- var FORMALIZE=function(a,b,c){var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=parseInt(Y.UA.ie,10)===6,g=parseInt(Y.UA.ie,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){!!g&&!!Y.all("textarea, input.input_full")&&Y.all("textarea, input.input_full").each(function(a){var b=Y.Node.create('<span class="input_full_wrap"></span>');b.append(a.replace(b))})},ie6_skin_inputs:function(){if(!!f&&!!Y.all("input, select, textarea")){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Y.all("input").each(function(c){c.getAttribute("type").match(a)?(c.addClass("ie6_button"),c.disabled&&c.addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(c.addClass("ie6_input"),c.disabled&&c.addClass("ie6_input_disabled"))}),Y.all("textarea, select").each(function(a){a.disabled&&a.addClass("ie6_input_disabled")})}},autofocus:function(){!e&&!!Y.one("[autofocus]")&&Y.one("[autofocus]").focus()},placeholder:function(){!d&&!!Y.one("[placeholder]")&&(FORMALIZE.misc.add_placeholder(),Y.all("[placeholder]").each(function(a){function d(){(!a.get("value")||a.get("value")===b)&&a.set("value",b).addClass("placeholder_text")}var b=a.getAttribute("placeholder"),c=a.ancestor("form");a.on("focus",function(){a.get("value")===b&&a.set("value","").removeClass("placeholder_text")}),a.on("blur",function(){FORMALIZE.misc.add_placeholder()}),c.on("submit",function(){a.get("value")===b&&a.set("value","").removeClass("placeholder_text")}),c.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!d&&!!Y.one("[placeholder]")&&Y.all("[placeholder]").each(function(a){var b=a.getAttribute("placeholder");(!a.get("value")||a.get("value")===b)&&a.set("value",b).addClass("placeholder_text")})}}}}(this,this.document);Y.on("domready",function(){FORMALIZE.go()})
1
+ YUI.add("formalize",function(a){var b="placeholder"in document.createElement("input"),c="autofocus"in document.createElement("input"),d=parseInt(a.UA.ie,10)===6,e=parseInt(a.UA.ie,10)===7;a.formalize={go:function(){for(var b in a.formalize.init)a.formalize.init[b]()},init:{full_input_size:function(){!!e&&!!a.all("textarea, input.input_full")&&a.all("textarea, input.input_full").each(function(b){var c=a.Node.create('<span class="input_full_wrap"></span>');c.append(b.replace(c))})},ie6_skin_inputs:function(){if(!!d&&!!a.all("input, select, textarea")){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a.all("input").each(function(a){a.getAttribute("type").match(b)?(a.addClass("ie6_button"),a.disabled&&a.addClass("ie6_button_disabled")):a.getAttribute("type").match(c)&&(a.addClass("ie6_input"),a.disabled&&a.addClass("ie6_input_disabled"))}),a.all("textarea, select").each(function(a){a.disabled&&a.addClass("ie6_input_disabled")})}},autofocus:function(){!c&&!!a.one("[autofocus]")&&a.one("[autofocus]").focus()},placeholder:function(){!b&&!!a.one("[placeholder]")&&(a.formalize.misc.add_placeholder(),a.all("[placeholder]").each(function(b){function e(){(!b.get("value")||b.get("value")===c)&&b.set("value",c).addClass("placeholder_text")}var c=b.getAttribute("placeholder"),d=b.ancestor("form");b.on("focus",function(){b.get("value")===c&&b.set("value","").removeClass("placeholder_text")}),b.on("blur",function(){a.formalize.misc.add_placeholder()}),d.on("submit",function(){b.get("value")===c&&b.set("value","").removeClass("placeholder_text")}),d.on("reset",function(){setTimeout(a.formalize.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!b&&!!a.one("[placeholder]")&&a.all("[placeholder]").each(function(a){var b=a.getAttribute("placeholder");(!a.get("value")||a.get("value")===b)&&a.set("value",b).addClass("placeholder_text")})}}}},"1.1",{requires:["node","event"]})
@@ -58,6 +58,44 @@ textarea {
58
58
  vertical-align: middle;
59
59
  }
60
60
 
61
+ input[type="radio"],
62
+ input[type="checkbox"] {
63
+ position: relative;
64
+ vertical-align: top;
65
+ top: 3px;
66
+ /* IE8, IE9, IE10 */
67
+ top: 0\0;
68
+ /* IE7 */
69
+ *top: -3px;
70
+ }
71
+
72
+ /* iPad */
73
+ @media (-webkit-min-device-pixel-ratio: 1) and (max-device-width: 1024px) {
74
+ input[type="radio"],
75
+ input[type="checkbox"] {
76
+ vertical-align: baseline;
77
+ top: 2px;
78
+ }
79
+ }
80
+
81
+ /* iPhone 3 */
82
+ @media (-webkit-min-device-pixel-ratio: 1) and (max-device-width: 480px) {
83
+ input[type="radio"],
84
+ input[type="checkbox"] {
85
+ vertical-align: baseline;
86
+ top: 0;
87
+ }
88
+ }
89
+
90
+ /* iPhone 4 */
91
+ @media (-webkit-min-device-pixel-ratio: 2) and (max-device-width: 480px) {
92
+ input[type="radio"],
93
+ input[type="checkbox"] {
94
+ vertical-align: baseline;
95
+ top: 0;
96
+ }
97
+ }
98
+
61
99
  button,
62
100
  input[type="reset"],
63
101
  input[type="submit"],
@@ -266,9 +304,13 @@ select[multiple] {
266
304
  text-shadow: #000 0 0 1px;
267
305
  }
268
306
 
307
+ ::-webkit-validation-bubble-arrow,
269
308
  ::-webkit-validation-bubble-top-outer-arrow,
270
309
  ::-webkit-validation-bubble-top-inner-arrow {
271
- display: none;
310
+ -webkit-box-shadow: none;
311
+ box-shadow: none;
312
+ background: #666;
313
+ border: 0;
272
314
  }
273
315
  }
274
316
 
@@ -353,4 +395,4 @@ optgroup {
353
395
 
354
396
  .ie6_input_disabled {
355
397
  background: #eee;
356
- }
398
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formalize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-30 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2011-08-18 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: railties
17
- requirement: &2173479960 !ruby/object:Gem::Requirement
16
+ requirement: &70260808824000 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,7 +21,7 @@ dependencies:
22
21
  version: 3.1.0.rc1
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2173479960
24
+ version_requirements: *70260808824000
26
25
  description: This gem provides the assets for the formalize form styling, for easy
27
26
  usage with the Rails 3.1 asset pipeline.
28
27
  email:
@@ -55,7 +54,6 @@ files:
55
54
  - vendor/assets/javascripts/yui.formalize.js
56
55
  - vendor/assets/javascripts/yui.formalize.min.js
57
56
  - vendor/assets/stylesheets/formalize.css
58
- has_rdoc: true
59
57
  homepage: https://github.com/iain/formalize-rails
60
58
  licenses: []
61
59
  post_install_message:
@@ -76,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
74
  version: '0'
77
75
  requirements: []
78
76
  rubyforge_project: formalize-rails
79
- rubygems_version: 1.6.2
77
+ rubygems_version: 1.8.6
80
78
  signing_key:
81
79
  specification_version: 3
82
80
  summary: Use Formalize with the asset pipeline