effective_bootstrap 0.9.44 → 0.9.48

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/effective_bootstrap/logic.js.coffee +9 -10
  3. data/app/models/effective/form_input.rb +17 -2
  4. data/app/models/effective/form_inputs/article_editor.rb +2 -0
  5. data/app/models/effective/form_inputs/check_box.rb +2 -0
  6. data/app/models/effective/form_inputs/checks.rb +2 -0
  7. data/app/models/effective/form_inputs/ck_editor.rb +2 -0
  8. data/app/models/effective/form_inputs/clear.rb +2 -0
  9. data/app/models/effective/form_inputs/collection_input.rb +2 -0
  10. data/app/models/effective/form_inputs/date_field.rb +2 -0
  11. data/app/models/effective/form_inputs/datetime_field.rb +2 -0
  12. data/app/models/effective/form_inputs/delete.rb +2 -0
  13. data/app/models/effective/form_inputs/editor.rb +2 -0
  14. data/app/models/effective/form_inputs/email_cc_field.rb +2 -0
  15. data/app/models/effective/form_inputs/email_field.rb +2 -0
  16. data/app/models/effective/form_inputs/error_field.rb +3 -1
  17. data/app/models/effective/form_inputs/file_field.rb +2 -0
  18. data/app/models/effective/form_inputs/float_field.rb +2 -0
  19. data/app/models/effective/form_inputs/form_group.rb +2 -0
  20. data/app/models/effective/form_inputs/has_many.rb +2 -0
  21. data/app/models/effective/form_inputs/hidden_field.rb +2 -0
  22. data/app/models/effective/form_inputs/integer_field.rb +2 -0
  23. data/app/models/effective/form_inputs/number_field.rb +2 -0
  24. data/app/models/effective/form_inputs/number_text_field.rb +2 -0
  25. data/app/models/effective/form_inputs/password_field.rb +2 -0
  26. data/app/models/effective/form_inputs/percent_field.rb +2 -0
  27. data/app/models/effective/form_inputs/phone_field.rb +2 -0
  28. data/app/models/effective/form_inputs/price_field.rb +2 -0
  29. data/app/models/effective/form_inputs/radios.rb +2 -0
  30. data/app/models/effective/form_inputs/remote_link_to.rb +2 -0
  31. data/app/models/effective/form_inputs/reset.rb +2 -0
  32. data/app/models/effective/form_inputs/rich_text_area.rb +2 -0
  33. data/app/models/effective/form_inputs/save.rb +2 -0
  34. data/app/models/effective/form_inputs/search_field.rb +2 -0
  35. data/app/models/effective/form_inputs/select.rb +2 -0
  36. data/app/models/effective/form_inputs/select_or_text.rb +2 -0
  37. data/app/models/effective/form_inputs/static_field.rb +2 -0
  38. data/app/models/effective/form_inputs/submit.rb +4 -1
  39. data/app/models/effective/form_inputs/text_area.rb +2 -0
  40. data/app/models/effective/form_inputs/text_field.rb +2 -0
  41. data/app/models/effective/form_inputs/time_field.rb +2 -0
  42. data/app/models/effective/form_inputs/time_zone_select.rb +2 -0
  43. data/app/models/effective/form_inputs/url_field.rb +2 -0
  44. data/app/models/effective/form_logics/hide_if.rb +2 -0
  45. data/app/models/effective/form_logics/show_if.rb +2 -0
  46. data/app/models/effective/form_logics/show_if_any.rb +2 -0
  47. data/lib/effective_bootstrap/version.rb +1 -1
  48. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '092f884d4e2928c9cda4247f62caeba2dc0a7b7e7c56b42a4292d611c5d62ee1'
4
- data.tar.gz: 8059eaec1762f8846cc1d16d668d0e29dd5fa4e7b27edfbb91434c1f9e8d70f0
3
+ metadata.gz: da46c75a27275d4efcc243c43a23aa48cb648d1468504455401ff0f0cfd1b359
4
+ data.tar.gz: 8bbe1fbf6fb3fc4c5ae9f629f70b68a35688c9607c1d3567eaa6237b30271a66
5
5
  SHA512:
6
- metadata.gz: f9a5de0079ce76d9fe570233344b892ddb8b56407611cb231dbefe9e46c996894a73f3a48f0df377269a0fbd5472ee8bcbb7fae19968da52f50ff3b1ca0b7926
7
- data.tar.gz: af189c0bd213dd06adb690673221582d47838ef9ab711e03fc9058c70a8938bfef2da2d6a8c38e14a74c1e4b99f6cc98b004e21e9477355c22c9091fef21ba5b
6
+ metadata.gz: b04511ccc048cffc701deb7e60c4a282288b3916fd8aaeb6cd9a401436d29b02c2526024413e179731022e75b2a36a05152905c75d64be0ee4e36236b0035242
7
+ data.tar.gz: ea6241b0a004f16a6ebd2c61303cd3b7b3944cfff3f327d6871556864f3ca3cec84685eed559811ae05604b24d76d96264c0d5e2e96da638049c310f3716b799
@@ -11,14 +11,14 @@
11
11
 
12
12
  if matches
13
13
  $element.hide()
14
- $element.find('input,textarea,select').prop('disabled', true)
14
+ $element.find('input,textarea,select,button').prop('disabled', true)
15
15
  else
16
16
  $element.fadeIn()
17
- $element.find('input,textarea,select').removeAttr('disabled')
17
+ $element.find('input,textarea,select,button').removeAttr('disabled')
18
18
 
19
19
  # Maybe disable it now
20
20
  if options.needDisable
21
- $element.find('input,textarea,select').prop('disabled', true)
21
+ $element.find('input,textarea,select,button').prop('disabled', true)
22
22
 
23
23
 
24
24
  (this.EffectiveBootstrap || {}).effective_show_if = ($element, options) ->
@@ -34,14 +34,14 @@
34
34
 
35
35
  if matches
36
36
  $element.fadeIn()
37
- $element.find('input,textarea,select').removeAttr('disabled')
37
+ $element.find('input,textarea,select,button').removeAttr('disabled')
38
38
  else
39
39
  $element.hide()
40
- $element.find('input,textarea,select').prop('disabled', true)
40
+ $element.find('input,textarea,select,button').prop('disabled', true)
41
41
 
42
42
  # Maybe disable it now
43
43
  if options.needDisable
44
- $element.find('input,textarea,select').prop('disabled', true)
44
+ $element.find('input,textarea,select,button').prop('disabled', true)
45
45
 
46
46
  (this.EffectiveBootstrap || {}).effective_show_if_any = ($element, options) ->
47
47
  $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")
@@ -53,12 +53,11 @@
53
53
 
54
54
  if found
55
55
  $element.fadeIn()
56
- $element.find('input,textarea,select').removeAttr('disabled')
56
+ $element.find('input,textarea,select,button').removeAttr('disabled')
57
57
  else
58
58
  $element.hide()
59
- $element.find('input,textarea,select').prop('disabled', true)
59
+ $element.find('input,textarea,select,button').prop('disabled', true)
60
60
 
61
61
  # Maybe disable it now
62
62
  if options.needDisable
63
- $element.find('input,textarea,select').prop('disabled', true)
64
-
63
+ $element.find('input,textarea,select,button').prop('disabled', true)
@@ -8,7 +8,7 @@ module Effective
8
8
  EMPTY_HASH = {}
9
9
 
10
10
  EXCLUSIVE_CLASS_PREFIXES = [] # None
11
- EXCLUSIVE_CLASS_SUFFIXES = ['-primary', '-secondary', '-success', '-danger', '-warning', '-info', '-light', '-dark']
11
+ EXCLUSIVE_CLASS_SUFFIXES = ['-primary', '-secondary', '-success', '-danger', '-warning', '-info', '-light', '-dark', '-link']
12
12
 
13
13
  DEFAULT_INPUT_GROUP_OPTIONS = { input_group: { class: 'input-group' }, prepend: false, append: false }
14
14
 
@@ -371,7 +371,22 @@ module Effective
371
371
  when String
372
372
  defaults.merge(text: obj)
373
373
  when Hash
374
- obj.reverse_merge!(defaults); obj
374
+ html_classes = ((obj[:class] || '').split(' ') + (defaults[:class] || '').split(' ')).uniq
375
+
376
+ # Try to smart merge bootstrap classes
377
+ if (exclusive = html_classes.select { |c| c.include?('-') }).length > 1
378
+ EXCLUSIVE_CLASS_PREFIXES.each do |prefix|
379
+ prefixed = exclusive.select { |c| c.start_with?(prefix) }
380
+ prefixed[1..-1].each { |c| html_classes.delete(c) } if prefixed.length > 1
381
+ end
382
+
383
+ suffixed = exclusive.select { |c| EXCLUSIVE_CLASS_SUFFIXES.any? { |suffix| c.end_with?(suffix) } }
384
+ suffixed[1..-1].each { |c| html_classes.delete(c) } if suffixed.length > 1
385
+ end
386
+
387
+ obj[:class] = html_classes.join(' ') if html_classes.present?
388
+ obj.reverse_merge!(defaults)
389
+ obj
375
390
  else
376
391
  defaults.merge(text: obj.to_s)
377
392
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class ArticleEditor < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class CheckBox < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
 
3
5
  module FormInputs
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class CkEditor < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class Clear < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class CollectionInput < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class DateField < DatetimeField
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class DatetimeField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class Delete < Submit
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class Editor < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class EmailCcField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class EmailField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class ErrorField < Effective::FormInput
@@ -32,7 +34,7 @@ module Effective
32
34
  end
33
35
  )
34
36
 
35
- content_tag(:div, content, options[:input])
37
+ content_tag(:div, content.html_safe, options[:input])
36
38
  end
37
39
 
38
40
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class FileField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class FloatField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class FormGroup < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class HasMany < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class HiddenField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class IntegerField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class NumberField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class NumberTextField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class PasswordField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class PercentField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class PhoneField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class PriceField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select
2
4
 
3
5
  # buttons: true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class RemoteLinkTo < Submit
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class Reset < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class RichTextArea < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class Save < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class SearchField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select
2
4
  # select(object, method, choices = nil, options = {}, html_options = {}, &block)
3
5
  # ActionView::Helpers::FormBuilder.instance_method(:check_box).bind(self).call(m, opts, v)`
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class SelectOrText < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class StaticField < Effective::FormInput
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class Submit < Effective::FormInput
4
6
 
5
7
  def to_html(&block)
6
- return super unless (form_readonly? || form_disabled?)
8
+ return nil if form_readonly?
9
+ super()
7
10
  end
8
11
 
9
12
  def build_input(&block)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class TextArea < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class TextField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class TimeField < DatetimeField
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class TimeZoneSelect < Select
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormInputs
3
5
  class UrlField < Effective::FormInput
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormLogics
3
5
  class HideIf < Effective::FormLogic
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormLogics
3
5
  class ShowIf < Effective::FormLogic
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  module FormLogics
3
5
  class ShowIfAny < Effective::FormLogic
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.44'.freeze
2
+ VERSION = '0.9.48'.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.44
4
+ version: 0.9.48
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-09-29 00:00:00.000000000 Z
11
+ date: 2021-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails