cutlass_js_rails 0.1.12 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/cutlass/html_generation.js +11 -0
- data/app/views/cutlass/_date_field.html.erb +1 -1
- data/app/views/cutlass/_radio_field.html.erb +5 -5
- data/app/views/cutlass/_select_field.html.erb +2 -1
- data/app/views/cutlass/_text_field.html.erb +3 -1
- data/app/views/cutlass/_toggle_field.html.erb +5 -1
- data/lib/cutlass_js_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f6ade3d21d7ccb219a3908cc7f47d385d10989b
|
4
|
+
data.tar.gz: bc7b764c1c6d3846314b2fcf77c54fcfe79e3c71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 156f9da3631a769733f75622d2c5156daed9a050e4fffe062f27012b11912869ab86519897ac121fcd5666cb458066e95f88c9aff5f71b28713f651500b09110
|
7
|
+
data.tar.gz: 7d35ac53a6553ce8b711a9cb15d93ad6a3517064be833a58db31554f70922fd0a24d8d103aca05f3193fb89453f0fd8a500b6c7ab7b9102a54a27555ac6bb0f4
|
@@ -8,6 +8,7 @@ Cutlass.generateHTML = function(inputTypes){
|
|
8
8
|
Cutlass.wrapInItem($(this), 'm-' + inputType)
|
9
9
|
Cutlass.addLabel($(this))
|
10
10
|
Cutlass.addError($(this))
|
11
|
+
Cutlass.addWrapperClasses($(this))
|
11
12
|
Cutlass.ifAlwaysActive($(this))
|
12
13
|
})
|
13
14
|
})
|
@@ -32,6 +33,16 @@ Cutlass.addError = function($input){
|
|
32
33
|
$input.before($error)
|
33
34
|
}
|
34
35
|
}
|
36
|
+
Cutlass.addWrapperClasses = function($input){
|
37
|
+
var classes = $input.data('wrapper-classes');
|
38
|
+
if(classes){
|
39
|
+
classes = classes.split(' ');
|
40
|
+
console.log($input);
|
41
|
+
classes.forEach(function(klass){
|
42
|
+
$input.parent().addClass(klass)
|
43
|
+
})
|
44
|
+
}
|
45
|
+
}
|
35
46
|
Cutlass.ifAlwaysActive = function($input){
|
36
47
|
if($input.data('always-active')){
|
37
48
|
$input.parent().addClass('m-always-active')
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<% css_classes = (defined? css_classes) ? css_classes : '' %>
|
2
2
|
<% props = local_assigns.fetch(:props, {}) %>
|
3
|
-
<%= f.text_field
|
3
|
+
<%= f.text_field code, class: "Cutlass-input-text #{css_classes}", 'data-label': label, type: 'tel', 'data-always-active': true, 'data-error': model.errors[field][0], **props %>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<%
|
1
|
+
<% code = local_assigns.fetch(:code) %>
|
2
|
+
<% value = model.loot_get(code) %>
|
2
3
|
<% options.map! do |option| %>
|
3
|
-
<% option
|
4
|
-
<% OpenStruct.new(value: option['value'], label: option['label']) %>
|
4
|
+
<% OpenStruct.new(value: option[0], label: option[1]) %>
|
5
5
|
<% end %>
|
6
6
|
|
7
|
-
<div class="Cutlass-input-radio" data-label="<%= label %>" data-error=<%= model.errors[
|
7
|
+
<div class="Cutlass-input-radio" data-label="<%= label %>" data-error=<%= model.errors[code][0] %>>
|
8
8
|
<% count = 0 %>
|
9
|
-
<%= f.collection_radio_buttons(
|
9
|
+
<%= f.collection_radio_buttons(code, options, 'value', 'label' ) do |b| %>
|
10
10
|
<div class="Cutlass-input-radio-single">
|
11
11
|
<%= b.radio_button(checked: (b.value == value || options.first.value), class: 'icheck-me Cutlass-input-radio-single' ) %>
|
12
12
|
<%= b.label %>
|
@@ -1,3 +1,4 @@
|
|
1
1
|
<% css_classes = (defined? css_classes) ? css_classes : '' %>
|
2
|
+
<% code = local_assigns.fetch(:code) %>
|
2
3
|
<% props = local_assigns.fetch(:props, {}) %>
|
3
|
-
<%= f.select
|
4
|
+
<%= f.select code, options_for_select(options, selected: value), props.merge(selected: value), { class: "Cutlass-input-select #{css_classes}", 'data-label': label, 'data-error': model.errors[code][0] } %>
|
@@ -1,3 +1,5 @@
|
|
1
1
|
<% css_classes = (defined? css_classes) ? css_classes : '' %>
|
2
2
|
<% props = (defined? props) ? props.to_h : {} %>
|
3
|
-
|
3
|
+
<% code = local_assigns.fetch(:code) %>
|
4
|
+
<% value = local_assigns.fetch(:value, '') %>
|
5
|
+
<%= f.text_field code, class: "Cutlass-input-text #{css_classes}", value: value, **({ 'data-label' => label, 'data-error' => model.errors[code][0] }.merge(props).symbolize_keys) %>
|
@@ -1,5 +1,9 @@
|
|
1
1
|
<% css_classes = (defined? css_classes) ? css_classes : '' %>
|
2
|
-
|
2
|
+
<% code = local_assigns.fetch(:code) %>
|
3
|
+
<% label = local_assigns.fetch(:label) %>
|
4
|
+
<% value = local_assigns.fetch(:value, '') %>
|
5
|
+
<%= f.check_box code, {
|
3
6
|
class: "Cutlass-input-toggler js-conditional-switch #{css_classes}",
|
7
|
+
checked: value == 'true',
|
4
8
|
'data-label': label
|
5
9
|
}, 'true', 'false' %>
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chardos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|