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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bad50c3276e435e5730f729a93ab282f6ff57cc11c3df4219bfa769c5e446cca
4
- data.tar.gz: '0399b4c016e38fbe31d8da8ff13a49d10d3fca5b6b5e944c78a0d57f3564b42f'
3
+ metadata.gz: 84fb9a59f18462bbace318d9c5853ced6dee6c062f4279324273810604f515cb
4
+ data.tar.gz: 19a4ed40baed302df86d56debe8f4502ee75655501b321014c5f89b5ec4b453a
5
5
  SHA512:
6
- metadata.gz: 27f5f04c6bee48b3ec5716e600f00a71a1d9607fae017620eaf413bedee1fd7d2b9dc076866f15c733e79fd5fcf9ed53744fdff6d302c5ad11655caedea192ad
7
- data.tar.gz: fbf36f3b698711721b799f30650f1d930dc5ac7037d95889c5cb3a8ce8de60f2692bc42d230f6182a0fac235aa6677eaa15b1a5682a00793d33ef2c608cb8ac8
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', '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
@@ -411,7 +411,9 @@ module EffectiveBootstrapHelper
411
411
 
412
412
  @_tab_active = nil if @_tab_active == :first
413
413
 
414
- if @_tab_mode == :tablist # Inserting the label into the tablist top
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.html_safe
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(: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,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.18'.freeze
2
+ VERSION = '0.9.23'.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.18
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-03-10 00:00:00.000000000 Z
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