cutlass_js_rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afbc791a69353795198913e79a19bb228c214cfc
|
4
|
+
data.tar.gz: 5d28e91a960a6b6803591216b25cb84575940b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a9eaded77189cd48cad57e4803436756f7fe596c17a9a55c6b2521505fa05458bc0b255a975bac4ed688e5922ee9c34b50cc5ce898bafeff6e617bb46a9e1e
|
7
|
+
data.tar.gz: 66c133818fffb50cd2f51a0384f32a0b56c0e399b850a866f4367362977ac5a563081345bbfda961ab51e0807a166b2160983da502816d547ba6160f2dfcfd9e
|
@@ -0,0 +1,26 @@
|
|
1
|
+
//HELPERS ========================================
|
2
|
+
var Cutlass = {}
|
3
|
+
|
4
|
+
Cutlass.toggleInputActive = function($el, event){
|
5
|
+
if(event == 'focus'){
|
6
|
+
Cutlass.makeActive($el);
|
7
|
+
}
|
8
|
+
else if( !$el.val().length ){ //blur event
|
9
|
+
Cutlass.removeActive($el);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
Cutlass.toggleSelectActive = function($select){
|
14
|
+
if( $select.val() ){
|
15
|
+
Cutlass.makeActive($select);
|
16
|
+
}
|
17
|
+
else{
|
18
|
+
Cutlass.removeActive($select);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
Cutlass.makeActive = function($input){
|
22
|
+
$input.parent().addClass('s-active');
|
23
|
+
}
|
24
|
+
Cutlass.removeActive = function($input){
|
25
|
+
$input.parent().removeClass('s-active');
|
26
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Cutlass.generateHTML = function(){
|
2
|
+
Cutlass.generateTexts();
|
3
|
+
Cutlass.generateSelects();
|
4
|
+
}
|
5
|
+
Cutlass.generateTexts = function(){
|
6
|
+
$('.Cutlass-input-text').each(function(){
|
7
|
+
Cutlass.wrapInItem($(this), 'm-text')
|
8
|
+
Cutlass.addLabel($(this))
|
9
|
+
})
|
10
|
+
}
|
11
|
+
Cutlass.generateSelects = function(){
|
12
|
+
$('.Cutlass-input-select').each(function(){
|
13
|
+
Cutlass.wrapInItem($(this), 'm-select')
|
14
|
+
Cutlass.addLabel($(this))
|
15
|
+
})
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
// HELPERS =====================
|
20
|
+
Cutlass.wrapInItem = function($el, cssClass){
|
21
|
+
var $div = $('<div class="Cutlass-item ' + cssClass + '"></div>');
|
22
|
+
$el.before($div)
|
23
|
+
var $input = $el.detach();
|
24
|
+
$div.append($input)
|
25
|
+
}
|
26
|
+
Cutlass.addLabel = function($input){
|
27
|
+
var labelText = $input.data('label');
|
28
|
+
var $label = $('<div class="Cutlass-label">' + labelText + '</div>')
|
29
|
+
$input.before($label)
|
30
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
//= require cutlass/helpers
|
2
|
+
//= require cutlass/html_generation
|
3
|
+
$(document).ready(function(){
|
4
|
+
Cutlass.generateHTML()
|
5
|
+
|
6
|
+
//TEXT INPUTS ========================================
|
7
|
+
|
8
|
+
$(document).on('focus', '.Cutlass-input-text', function(){
|
9
|
+
Cutlass.toggleInputActive( $(this), 'focus' );
|
10
|
+
})
|
11
|
+
|
12
|
+
$(document).on('blur', '.Cutlass-input-text', function(){
|
13
|
+
Cutlass.toggleInputActive( $(this), 'blur' );
|
14
|
+
})
|
15
|
+
|
16
|
+
$('.Cutlass-input-text').each(function(){
|
17
|
+
if($(this).val().length){
|
18
|
+
Cutlass.makeActive($(this));
|
19
|
+
}
|
20
|
+
})
|
21
|
+
|
22
|
+
//SELECT BOXES ========================================
|
23
|
+
|
24
|
+
$(document).on('change', '.Cutlass-input-select', function(){
|
25
|
+
Cutlass.toggleSelectActive($(this))
|
26
|
+
})
|
27
|
+
|
28
|
+
$('.Cutlass-input-select').each(function(){
|
29
|
+
Cutlass.toggleSelectActive($(this))
|
30
|
+
})
|
31
|
+
|
32
|
+
})
|
@@ -0,0 +1,94 @@
|
|
1
|
+
$left-padding: 30px;
|
2
|
+
$right-padding: 15px;
|
3
|
+
$cutlass-border-color: #e4e4e4 !default;
|
4
|
+
$cutlass-label-color: #080808 !default;
|
5
|
+
$cutlass-label-opacity: .5;
|
6
|
+
$cutlass-active-label-color: #080808 !default;
|
7
|
+
$cutlass-input-color: #080808 !default;
|
8
|
+
|
9
|
+
.Cutlass-group{
|
10
|
+
text-align: left;
|
11
|
+
margin-bottom: 10px;
|
12
|
+
}
|
13
|
+
.Cutlass-item{
|
14
|
+
position: relative;
|
15
|
+
min-height: 60px;
|
16
|
+
border-bottom: 1px solid $cutlass-border-color;
|
17
|
+
}
|
18
|
+
.Cutlass-label{
|
19
|
+
color: $cutlass-label-color;
|
20
|
+
transition: all .2s;
|
21
|
+
font-size: 15px;
|
22
|
+
opacity: $cutlass-label-opacity;
|
23
|
+
}
|
24
|
+
%Cutlass-input{
|
25
|
+
border: 0;
|
26
|
+
font-size: 15px;
|
27
|
+
}
|
28
|
+
|
29
|
+
// ========================================================
|
30
|
+
// TEXT INPUT
|
31
|
+
// ========================================================
|
32
|
+
.m-text{
|
33
|
+
.Cutlass-label{
|
34
|
+
position: absolute;
|
35
|
+
left: $left-padding;
|
36
|
+
top: 18px;
|
37
|
+
opacity: $cutlass-label-opacity;
|
38
|
+
}
|
39
|
+
.Cutlass-input-text{
|
40
|
+
@extend %Cutlass-input;
|
41
|
+
position: relative;
|
42
|
+
color: $cutlass-input-color;
|
43
|
+
padding: 32px $right-padding 10px $left-padding;
|
44
|
+
background-color: transparent;
|
45
|
+
z-index: 5;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
// ========================================================
|
50
|
+
// SELECT INPUT
|
51
|
+
// ========================================================
|
52
|
+
.m-select{
|
53
|
+
.Cutlass-label{
|
54
|
+
position: absolute;
|
55
|
+
left: $left-padding;
|
56
|
+
top: 18px;
|
57
|
+
}
|
58
|
+
.Cutlass-input-select{
|
59
|
+
@extend %Cutlass-input;
|
60
|
+
position: relative;
|
61
|
+
height: 59px;
|
62
|
+
color: $cutlass-input-color;
|
63
|
+
padding: 8px $right-padding 0 $left-padding;
|
64
|
+
background-color: transparent;
|
65
|
+
width: 100%;
|
66
|
+
z-index: 5;
|
67
|
+
outline: 0;
|
68
|
+
appearance: none;
|
69
|
+
-webkit-appearance: none; /*Removes default chrome and safari style*/
|
70
|
+
-moz-appearance: none; /*Removes default style Firefox*/
|
71
|
+
&::-ms-expand{
|
72
|
+
display: none; //IE10 remove arrow
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
// ========================================================
|
78
|
+
// MODIFIERS
|
79
|
+
// ========================================================
|
80
|
+
|
81
|
+
//Change label position on text inputs
|
82
|
+
.s-active{
|
83
|
+
.Cutlass-label{
|
84
|
+
font-size: 12px;
|
85
|
+
transform: translateY(-6px);
|
86
|
+
}
|
87
|
+
|
88
|
+
//Active for selectboxes
|
89
|
+
&.m-select.s-active{
|
90
|
+
.Cutlass-input-select{
|
91
|
+
padding-top: 22px;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cutlass_js_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chardos
|
@@ -51,6 +51,10 @@ files:
|
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
|
+
- app/assets/javascripts/cutlass.js
|
55
|
+
- app/assets/javascripts/cutlass/helpers.js
|
56
|
+
- app/assets/javascripts/cutlass/html_generation.js
|
57
|
+
- app/assets/stylesheets/_cutlass.scss
|
54
58
|
- bin/console
|
55
59
|
- bin/setup
|
56
60
|
- cutlass_js_rails.gemspec
|