cutlass_js_rails 0.1.1 → 0.1.2

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: afbc791a69353795198913e79a19bb228c214cfc
4
- data.tar.gz: 5d28e91a960a6b6803591216b25cb84575940b71
3
+ metadata.gz: 2b4480ce2708a07231317508ccf692c59d32f2e3
4
+ data.tar.gz: bc6901cc3a4f3c4c4a050d8cb0092efade44433e
5
5
  SHA512:
6
- metadata.gz: 62a9eaded77189cd48cad57e4803436756f7fe596c17a9a55c6b2521505fa05458bc0b255a975bac4ed688e5922ee9c34b50cc5ce898bafeff6e617bb46a9e1e
7
- data.tar.gz: 66c133818fffb50cd2f51a0384f32a0b56c0e399b850a866f4367362977ac5a563081345bbfda961ab51e0807a166b2160983da502816d547ba6160f2dfcfd9e
6
+ metadata.gz: 2936b99777d5f2e986a24d5049f4b78fc460bb11b0bd89b7212a3fdc2de3a32d9d04c82bc3a65fb06f72aa8150f92a5c1cd8762244c65340b5aaaf5076b37d6a
7
+ data.tar.gz: 6013f4736d94339c020b34cffbb2cd695be0cc6759500bfd1b6f1983ace5408e89b3aceb20ae7b833e873a5ddd9470eef24c8b5fb8aa8e359756fe1a1c1d09a3
@@ -1,21 +1,20 @@
1
- Cutlass.generateHTML = function(){
2
- Cutlass.generateTexts();
3
- Cutlass.generateSelects();
1
+ Cutlass.generateAllHTML = function(){
2
+ // Cutlass.generateTexts();
3
+ // Cutlass.generateSelects();
4
+ // Cutlass.generateToggles();
5
+ Cutlass.generateHTML(['text', 'select', 'toggler', 'link'])
4
6
  }
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))
7
+
8
+ Cutlass.generateHTML = function(inputTypes){
9
+ $.each(inputTypes, function(i, inputType){
10
+ $('.Cutlass-input-' + inputType).each(function(){
11
+ Cutlass.wrapInItem($(this), 'm-' + inputType)
12
+ Cutlass.addLabel($(this))
13
+ Cutlass.ifAlwaysActive($(this))
14
+ })
15
15
  })
16
16
  }
17
17
 
18
-
19
18
  // HELPERS =====================
20
19
  Cutlass.wrapInItem = function($el, cssClass){
21
20
  var $div = $('<div class="Cutlass-item ' + cssClass + '"></div>');
@@ -28,3 +27,8 @@ Cutlass.addLabel = function($input){
28
27
  var $label = $('<div class="Cutlass-label">' + labelText + '</div>')
29
28
  $input.before($label)
30
29
  }
30
+ Cutlass.ifAlwaysActive = function($input){
31
+ if($input.data('always-active')){
32
+ $input.parent().addClass('m-always-active')
33
+ }
34
+ }
@@ -1,9 +1,9 @@
1
1
  //= require cutlass/helpers
2
2
  //= require cutlass/html_generation
3
3
  $(document).ready(function(){
4
- Cutlass.generateHTML()
4
+ Cutlass.generateAllHTML()
5
5
 
6
- //TEXT INPUTS ========================================
6
+ //TEXT INPUTS =========================================================
7
7
 
8
8
  $(document).on('focus', '.Cutlass-input-text', function(){
9
9
  Cutlass.toggleInputActive( $(this), 'focus' );
@@ -19,7 +19,7 @@ $(document).ready(function(){
19
19
  }
20
20
  })
21
21
 
22
- //SELECT BOXES ========================================
22
+ //SELECT BOXES ========================================================
23
23
 
24
24
  $(document).on('change', '.Cutlass-input-select', function(){
25
25
  Cutlass.toggleSelectActive($(this))
@@ -1,10 +1,11 @@
1
- $left-padding: 30px;
2
- $right-padding: 15px;
1
+ $left-padding: 30px !default;
2
+ $right-padding: 15px !default;
3
3
  $cutlass-border-color: #e4e4e4 !default;
4
4
  $cutlass-label-color: #080808 !default;
5
5
  $cutlass-label-opacity: .5;
6
6
  $cutlass-active-label-color: #080808 !default;
7
7
  $cutlass-input-color: #080808 !default;
8
+ $cutlass-link-color: #ff7c14 !default;
8
9
 
9
10
  .Cutlass-group{
10
11
  text-align: left;
@@ -74,9 +75,56 @@ $cutlass-input-color: #080808 !default;
74
75
  }
75
76
  }
76
77
 
78
+ // ========================================================
79
+ // TOGGLER INPUT
80
+ // ========================================================
81
+ .m-toggler{
82
+ .Cutlass-label{
83
+ opacity: 1;
84
+ padding: 18px ($right-padding+60) 19px $left-padding;
85
+ }
86
+ .switchery{
87
+ position: absolute;
88
+ right: $right-padding;
89
+ top: 50%;
90
+ margin-top: -16px;
91
+ }
92
+ }
93
+
94
+ // ========================================================
95
+ // LINK INPUT
96
+ // ========================================================
97
+ .m-link{
98
+ padding: 18px $right-padding 0 $left-padding;
99
+ .Cutlass-label{
100
+ display: none;
101
+ }
102
+ .Cutlass-input-link{
103
+ color: $cutlass-link-color;
104
+ font-size: 15px;
105
+ transition: all .3s;
106
+ }
107
+ .switchery{
108
+ position: absolute;
109
+ right: $right-padding;
110
+ top: 50%;
111
+ margin-top: -16px;
112
+ }
113
+ }
114
+
77
115
  // ========================================================
78
116
  // MODIFIERS
79
117
  // ========================================================
118
+ .m-always-active{
119
+ .Cutlass-label{
120
+ font-size: 12px;
121
+ transform: translateY(-6px);
122
+ }
123
+ }
124
+
125
+ // ========================================================
126
+ // STATES
127
+ // ========================================================
80
128
 
81
129
  //Change label position on text inputs
82
130
  .s-active{
@@ -1,3 +1,3 @@
1
1
  module CutlassJsRails
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutlass_js_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - chardos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler