effective_bootstrap 0.9.13 → 0.9.18

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
  SHA256:
3
- metadata.gz: e330704dd9363570d7981034a08e14d29347feae21c7374ce073e322ea6cd5ea
4
- data.tar.gz: d618f09047887bec221b95eb3af1b47be80d3914505f82a88e81d7d138e149a6
3
+ metadata.gz: bad50c3276e435e5730f729a93ab282f6ff57cc11c3df4219bfa769c5e446cca
4
+ data.tar.gz: '0399b4c016e38fbe31d8da8ff13a49d10d3fca5b6b5e944c78a0d57f3564b42f'
5
5
  SHA512:
6
- metadata.gz: c0ac3afa88825a5af188d069a7a9a41a4ab677890068408d80fd39a62928306e9172a81d4dd0dc20e586d0f2755e172e78a07eaedc138c92bf2e318f3a8d4d2a
7
- data.tar.gz: 332482707c9bf94e22c7be4e04a16ad2367a4bdb8fac87f11d8240b6e5591af9471e9880586211c92db6c40dbf47238ac026b5f4a06e6d0ffb68f07d7ccf0467
6
+ metadata.gz: 27f5f04c6bee48b3ec5716e600f00a71a1d9607fae017620eaf413bedee1fd7d2b9dc076866f15c733e79fd5fcf9ed53744fdff6d302c5ad11655caedea192ad
7
+ data.tar.gz: fbf36f3b698711721b799f30650f1d930dc5ac7037d95889c5cb3a8ce8de60f2692bc42d230f6182a0fac235aa6677eaa15b1a5682a00793d33ef2c608cb8ac8
@@ -18,6 +18,7 @@
18
18
  //= require ./effective_has_many/input
19
19
  //= require ./effective_integer/input
20
20
  //= require ./effective_number_text/input
21
+ //= require ./effective_password/input
21
22
  //= require ./effective_percent/input
22
23
  //= require ./effective_phone/input
23
24
  //= require ./effective_price/input
@@ -48,6 +48,8 @@ $(document).on 'click', '[data-effective-form-has-many-remove]', (event) ->
48
48
  event.preventDefault()
49
49
 
50
50
  $obj = $(event.currentTarget)
51
+ return unless $obj.data('confirmed') if $obj.data('confirm')
52
+
51
53
  $hasMany = $obj.closest('.form-has-many')
52
54
  return unless $hasMany.length > 0
53
55
 
@@ -0,0 +1,9 @@
1
+ # Prevent non-currency buttons from being pressed
2
+ $(document).on 'click', 'button[data-effective-password]', (event) ->
3
+ $obj = $(event.currentTarget)
4
+ $input = $obj.closest('.input-group')
5
+
6
+ $input.find('input').attr('type', $obj.data('effective-password'))
7
+ $input.find('button[data-effective-password]').toggle()
8
+
9
+ false
@@ -0,0 +1 @@
1
+ //= require ./initialize
@@ -18,6 +18,36 @@ module EffectiveBootstrapHelper
18
18
  content
19
19
  end
20
20
 
21
+ # https://getbootstrap.com/docs/4.0/components/card/
22
+ # = card('title do')
23
+ # %p Stuff
24
+ # = card('Stuff', header: 'header title')
25
+ def card(value = nil, opts = {}, &block)
26
+ raise('expected a block') unless block_given?
27
+
28
+ if value.kind_of?(Hash)
29
+ opts = value; value = nil
30
+ end
31
+
32
+ header = opts.delete(:header)
33
+ title = opts.delete(:title) || value
34
+
35
+ content_tag(:div, merge_class_key(opts, 'card mb-4')) do
36
+ header = content_tag(:div, header, class: 'card-header') if header.present?
37
+
38
+ body = content_tag(:div, class: 'card-body') do
39
+ if title.present?
40
+ content_tag(:h5, title, class: 'card-title') + capture(&block)
41
+ else
42
+ capture(&block)
43
+ end
44
+ end
45
+
46
+ header ? (header + body) : body
47
+ end
48
+ end
49
+
50
+
21
51
  # https://getbootstrap.com/docs/4.0/components/collapse/
22
52
 
23
53
  # = collapse('toggle visibility') do
@@ -75,6 +75,8 @@ module Effective
75
75
 
76
76
  def build_table_attachment(attachment)
77
77
  url = (@template.url_for(attachment) rescue false)
78
+ url ||= (Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true) rescue false)
79
+
78
80
  return unless url
79
81
 
80
82
  image_tag = content_tag(:img, '', class: '', src: url, alt: attachment.filename.to_s) if attachment.image?
@@ -98,6 +100,8 @@ module Effective
98
100
 
99
101
  def build_card_attachment(attachment)
100
102
  url = (@template.url_for(attachment) rescue false)
103
+ url ||= (Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true) rescue false)
104
+
101
105
  return unless url
102
106
 
103
107
  content_tag(:div, class: 'col') do
@@ -117,7 +117,7 @@ module Effective
117
117
  fields
118
118
  end
119
119
 
120
- remove += link_to_remove(resource) if remove?
120
+ remove += link_to_remove(resource) if (remove? || resource.new_record?)
121
121
 
122
122
  content_tag(:div, render_fields(content, remove), class: 'has-many-fields')
123
123
  end
@@ -3,11 +3,25 @@ module Effective
3
3
  class PasswordField < Effective::FormInput
4
4
 
5
5
  def input_html_options
6
- { class: 'form-control', id: tag_id }
6
+ { class: 'form-control effective_password', id: tag_id }
7
7
  end
8
8
 
9
9
  def input_group_options
10
- { input_group: { class: 'input-group' }, prepend: content_tag(:span, icon('lock'), class: 'input-group-text') }
10
+ { input_group: { class: 'input-group' }, append: eyes }
11
+ end
12
+
13
+ def eyes
14
+ content_tag(:button, icon('eye'),
15
+ class: 'btn input-group-text',
16
+ title: 'Show password',
17
+ 'data-effective-password': 'text'
18
+ ) +
19
+ content_tag(:button, icon('eye-off'),
20
+ class: 'btn input-group-text',
21
+ title: 'Hide password',
22
+ style: 'display: none;',
23
+ 'data-effective-password': 'password'
24
+ )
11
25
  end
12
26
 
13
27
  def feedback_options
@@ -1,6 +1,7 @@
1
1
  module Effective
2
2
  module FormInputs
3
3
  class TextField < Effective::FormInput
4
+
4
5
  end
5
6
  end
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.13'.freeze
2
+ VERSION = '0.9.18'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.13
4
+ version: 0.9.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-16 00:00:00.000000000 Z
11
+ date: 2021-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -440,6 +440,8 @@ files:
440
440
  - app/assets/javascripts/effective_integer/input.js
441
441
  - app/assets/javascripts/effective_number_text/initialize.js.coffee
442
442
  - app/assets/javascripts/effective_number_text/input.js
443
+ - app/assets/javascripts/effective_password/initialize.js.coffee
444
+ - app/assets/javascripts/effective_password/input.js
443
445
  - app/assets/javascripts/effective_percent/initialize.js.coffee
444
446
  - app/assets/javascripts/effective_percent/input.js
445
447
  - app/assets/javascripts/effective_phone/initialize.js.coffee