sky-labels-rails 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c6c0c8c6b72f260abb4a1af9f04bd88fd05a3507
4
+ data.tar.gz: 0561eae8af8e089c36f81f73990274a42be25c5d
5
+ SHA512:
6
+ metadata.gz: fd9760c099f4964db59f2a14db846968d895963ffa9fb2902083d31d7865147c181bbf1b16f3e677361e36cca1c7609ad6da18074ff145b07a58a4cc472500fe
7
+ data.tar.gz: cb9dd1fd497dbc7acafe877e60dc7b484b6143cc941bd56d3eb12b440e4f75c0f45f7e474bd728f79c3d7b0292d0854b81375883c08650de6fefafd66e093097
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Paul Smith
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.
@@ -0,0 +1,17 @@
1
+ # Sky Labels Rails
2
+
3
+ [SkyLabels.js](https://github.com/thoughtbot/sky-labels) is a library that makes
4
+ compact forms more fun and accessible. This gem allows for its easy inclusion
5
+ into the rails asset pipeline.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'sky-labels-rails'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Add the following directive to your Javascript manifest file (application.js):
@@ -0,0 +1,8 @@
1
+ require 'sky-labels-rails/version'
2
+
3
+ module SkyLabels
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module SkyLabels
2
+ module Rails
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ /*
2
+ * SkyLabels.js - v0.0.2
3
+ * Fun, Compact & Accessible Forms
4
+ * http://thoughtbot.github.io/sky-labels
5
+ *
6
+ * Made by Paul Smith
7
+ * Under MIT License
8
+ */
9
+ var setupSkyLabels = function () {
10
+ $(document).on("focus blur", ".sky-label", addOrRemoveHasTextClass);
11
+ $(document).on("focus", ".sky-label", addFocusedClass);
12
+ $(document).on("blur", ".sky-label", removeFocusedClass);
13
+ $(document).ready(hideLabelsIfInputHasText);
14
+
15
+ function addFocusedClass(event) {
16
+ var fieldWrapper = $(event.currentTarget);
17
+ fieldWrapper.addClass("sky-label-focused");
18
+ }
19
+
20
+ function removeFocusedClass(event) {
21
+ var fieldWrapper = $(event.currentTarget);
22
+ fieldWrapper.removeClass("sky-label-focused");
23
+ }
24
+
25
+ function hideLabelsIfInputHasText() {
26
+ $(".sky-label").trigger("blur");
27
+ }
28
+
29
+ function addOrRemoveHasTextClass(event) {
30
+ var fieldWrapper = $(event.currentTarget);
31
+ if ( fieldWrapperHasText(fieldWrapper) ) {
32
+ fieldWrapper.addClass("sky-label-has-text");
33
+ } else {
34
+ fieldWrapper.removeClass("sky-label-has-text");
35
+ }
36
+ }
37
+
38
+ function fieldWrapperHasText(fieldWrapper) {
39
+ var textField = fieldWrapper.find("input, textarea");
40
+ return $.trim(textField.val()).length;
41
+ }
42
+ };
@@ -0,0 +1,39 @@
1
+ $sky-labels-blurred-text-color: #000 !default;
2
+ $sky-labels-focused-background-color: #000 !default;
3
+ $sky-labels-focused-text-color: #FFF !default;
4
+ $sky-labels-animation-duration: .15s !default;
5
+
6
+ .sky-label {
7
+ margin-top: 15px;
8
+ position: relative;
9
+ }
10
+
11
+ .sky-label label {
12
+ color: $sky-labels-blurred-text-color;
13
+ left: 4px;
14
+ padding: 4px 6px;
15
+ position: absolute;
16
+ top: 4px;
17
+ transition: -webkit-transform $sky-labels-animation-duration,
18
+ opacity $sky-labels-animation-duration,
19
+ top $sky-labels-animation-duration,
20
+ left $sky-labels-animation-duration,
21
+ background-color $sky-labels-animation-duration,
22
+ color $sky-labels-animation-duration;
23
+ }
24
+
25
+ .sky-label-focused label, .sky-label-has-text label {
26
+ background-color: $sky-labels-focused-background-color;
27
+ color: $sky-labels-focused-text-color;
28
+ left: 0px;
29
+ opacity: 1;
30
+ top: -20px;
31
+ }
32
+
33
+ .sky-label-has-text label {
34
+ opacity: 0;
35
+ }
36
+
37
+ .sky-label-focused.sky-label-has-text label {
38
+ opacity: 1;
39
+ }
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sky-labels-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Paul Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: |2
56
+ SkyLabels.js is a library that makes compact forms more fun and accessible. This gem allows for its easy inclusion into the rails asset pipeline.
57
+ email:
58
+ - catalystmediastudios@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - lib/sky-labels-rails/version.rb
64
+ - lib/sky-labels-rails.rb
65
+ - vendor/assets/javascripts/sky-labels.js
66
+ - vendor/assets/stylesheets/sky-labels.scss
67
+ - LICENSE.txt
68
+ - README.md
69
+ homepage: https://www.github.com/thoughtbot/sky-labels-rails
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.0.3
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: The Sky-Labels.js JavaScript library ready to play with Rails
93
+ test_files: []