cutlass_js_rails 0.1.2 → 0.1.3

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: 2b4480ce2708a07231317508ccf692c59d32f2e3
4
- data.tar.gz: bc6901cc3a4f3c4c4a050d8cb0092efade44433e
3
+ metadata.gz: 24afb5c43746fc605ab92cad707d2928f1e86da3
4
+ data.tar.gz: 52f6ff2bd4db9989b37269e8ca6dbe9815a2d8ba
5
5
  SHA512:
6
- metadata.gz: 2936b99777d5f2e986a24d5049f4b78fc460bb11b0bd89b7212a3fdc2de3a32d9d04c82bc3a65fb06f72aa8150f92a5c1cd8762244c65340b5aaaf5076b37d6a
7
- data.tar.gz: 6013f4736d94339c020b34cffbb2cd695be0cc6759500bfd1b6f1983ace5408e89b3aceb20ae7b833e873a5ddd9470eef24c8b5fb8aa8e359756fe1a1c1d09a3
6
+ metadata.gz: 33913f4b030ee559586ee482013ea5c1af67a75678071e76a77df2750f63ac3958e0f83834a7d9d9024b76b7f52e29b5ff7e4748e7e5387279aa8f1b92c7beb4
7
+ data.tar.gz: 1f0afeacf74d0c6024e413f6cb043788bf1931b654d4204be1f369ae1f9eb48c9374b1334996dc621d9697429e8c5969377f01d92e81e953c7bbd12ab6820fa6
@@ -10,6 +10,7 @@ Cutlass.generateHTML = function(inputTypes){
10
10
  $('.Cutlass-input-' + inputType).each(function(){
11
11
  Cutlass.wrapInItem($(this), 'm-' + inputType)
12
12
  Cutlass.addLabel($(this))
13
+ Cutlass.addError($(this))
13
14
  Cutlass.ifAlwaysActive($(this))
14
15
  })
15
16
  })
@@ -23,10 +24,17 @@ Cutlass.wrapInItem = function($el, cssClass){
23
24
  $div.append($input)
24
25
  }
25
26
  Cutlass.addLabel = function($input){
26
- var labelText = $input.data('label');
27
- var $label = $('<div class="Cutlass-label">' + labelText + '</div>')
27
+ var text = $input.data('label');
28
+ var $label = $('<div class="Cutlass-label">' + text + '</div>')
28
29
  $input.before($label)
29
30
  }
31
+ Cutlass.addError = function($input){
32
+ var text = $input.data('error');
33
+ if(text){
34
+ var $error = $('<div class="Cutlass-error Tooltip m-orange">' + text + '</div>');
35
+ $input.before($error)
36
+ }
37
+ }
30
38
  Cutlass.ifAlwaysActive = function($input){
31
39
  if($input.data('always-active')){
32
40
  $input.parent().addClass('m-always-active')
@@ -1,6 +1,6 @@
1
1
  //= require cutlass/helpers
2
2
  //= require cutlass/html_generation
3
- $(document).ready(function(){
3
+ document.addEventListener("turbolinks:load", function() {
4
4
  Cutlass.generateAllHTML()
5
5
 
6
6
  //TEXT INPUTS =========================================================
@@ -2,7 +2,7 @@ $left-padding: 30px !default;
2
2
  $right-padding: 15px !default;
3
3
  $cutlass-border-color: #e4e4e4 !default;
4
4
  $cutlass-label-color: #080808 !default;
5
- $cutlass-label-opacity: .5;
5
+ $cutlass-label-opacity: .3;
6
6
  $cutlass-active-label-color: #080808 !default;
7
7
  $cutlass-input-color: #080808 !default;
8
8
  $cutlass-link-color: #ff7c14 !default;
@@ -15,6 +15,9 @@ $cutlass-link-color: #ff7c14 !default;
15
15
  position: relative;
16
16
  min-height: 60px;
17
17
  border-bottom: 1px solid $cutlass-border-color;
18
+ &.m-last{
19
+ border-bottom: 0;
20
+ }
18
21
  }
19
22
  .Cutlass-label{
20
23
  color: $cutlass-label-color;
@@ -112,6 +115,18 @@ $cutlass-link-color: #ff7c14 !default;
112
115
  }
113
116
  }
114
117
 
118
+ // ========================================================
119
+ // ERRORS
120
+ // ========================================================
121
+ .Cutlass-error{
122
+ position: absolute;
123
+ top: -10px;
124
+ left: 50%;
125
+ transform: translateX(-50%);
126
+ font-size: 14px;
127
+ }
128
+
129
+
115
130
  // ========================================================
116
131
  // MODIFIERS
117
132
  // ========================================================
@@ -0,0 +1,2 @@
1
+ <% css_classes = (defined? css_classes) ? css_classes : '' %>
2
+ <%= f.text_field field, class: "Cutlass-input-text js-birthday-input #{css_classes}", value: Chronic.parse(@user._date_of_birth, endian_precedence: [:little])&.strftime('%Y-%m-%d'), 'data-label': label, type: 'tel', 'data-always-active': true, 'data-error': @user.errors[field][0] %>
@@ -0,0 +1 @@
1
+ <%= link_to label, path, class: 'Cutlass-input-link' %>
@@ -0,0 +1,2 @@
1
+ <% css_classes = (defined? css_classes) ? css_classes : '' %>
2
+ <%= f.select field, options, {}, { class: "Cutlass-input-select #{css_classes}", 'data-label': label, 'data-error': user.errors[field][0] } %>
@@ -0,0 +1,3 @@
1
+ <% css_classes = (defined? css_classes) ? css_classes : '' %>
2
+ <% props = (defined? props) ? props.to_h : {} %>
3
+ <%= f.text_field field, class: "Cutlass-input-text #{css_classes}", 'data-label': label, 'data-error': user.errors[field][0], **props %>
@@ -0,0 +1,5 @@
1
+ <% css_classes = (defined? css_classes) ? css_classes : '' %>
2
+ <%= f.check_box field, {
3
+ class: "Cutlass-input-toggler js-conditional-switch #{css_classes}",
4
+ 'data-label': label
5
+ }, 'true', 'false' %>
@@ -1,3 +1,3 @@
1
1
  module CutlassJsRails
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
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-27 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -55,6 +55,11 @@ files:
55
55
  - app/assets/javascripts/cutlass/helpers.js
56
56
  - app/assets/javascripts/cutlass/html_generation.js
57
57
  - app/assets/stylesheets/_cutlass.scss
58
+ - app/views/cutlass/_date_field.html.erb
59
+ - app/views/cutlass/_link_field.html.erb
60
+ - app/views/cutlass/_select_field.html.erb
61
+ - app/views/cutlass/_text_field.html.erb
62
+ - app/views/cutlass/_toggle_field.html.erb
58
63
  - bin/console
59
64
  - bin/setup
60
65
  - cutlass_js_rails.gemspec
@@ -80,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
85
  version: '0'
81
86
  requirements: []
82
87
  rubyforge_project:
83
- rubygems_version: 2.5.1
88
+ rubygems_version: 2.6.4
84
89
  signing_key:
85
90
  specification_version: 4
86
91
  summary: Cuts down the size of inputs by reducing the prominence of labels once a