effective_bootstrap 0.9.16 → 0.9.21
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 +4 -4
- data/app/assets/javascripts/effective_has_many/initialize.js.coffee +2 -2
- data/app/assets/javascripts/effective_password/initialize.js.coffee +2 -2
- data/app/helpers/effective_bootstrap_helper.rb +56 -1
- data/app/models/effective/form_inputs/file_field.rb +4 -0
- data/app/models/effective/form_inputs/has_many.rb +1 -1
- data/app/models/effective/form_inputs/password_field.rb +2 -2
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +2 -3
- data/app/models/effective/access_denied.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d047c5108e24b36af0b9269cea370b61afaae229174b8b3febf59c95fdca14f7
|
4
|
+
data.tar.gz: 75f25ac6d8dc18e6f4b4462a6eb16b237c4aa6898d19c2686348241b8337da0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09531a9a125e7d7aebec11aa7fe41ef563ccc5f1777dc04cb02603ec8edb0d3384ba86d5f3c79aefe5d64b45a72dd4ded0c098fe6593c4347f080c8faaca237f'
|
7
|
+
data.tar.gz: 349e700ff1f0324dd51f81ecb134774720f0de7197d0c1da4684388a67314828c4a211e903a26b279e8adb25b451629632123ac12204a51380738c7f0dac7a67
|
@@ -3,7 +3,7 @@ assignPositions = (target) ->
|
|
3
3
|
return unless $hasMany.length > 0
|
4
4
|
|
5
5
|
$fields = $hasMany.children('.has-many-fields:not(.marked-for-destruction)')
|
6
|
-
positions = $fields.find("input[name$='[position]']").map(-> this.value).get()
|
6
|
+
positions = $fields.find("input[name$='[position]'][type=hidden]").map(-> this.value).get()
|
7
7
|
|
8
8
|
if positions.length > 0
|
9
9
|
index = Math.min.apply(Math, positions) || 0
|
@@ -35,7 +35,7 @@ $(document).on 'click', '[data-effective-form-has-many-add]', (event) ->
|
|
35
35
|
return unless $hasMany.length > 0
|
36
36
|
|
37
37
|
uid = (new Date).valueOf()
|
38
|
-
template = $obj.data('effective-form-has-many-template').replace(/HASMANYINDEX/g, uid)
|
38
|
+
template = atob($obj.data('effective-form-has-many-template')).replace(/HASMANYINDEX/g, uid)
|
39
39
|
|
40
40
|
$fields = $(template).hide().fadeIn('fast')
|
41
41
|
EffectiveBootstrap.initialize($fields)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# Prevent non-currency buttons from being pressed
|
2
|
-
$(document).on 'click', '
|
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('
|
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
|
@@ -381,7 +411,9 @@ module EffectiveBootstrapHelper
|
|
381
411
|
|
382
412
|
@_tab_active = nil if @_tab_active == :first
|
383
413
|
|
384
|
-
if @_tab_mode == :
|
414
|
+
if @_tab_mode == :tablist_vertical
|
415
|
+
content_tag(:a, label, id: ('tab-' + controls), class: ['nav-link', ('active' if active)].compact.join(' '), href: '#' + controls, 'aria-controls': controls, 'aria-selected': active.to_s, 'data-toggle': 'tab', role: 'tab')
|
416
|
+
elsif @_tab_mode == :tablist # Inserting the label into the tablist top
|
385
417
|
content_tag(:li, class: 'nav-item') do
|
386
418
|
content_tag(:a, label, id: ('tab-' + controls), class: ['nav-link', ('active' if active)].compact.join(' '), href: '#' + controls, 'aria-controls': controls, 'aria-selected': active.to_s, 'data-toggle': 'tab', role: 'tab')
|
387
419
|
end
|
@@ -393,6 +425,29 @@ module EffectiveBootstrapHelper
|
|
393
425
|
end
|
394
426
|
end
|
395
427
|
|
428
|
+
def vertical_tabs(active: nil, unique: false, list: {}, content: {}, &block)
|
429
|
+
raise 'expected a block' unless block_given?
|
430
|
+
|
431
|
+
@_tab_mode = :tablist_vertical
|
432
|
+
@_tab_active = (active || :first)
|
433
|
+
@_tab_unique = ''.object_id if unique
|
434
|
+
|
435
|
+
content_tag(:div, class: 'row border') do
|
436
|
+
content_tag(:div, class: 'col-3 border-right') do
|
437
|
+
content_tag(:div, {class: 'nav flex-column nav-pills my-2', role: 'tablist', 'aria-orientation': :vertical}.merge(list)) do
|
438
|
+
yield # Yield to tab the first time
|
439
|
+
end
|
440
|
+
end +
|
441
|
+
content_tag(:div, class: 'col-9') do
|
442
|
+
content_tag(:div, {class: 'tab-content my-2'}.merge(content)) do
|
443
|
+
@_tab_mode = :content
|
444
|
+
@_tab_active = (active || :first)
|
445
|
+
yield # Yield to tab the second time
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
396
451
|
def merge_class_key(hash, value)
|
397
452
|
return { :class => value } unless hash.kind_of?(Hash)
|
398
453
|
|
@@ -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
|
@@ -150,7 +150,7 @@ module Effective
|
|
150
150
|
html.gsub!("#{name}_attributes][#{index}]", "#{name}_attributes][HASMANYINDEX]")
|
151
151
|
html.gsub!("#{name}_attributes_#{index}_", "#{name}_attributes_HASMANYINDEX_")
|
152
152
|
|
153
|
-
html
|
153
|
+
Base64.encode64(html)
|
154
154
|
end
|
155
155
|
|
156
156
|
def link_to_add(block)
|
@@ -11,12 +11,12 @@ module Effective
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def eyes
|
14
|
-
content_tag(:
|
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(:
|
19
|
+
content_tag(:span, icon('eye-off'),
|
20
20
|
class: 'btn input-group-text',
|
21
21
|
title: 'Hide password',
|
22
22
|
style: 'display: none;',
|
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.
|
4
|
+
version: 0.9.21
|
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-
|
11
|
+
date: 2021-04-06 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
|