effective_bootstrap 0.9.18 → 0.9.23
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/effective_bootstrap/form.js.coffee +7 -1
- 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 +26 -1
- 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: 84fb9a59f18462bbace318d9c5853ced6dee6c062f4279324273810604f515cb
|
4
|
+
data.tar.gz: 19a4ed40baed302df86d56debe8f4502ee75655501b321014c5f89b5ec4b453a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31692a44b3d78b867cca96d69afcc77aa58d43abdd6d8654ba7dab07bab0dbfff9262d41a0b059bcffba5c91b624d7a551cadf33484e78f22b9fa6a8c7d8052a
|
7
|
+
data.tar.gz: e98822e65d9b5d64606b1c5c6fc35d0bdd0a4280567abd1b4e4e5469df92413be576e3d952628d3d60df920a4e6f422cdc555e31c8f34581aaa987e82397b57c
|
@@ -4,6 +4,7 @@ this.EffectiveForm ||= new class
|
|
4
4
|
remote_form_commit: '' # String containing the last params[:commit]
|
5
5
|
remote_form_payload: '' # String containing html from server side render of this form
|
6
6
|
remote_form_flash: '' # Array of Arrays
|
7
|
+
remote_form_redirect: '' # String containing the redirect path (optional)
|
7
8
|
|
8
9
|
validate: (form) ->
|
9
10
|
valid = form.checkValidity()
|
@@ -73,6 +74,11 @@ this.EffectiveForm ||= new class
|
|
73
74
|
$target = $target.closest('form') unless $target.is('form')
|
74
75
|
$form = ''
|
75
76
|
|
77
|
+
if @remote_form_redirect.length > 0
|
78
|
+
window.location.href = @remote_form_redirect
|
79
|
+
@remote_form_redirect = ''
|
80
|
+
return
|
81
|
+
|
76
82
|
if @remote_form_payload.length > 0
|
77
83
|
$payload = $("<div>#{@remote_form_payload}</div>")
|
78
84
|
$form = $payload.find("form[data-remote-index='#{$target.data('remote-index')}']")
|
@@ -160,7 +166,7 @@ this.EffectiveForm ||= new class
|
|
160
166
|
# This displays the spinner here, and directs any flash messages before and after loadRemoteForm
|
161
167
|
$(document).on 'click', '.form-actions a[data-remote],.form-actions button[type=submit]', (event) ->
|
162
168
|
EffectiveForm.setCurrentSubmit($(@).parent())
|
163
|
-
EffectiveForm.spin()
|
169
|
+
EffectiveForm.spin() unless $(@).attr('data-confirm')
|
164
170
|
|
165
171
|
# This actually attached the handlers to a remote ajax form when it or an action inside it triggers a remote thing.
|
166
172
|
$(document).on 'ajax:beforeSend', 'form[data-remote]', (event) ->
|
@@ -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
|
@@ -411,7 +411,9 @@ module EffectiveBootstrapHelper
|
|
411
411
|
|
412
412
|
@_tab_active = nil if @_tab_active == :first
|
413
413
|
|
414
|
-
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
|
415
417
|
content_tag(:li, class: 'nav-item') do
|
416
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')
|
417
419
|
end
|
@@ -423,6 +425,29 @@ module EffectiveBootstrapHelper
|
|
423
425
|
end
|
424
426
|
end
|
425
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
|
+
|
426
451
|
def merge_class_key(hash, value)
|
427
452
|
return { :class => value } unless hash.kind_of?(Hash)
|
428
453
|
|
@@ -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.23
|
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-08 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
|