cutlass_js_rails 0.1.5 → 0.1.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f484d601256c06cd87128f9576e1648d75f4b52
4
- data.tar.gz: 88dc4c118769a9c79efc5a1add3456c00962529f
3
+ metadata.gz: 8649b810a66aa646a5c2ecc7e6a060cbb83560b4
4
+ data.tar.gz: f1f7769a154f92735fe2d55aea617d06c960a7ed
5
5
  SHA512:
6
- metadata.gz: 14d12de00ebb14ffdd43fbcbaa10d92da261c02be4f24b480918aa06552442038dbc283aa1fa04684ac7147464b2774b4327d62b4d898888c991d7459de5ffb8
7
- data.tar.gz: 4d282bf30a0688e8bdf72bc4b89ee23c1ce1ac709ead5d60ff6653ef3d3b45fcd3902459c39c247bc151ed84cf7a03e2fbf5ace89a0d8896fffa9f64980fca30
6
+ metadata.gz: c8c8ebf991e771323d21131a5cd059423c845cb7cadccab0c96b296275a4f2631d28002fc2ceed900ed0f5ed6bcf707a9aabecb5e828bacf3ee61ee2498ea1a7
7
+ data.tar.gz: dd2511d3a94d70a34ae142d432acd4bc846714920ca72149219f9f11b40f21ddaf3c04c7602124526e7613a976d8e64dd3aa024a25508cd01ba35ff30f0f8e05
data/README.md CHANGED
@@ -8,6 +8,36 @@ TODO: Delete this and the text above, and describe your gem
8
8
 
9
9
  Add this line to your application's Gemfile:
10
10
 
11
+ ## Sample fields
12
+
13
+ ```
14
+ # Cutlass hash where f = field passed from a form_for.
15
+ <% cutlass_hash = {f: f, model: @abn_application} %>
16
+
17
+ # Text field
18
+ <%= render 'cutlass/text_field', field: :_first_name, label: 'First name', **cutlass_hash %>
19
+
20
+ # Text field with a type
21
+ <%= render 'cutlass/text_field', field: :_contact_number, label: 'Phone', **cutlass_hash, props: {type: 'tel'} %>
22
+
23
+ # Date field
24
+ <%= render 'cutlass/date_field', field: :_date_of_birth, label: 'Date of birth', **cutlass_hash %>
25
+
26
+ # Radio field
27
+ <%= render 'cutlass/radio_field', field: :_import_goods_and_services, label: 'Do you import goods and services from overseas?', **cutlass_hash, options: [
28
+ { label: 'Yes', value: 'yes'},
29
+ { label: 'No', value: 'no'}
30
+ ] %>
31
+
32
+ # Select field
33
+ <%= render 'cutlass/select_field', field: :_gross_income_estimate, label: 'Expected annual business turnover', **cutlass_hash, options: [
34
+ [''], ['$0 - $75,000'], ['$75,000 - $150,000'], ['$150,000 - $2M']
35
+ ] %>
36
+
37
+ # Toggle field
38
+ <%= render 'cutlass/toggle_field', field: :_import_goods_and_services, label: 'Do you import goods and services from overseas?', **cutlass_hash %>
39
+ ```
40
+
11
41
  ```ruby
12
42
  gem 'cutlass_js_rails'
13
43
  ```
@@ -38,4 +68,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
38
68
  ## License
39
69
 
40
70
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -1,8 +1,5 @@
1
1
  Cutlass.generateAllHTML = function(){
2
- // Cutlass.generateTexts();
3
- // Cutlass.generateSelects();
4
- // Cutlass.generateToggles();
5
- Cutlass.generateHTML(['text', 'select', 'toggler', 'link'])
2
+ Cutlass.generateHTML(['text', 'select', 'radio', 'toggler', 'link'])
6
3
  }
7
4
 
8
5
  Cutlass.generateHTML = function(inputTypes){
@@ -93,6 +93,22 @@ $cutlass-link-color: #ff7c14 !default;
93
93
  margin-top: -16px;
94
94
  }
95
95
  }
96
+ // ========================================================
97
+ // RADIO INPUT
98
+ // ========================================================
99
+ .m-radio{
100
+ .Cutlass-label{
101
+ opacity: 1;
102
+ padding: 18px $right-padding 13px $left-padding;
103
+ }
104
+ .Cutlass-input-radio{
105
+ padding: 0 15px 25px 30px;
106
+ }
107
+ .Cutlass-input-radio-single{
108
+ display: inline-block;
109
+ margin-right: 15px;
110
+ }
111
+ }
96
112
 
97
113
  // ========================================================
98
114
  // LINK INPUT
@@ -151,7 +167,7 @@ $cutlass-link-color: #ff7c14 !default;
151
167
  //Active for selectboxes
152
168
  &.m-select.s-active{
153
169
  .Cutlass-input-select{
154
- padding-top: 22px;
170
+ padding-top: 21px;
155
171
  }
156
172
  }
157
173
  }
@@ -0,0 +1,14 @@
1
+ <% value = model.loot_get(field['code']) %>
2
+ <% options.map! do |option| %>
3
+ <% option = option.with_indifferent_access %>
4
+ <% OpenStruct.new(value: option['value'], label: option['label']) %>
5
+ <% end %>
6
+
7
+ <div class="Cutlass-input-radio" data-label="<%= label %>">
8
+ <%= f.collection_radio_buttons(field, options, 'value', 'label') do |b| %>
9
+ <div class="Cutlass-input-radio-single">
10
+ <%= b.radio_button(checked: (b.value == value || options.first.value), class: 'icheck-me Cutlass-input-radio-single') %>
11
+ <%= b.label %>
12
+ </div>
13
+ <% end %>
14
+ </div>
@@ -1,3 +1,3 @@
1
1
  module CutlassJsRails
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
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.5
4
+ version: 0.1.6
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-31 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -57,6 +57,7 @@ files:
57
57
  - app/assets/stylesheets/_cutlass.scss
58
58
  - app/views/cutlass/_date_field.html.erb
59
59
  - app/views/cutlass/_link_field.html.erb
60
+ - app/views/cutlass/_radio_field.html.erb
60
61
  - app/views/cutlass/_select_field.html.erb
61
62
  - app/views/cutlass/_text_field.html.erb
62
63
  - app/views/cutlass/_toggle_field.html.erb