label_better_rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df571b96548c14b38acd8496ca7ff8975d42ba42
4
+ data.tar.gz: 84d60959ea18d891817555e2682ae7fc46a7c3ef
5
+ SHA512:
6
+ metadata.gz: 9ad4866776e4a39d51af14ca4ed9e72c4736e4efc2a05264e2374b2e1e146456a63bf41d8c99c0f9fe457ca86ff285b6169dd6484ae7243632556a818fbaa2de
7
+ data.tar.gz: ea369914e1e91ea39b9d6a7e91a3f102864744598cea61f190934451a5b9a49ba00c6bef1fd26f2868df92d96de6efe1c5cee3b6f8e7a236e325c0be40ac2263
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in label_better_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 navinspm
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # LabelBetterRails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'label_better_rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install label_better_rails
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/label_better_rails/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'label_better_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "label_better_rails"
8
+ spec.version = LabelBetterRails::VERSION
9
+ spec.authors = ["navinspm"]
10
+ spec.email = ["navinspm@gmail.com"]
11
+ spec.summary = "gemmified label_better jquery plugin that styles the input field labels"
12
+ spec.description = 'Its a gemmifiied version of jquery plugin label_better http://www.thepetedesign.com/demos/label_better_demo.html'
13
+ spec.homepage = "https://github.com/navinspm/label_better_rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,8 @@
1
+ require "label_better_rails/version"
2
+
3
+ module LabelBetterRails
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module LabelBetterRails
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,160 @@
1
+ /* ===========================================================
2
+ * jquery-label_better.js v1.1
3
+ * ===========================================================
4
+ * Copyright 2013 Pete Rojwongsuriya.
5
+ * http://www.thepetedesign.com
6
+ *
7
+ * Label your form input like a boss with
8
+ * beautiful animation and without taking up space
9
+ *
10
+ * https://github.com/peachananr/label_better
11
+ *
12
+ * ========================================================== */
13
+
14
+ !function($){
15
+
16
+ var defaults = {
17
+ position: "top",
18
+ animationTime: 500,
19
+ easing: "ease-in-out",
20
+ offset: 20,
21
+ hidePlaceholderOnFocus: true
22
+ };
23
+
24
+ $.fn.animateLabel = function(settings, btn) {
25
+ var position = btn.data("position") || settings.position,
26
+ posx = 0,
27
+ posy = 0;
28
+
29
+
30
+ $(this).css({
31
+ "left": "auto",
32
+ "right": "auto",
33
+ "position": "absolute",
34
+ "-webkit-transition": "all " + settings.animationTime + "ms " + settings.easing,
35
+ "-moz-transition": "all " + settings.animationTime + "ms " + settings.easing,
36
+ "-ms-transition": "all " + settings.animationTime + "ms " + settings.easing,
37
+ "transition": "all " + settings.animationTime + "ms " + settings.easing
38
+ });
39
+
40
+ switch (position) {
41
+ case 'top':
42
+ posx = 0;
43
+ posy = ($(this).height() + settings.offset) * -1;
44
+
45
+ $(this).css({
46
+ "top": "0",
47
+ "opacity": "1",
48
+ "-webkit-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
49
+ "-moz-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
50
+ "-ms-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
51
+ "transform": "translate3d(" + posx + ", " + posy + "px, 0)"
52
+ });
53
+ break;
54
+
55
+ case 'bottom':
56
+ posx = 0;
57
+ posy = ($(this).height() + settings.offset);
58
+
59
+ $(this).css({
60
+ "bottom": "0",
61
+ "opacity": "1",
62
+ "-webkit-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
63
+ "-moz-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
64
+ "-ms-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
65
+ "transform": "translate3d(" + posx + ", " + posy + "px, 0)"
66
+ });
67
+ break;
68
+
69
+ case 'left':
70
+ posx = ($(this).width() + settings.offset) * -1;
71
+ posy = 0;
72
+
73
+ $(this).css({
74
+ "left": 0,
75
+ "top": 0,
76
+ "opacity": "1",
77
+ "-webkit-transform": "translate3d(" + posx + "px, " + posy + "px, 0)",
78
+ "-moz-transform": "translate3d(" + posx + "px, " + posy + "px, 0)",
79
+ "-ms-transform": "translate3d(" + posx + "px, " + posy + "px, 0)",
80
+ "transform": "translate3d(" + posx + "px, " + posy + "px, 0)"
81
+ });
82
+ break;
83
+
84
+ case 'right':
85
+ posx = $(this).width() + settings.offset;
86
+ posy = 0;
87
+
88
+ $(this).css({
89
+ "right": 0,
90
+ "top": 0,
91
+ "opacity": "1",
92
+ "-webkit-transform": "translate3d(" + posx + "px, " + posy + "px, 0)",
93
+ "-moz-transform": "translate3d(" + posx + "px, " + posy + "px, 0)",
94
+ "-ms-transform": "translate3d(" + posx + "px, " + posy + "px, 0)",
95
+ "transform": "translate3d(" + posx + "px, " + posy + "px, 0)"
96
+ });
97
+ break;
98
+ }
99
+ }
100
+
101
+ $.fn.removeAnimate = function(settings, btn) {
102
+ var position = btn.data("position") || settings.position,
103
+ posx = 0,
104
+ posy = 0;
105
+
106
+ $(this).css({
107
+ "top": "0",
108
+ "opacity": "0",
109
+ "-webkit-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
110
+ "-moz-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
111
+ "-ms-transform": "translate3d(" + posx + ", " + posy + "px, 0)",
112
+ "transform": "translate3d(" + posx + ", " + posy + "px, 0)"
113
+ });
114
+
115
+ }
116
+
117
+ $.fn.label_better = function(options){
118
+ var settings = $.extend({}, defaults, options),
119
+ el = $(this),
120
+ triggerIn = "focus",
121
+ triggerOut = "blur";
122
+ if(settings.easing == "bounce") settings.easing = "cubic-bezier(0.175, 0.885, 0.420, 1.310)"
123
+
124
+ el.each(function( index, value ) {
125
+ var btn = $(this),
126
+ position = btn.data("position") || settings.position;
127
+ btn.wrapAll("<div class='lb_wrap' style='position:relative; display: inline;'></div>")
128
+
129
+ if( btn.val().length > 0) {
130
+ var text = btn.data("new-placeholder") || btn.attr("placeholder");
131
+ $("<div class='lb_label " + position + "'>"+ text + "</div>").css("opacity", "0").insertAfter(btn).animateLabel(settings, btn);
132
+ }
133
+
134
+ btn.bind(triggerIn, function() {
135
+ if(btn.val().length < 1) {
136
+ var text = btn.data("new-placeholder") || btn.attr("placeholder"),
137
+ position = btn.data("position") || settings.position;
138
+ $("<div class='lb_label " + position + "'>"+ text + "</div>").css("opacity", "0").insertAfter(btn).animateLabel(settings, btn);
139
+ }
140
+ if (settings.hidePlaceholderOnFocus == true) {
141
+ btn.data("default-placeholder", btn.attr("placeholder"))
142
+ btn.attr("placeholder", "")
143
+ }
144
+ btn.parent().find(".lb_label").addClass("active");
145
+ }).bind(triggerOut, function() {
146
+
147
+ if(btn.val().length < 1) {
148
+ btn.parent().find(".lb_label").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ $(this).remove(); }).removeAnimate(settings, btn)
149
+ }
150
+ if (settings.hidePlaceholderOnFocus == true) {
151
+ btn.attr("placeholder", btn.data("default-placeholder"))
152
+ btn.data("default-placeholder", "")
153
+ }
154
+ btn.parent().find(".lb_label").removeClass("active");
155
+ });
156
+ });
157
+
158
+ }
159
+ }(window.jQuery);
160
+
@@ -0,0 +1 @@
1
+ !function(e){var t={position:"top",animationTime:500,easing:"ease-in-out",offset:20,hidePlaceholderOnFocus:true};e.fn.animateLabel=function(t,n){var r=n.data("position")||t.position,i=0,s=0;e(this).css({left:"auto",right:"auto",position:"absolute","-webkit-transition":"all "+t.animationTime+"ms "+t.easing,"-moz-transition":"all "+t.animationTime+"ms "+t.easing,"-ms-transition":"all "+t.animationTime+"ms "+t.easing,transition:"all "+t.animationTime+"ms "+t.easing});switch(r){case"top":i=0;s=(e(this).height()+t.offset)*-1;e(this).css({top:"0",opacity:"1","-webkit-transform":"translate3d("+i+", "+s+"px, 0)","-moz-transform":"translate3d("+i+", "+s+"px, 0)","-ms-transform":"translate3d("+i+", "+s+"px, 0)",transform:"translate3d("+i+", "+s+"px, 0)"});break;case"bottom":i=0;s=e(this).height()+t.offset;e(this).css({bottom:"0",opacity:"1","-webkit-transform":"translate3d("+i+", "+s+"px, 0)","-moz-transform":"translate3d("+i+", "+s+"px, 0)","-ms-transform":"translate3d("+i+", "+s+"px, 0)",transform:"translate3d("+i+", "+s+"px, 0)"});break;case"left":i=(e(this).width()+t.offset)*-1;s=0;e(this).css({left:0,top:0,opacity:"1","-webkit-transform":"translate3d("+i+"px, "+s+"px, 0)","-moz-transform":"translate3d("+i+"px, "+s+"px, 0)","-ms-transform":"translate3d("+i+"px, "+s+"px, 0)",transform:"translate3d("+i+"px, "+s+"px, 0)"});break;case"right":i=e(this).width()+t.offset;s=0;e(this).css({right:0,top:0,opacity:"1","-webkit-transform":"translate3d("+i+"px, "+s+"px, 0)","-moz-transform":"translate3d("+i+"px, "+s+"px, 0)","-ms-transform":"translate3d("+i+"px, "+s+"px, 0)",transform:"translate3d("+i+"px, "+s+"px, 0)"});break}};e.fn.removeAnimate=function(t,n){var r=n.data("position")||t.position,i=0,s=0;e(this).css({top:"0",opacity:"0","-webkit-transform":"translate3d("+i+", "+s+"px, 0)","-moz-transform":"translate3d("+i+", "+s+"px, 0)","-ms-transform":"translate3d("+i+", "+s+"px, 0)",transform:"translate3d("+i+", "+s+"px, 0)"})};e.fn.label_better=function(n){var r=e.extend({},t,n),i=e(this),s="focus",o="blur";if(r.easing=="bounce")r.easing="cubic-bezier(0.175, 0.885, 0.420, 1.310)";i.each(function(t,n){var i=e(this),u=i.data("position")||r.position;i.wrapAll("<div class='lb_wrap' style='position:relative; display: inline;'></div>");if(i.val().length>0){var a=i.data("new-placeholder")||i.attr("placeholder");e("<div class='lb_label "+u+"'>"+a+"</div>").css("opacity","0").insertAfter(i).animateLabel(r,i)}i.bind(s,function(){if(i.val().length<1){var t=i.data("new-placeholder")||i.attr("placeholder"),n=i.data("position")||r.position;e("<div class='lb_label "+n+"'>"+t+"</div>").css("opacity","0").insertAfter(i).animateLabel(r,i)}if(r.hidePlaceholderOnFocus==true){i.data("default-placeholder",i.attr("placeholder"));i.attr("placeholder","")}i.parent().find(".lb_label").addClass("active")}).bind(o,function(){if(i.val().length<1){i.parent().find(".lb_label").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){e(this).remove()}).removeAnimate(r,i)}if(r.hidePlaceholderOnFocus==true){i.attr("placeholder",i.data("default-placeholder"));i.data("default-placeholder","")}i.parent().find(".lb_label").removeClass("active")})})}}(window.jQuery)
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: label_better_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - navinspm
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Its a gemmifiied version of jquery plugin label_better http://www.thepetedesign.com/demos/label_better_demo.html
42
+ email:
43
+ - navinspm@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - label_better_rails.gemspec
54
+ - lib/label_better_rails.rb
55
+ - lib/label_better_rails/version.rb
56
+ - vendor/assets/javascript/jquery.label_better.js
57
+ - vendor/assets/javascript/jquery.label_better.min.js
58
+ homepage: https://github.com/navinspm/label_better_rails
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: gemmified label_better jquery plugin that styles the input field labels
82
+ test_files: []
83
+ has_rdoc: