effective_bootstrap 0.9.14 → 0.9.19

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
  SHA256:
3
- metadata.gz: e313590d625cda7f01ce3ef74c94b204bd8459dc59d7d416dae88766756307bc
4
- data.tar.gz: a16aea2233b4a3ad497017b73383af5223fcf1b112670135ed900eff7266a115
3
+ metadata.gz: 04b7e635983b64f81aecbaf7d6c716f0d908d1685a643b2e88d1f335e2cfe679
4
+ data.tar.gz: 3441003e31c25feb10896739a58373f2e9f0b81d640413a1c6043196df5e7429
5
5
  SHA512:
6
- metadata.gz: 7d805f8d09225797f736d6fb82d762b0f592eeeda68fb02a0e3769675deea349dae569c3081bbdbfa52944156af3500a2b56007fc6f9bb4b79ce6f9d3fdfe987
7
- data.tar.gz: dd2d509c84b4eea2fac7135ed105cb7971fe4a7a4c59b85a084fe2463627145a751eaa4b43d3a1101e1ab3af5244544d86bac05f7efed1f5846bc5664f122843
6
+ metadata.gz: 03f84fa9001e3dbe3844d9d4d1d811d0369d3020ee367b3297bd1639dfe42f2b9a184c7047e2286eff65af730f005c629c6cbc110472f1e3aab9df6b9d6b0c4f
7
+ data.tar.gz: 4095a858d118ebe4b31b0195afcc57ca2078b3a3c8cdd2eb930f93e68af7bd03aa355d3f86fc256e057e2ef5f70ea0e2a241ca4be3eb89385f851a95d4f4e379
@@ -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
 
@@ -1,9 +1,9 @@
1
1
  # Prevent non-currency buttons from being pressed
2
- $(document).on 'click', 'button[data-effective-password]', (event) ->
2
+ $(document).on 'click', 'span[data-effective-password]', (event) ->
3
3
  $obj = $(event.currentTarget)
4
4
  $input = $obj.closest('.input-group')
5
5
 
6
6
  $input.find('input').attr('type', $obj.data('effective-password'))
7
- $input.find('button[data-effective-password]').toggle()
7
+ $input.find('span[data-effective-password]').toggle()
8
8
 
9
9
  false
@@ -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
@@ -11,12 +11,12 @@ module Effective
11
11
  end
12
12
 
13
13
  def eyes
14
- content_tag(:button, icon('eye'),
14
+ content_tag(:span, icon('eye'),
15
15
  class: 'btn input-group-text',
16
16
  title: 'Show password',
17
17
  'data-effective-password': 'text'
18
18
  ) +
19
- content_tag(:button, icon('eye-off'),
19
+ content_tag(:span, icon('eye-off'),
20
20
  class: 'btn input-group-text',
21
21
  title: 'Hide password',
22
22
  style: 'display: none;',
@@ -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.14'.freeze
2
+ VERSION = '0.9.19'.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.14
4
+ version: 0.9.19
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-19 00:00:00.000000000 Z
11
+ date: 2021-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -615,7 +615,6 @@ files:
615
615
  - app/helpers/effective_editor_helper.rb
616
616
  - app/helpers/effective_form_builder_helper.rb
617
617
  - app/helpers/effective_icons_helper.rb
618
- - app/models/effective/access_denied.rb
619
618
  - app/models/effective/form_builder.rb
620
619
  - app/models/effective/form_input.rb
621
620
  - app/models/effective/form_inputs/check_box.rb
@@ -1,17 +0,0 @@
1
- unless defined?(Effective::AccessDenied)
2
- module Effective
3
- class AccessDenied < StandardError
4
- attr_reader :action, :subject
5
-
6
- def initialize(message = nil, action = nil, subject = nil)
7
- @message = message
8
- @action = action
9
- @subject = subject
10
- end
11
-
12
- def to_s
13
- @message || I18n.t(:'unauthorized.default', :default => 'Access Denied')
14
- end
15
- end
16
- end
17
- end