ui_bibz 2.0.0 → 2.0.1

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +68 -60
  3. data/app/assets/javascripts/input-connected.coffee +2 -0
  4. data/app/assets/javascripts/interface.coffee +12 -3
  5. data/app/assets/javascripts/ui_bibz.coffee +18 -21
  6. data/app/assets/stylesheets/_custom_variables.sass +3 -3
  7. data/app/assets/stylesheets/_panel.scss +1 -1
  8. data/app/assets/stylesheets/forms.sass +3 -5
  9. data/app/assets/stylesheets/navigations.sass +3 -0
  10. data/app/assets/stylesheets/notifications.sass +7 -0
  11. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +15 -6
  12. data/lib/ui_bibz/inputs/ui_bibz_inputs/base_input.rb +1 -1
  13. data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +1 -1
  14. data/lib/ui_bibz/inputs/ui_bibz_inputs/string_input.rb +1 -7
  15. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_text_field_input.rb +1 -1
  16. data/lib/ui_bibz/rails/engine.rb +7 -0
  17. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +2 -2
  18. data/lib/ui_bibz/ui/core/component.rb +4 -4
  19. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +8 -1
  20. data/lib/ui_bibz/ui/core/navigations/components/nav_link.rb +7 -1
  21. data/lib/ui_bibz/ui/core/navigations/components/nav_link_span.rb +51 -0
  22. data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +2 -2
  23. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +1 -1
  24. data/lib/ui_bibz/ui/core/notifications/alert.rb +6 -0
  25. data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +4 -4
  26. data/lib/ui_bibz/version.rb +1 -1
  27. data/lib/ui_bibz.rb +27 -0
  28. data/test/dummy/config/environments/test.rb +1 -0
  29. data/test/ui/core/boxes/card_test.rb +1 -1
  30. data/test/ui/core/navigations/navbar_test.rb +1 -1
  31. data/test/ui/core/notifications/alert_test.rb +7 -0
  32. data/test/ui/ux/tables/table_test.rb +7 -6
  33. data/ui_bibz.gemspec +0 -1
  34. data/vendor/assets/javascripts/jquery-ui.min.js +5 -3
  35. data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.css +327 -0
  36. data/vendor/assets/stylesheets/jquery-ui.css +609 -0
  37. metadata +6 -5
  38. data/lib/ui_bibz/inputs/ui_bibz_inputs/auto_complete_field_input.rb +0 -14
  39. data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.scss +0 -270
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07662ea2bbdb71ec3c7d92bbb7c3beaafd9fc672
4
- data.tar.gz: 89234714adcd3d87a25fa698725de106e20bd5d3
3
+ metadata.gz: 9f43bb10fac13d2823e385b38bd8b32ca2e1b87d
4
+ data.tar.gz: 0be25ec589d432d7f22921ed689fa4a88b5c5667
5
5
  SHA512:
6
- metadata.gz: b6e3125f6d110ff18f57ec5f075c53d8c05a50e121b80fe7086e2bb462d7c443019f4f7bf7510cd22775e0b904d102e8925b464480867f3dc91c98ac2cba25eb
7
- data.tar.gz: e11e9e5bf48a924f9d9cb054a42358ce37886e605cf871113788edbdc2bc1e13f5c7f8b458cba02040a25622aaba158ff70ada998340750e017b1165e5d8ea7c
6
+ metadata.gz: 68dab72ac5152cdec6c232d83ae2405327fef4fff83e52e8239c167a8389ca283661185be6644c3a0d7a6feb8ec9951840c923210999066ecae97f924ca039d4
7
+ data.tar.gz: 2a5d3cd2577cdd69c63b181f71196bcf66e6dea7f2c97399648832603954c02fff0348b5d6681f033ead02564f12ec8ba5a0edd7a3fae3b492955c21326f0df7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (2.0.0)
4
+ ui_bibz (2.0.1)
5
5
  bootstrap (= 4.0.0)
6
6
  font-awesome-sass
7
7
  haml
@@ -16,45 +16,49 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- actioncable (5.1.5)
20
- actionpack (= 5.1.5)
19
+ actioncable (5.2.0)
20
+ actionpack (= 5.2.0)
21
21
  nio4r (~> 2.0)
22
- websocket-driver (~> 0.6.1)
23
- actionmailer (5.1.5)
24
- actionpack (= 5.1.5)
25
- actionview (= 5.1.5)
26
- activejob (= 5.1.5)
22
+ websocket-driver (>= 0.6.1)
23
+ actionmailer (5.2.0)
24
+ actionpack (= 5.2.0)
25
+ actionview (= 5.2.0)
26
+ activejob (= 5.2.0)
27
27
  mail (~> 2.5, >= 2.5.4)
28
28
  rails-dom-testing (~> 2.0)
29
- actionpack (5.1.5)
30
- actionview (= 5.1.5)
31
- activesupport (= 5.1.5)
29
+ actionpack (5.2.0)
30
+ actionview (= 5.2.0)
31
+ activesupport (= 5.2.0)
32
32
  rack (~> 2.0)
33
33
  rack-test (>= 0.6.3)
34
34
  rails-dom-testing (~> 2.0)
35
35
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
36
- actionview (5.1.5)
37
- activesupport (= 5.1.5)
36
+ actionview (5.2.0)
37
+ activesupport (= 5.2.0)
38
38
  builder (~> 3.1)
39
39
  erubi (~> 1.4)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
42
- activejob (5.1.5)
43
- activesupport (= 5.1.5)
42
+ activejob (5.2.0)
43
+ activesupport (= 5.2.0)
44
44
  globalid (>= 0.3.6)
45
- activemodel (5.1.5)
46
- activesupport (= 5.1.5)
47
- activerecord (5.1.5)
48
- activemodel (= 5.1.5)
49
- activesupport (= 5.1.5)
50
- arel (~> 8.0)
51
- activesupport (5.1.5)
45
+ activemodel (5.2.0)
46
+ activesupport (= 5.2.0)
47
+ activerecord (5.2.0)
48
+ activemodel (= 5.2.0)
49
+ activesupport (= 5.2.0)
50
+ arel (>= 9.0)
51
+ activestorage (5.2.0)
52
+ actionpack (= 5.2.0)
53
+ activerecord (= 5.2.0)
54
+ marcel (~> 0.3.1)
55
+ activesupport (5.2.0)
52
56
  concurrent-ruby (~> 1.0, >= 1.0.2)
53
- i18n (~> 0.7)
57
+ i18n (>= 0.7, < 2)
54
58
  minitest (~> 5.1)
55
59
  tzinfo (~> 1.1)
56
- arel (8.0.0)
57
- autoprefixer-rails (8.1.0)
60
+ arel (9.0.0)
61
+ autoprefixer-rails (8.3.0)
58
62
  execjs
59
63
  awesome_print (1.8.0)
60
64
  bootstrap (4.0.0)
@@ -62,13 +66,13 @@ GEM
62
66
  popper_js (>= 1.12.9, < 2)
63
67
  sass (>= 3.5.2)
64
68
  builder (3.2.3)
65
- byebug (10.0.0)
66
- codeclimate-test-reporter (1.0.7)
67
- simplecov
69
+ byebug (10.0.2)
70
+ codeclimate-test-reporter (1.0.8)
71
+ simplecov (<= 0.13)
68
72
  concurrent-ruby (1.0.5)
69
- crass (1.0.3)
73
+ crass (1.0.4)
70
74
  docile (1.1.5)
71
- erubi (1.7.0)
75
+ erubi (1.7.1)
72
76
  erubis (2.7.0)
73
77
  execjs (2.7.0)
74
78
  factory_bot (4.8.2)
@@ -77,7 +81,7 @@ GEM
77
81
  factory_bot (~> 4.8.2)
78
82
  railties (>= 3.0.0)
79
83
  ffi (1.9.23)
80
- font-awesome-sass (5.0.6.2)
84
+ font-awesome-sass (5.0.9)
81
85
  sass (>= 3.2)
82
86
  globalid (0.4.1)
83
87
  activesupport (>= 4.2.0)
@@ -95,59 +99,63 @@ GEM
95
99
  haml (>= 4.0, < 6)
96
100
  nokogiri (>= 1.6.0)
97
101
  ruby_parser (~> 3.5)
98
- i18n (0.9.5)
102
+ i18n (1.0.1)
99
103
  concurrent-ruby (~> 1.0)
100
- jquery-rails (4.3.1)
104
+ jquery-rails (4.3.3)
101
105
  rails-dom-testing (>= 1, < 3)
102
106
  railties (>= 4.2.0)
103
107
  thor (>= 0.14, < 2.0)
104
108
  json (2.1.0)
105
- loofah (2.2.0)
109
+ loofah (2.2.2)
106
110
  crass (~> 1.0.2)
107
111
  nokogiri (>= 1.5.9)
108
112
  mail (2.7.0)
109
113
  mini_mime (>= 0.1.1)
114
+ marcel (0.3.2)
115
+ mimemagic (~> 0.3.2)
110
116
  method_source (0.9.0)
117
+ mimemagic (0.3.2)
111
118
  mini_mime (1.0.0)
112
119
  mini_portile2 (2.3.0)
113
120
  minitest (5.11.3)
114
- nio4r (2.2.0)
121
+ nio4r (2.3.0)
115
122
  nokogiri (1.8.2)
116
123
  mini_portile2 (~> 2.3.0)
117
124
  popper_js (1.12.9)
118
- rack (2.0.4)
119
- rack-test (0.8.3)
125
+ rack (2.0.5)
126
+ rack-test (1.0.0)
120
127
  rack (>= 1.0, < 3)
121
- rails (5.1.5)
122
- actioncable (= 5.1.5)
123
- actionmailer (= 5.1.5)
124
- actionpack (= 5.1.5)
125
- actionview (= 5.1.5)
126
- activejob (= 5.1.5)
127
- activemodel (= 5.1.5)
128
- activerecord (= 5.1.5)
129
- activesupport (= 5.1.5)
128
+ rails (5.2.0)
129
+ actioncable (= 5.2.0)
130
+ actionmailer (= 5.2.0)
131
+ actionpack (= 5.2.0)
132
+ actionview (= 5.2.0)
133
+ activejob (= 5.2.0)
134
+ activemodel (= 5.2.0)
135
+ activerecord (= 5.2.0)
136
+ activestorage (= 5.2.0)
137
+ activesupport (= 5.2.0)
130
138
  bundler (>= 1.3.0)
131
- railties (= 5.1.5)
139
+ railties (= 5.2.0)
132
140
  sprockets-rails (>= 2.0.0)
133
141
  rails-dom-testing (2.0.3)
134
142
  activesupport (>= 4.2.0)
135
143
  nokogiri (>= 1.6)
136
- rails-html-sanitizer (1.0.3)
137
- loofah (~> 2.0)
138
- railties (5.1.5)
139
- actionpack (= 5.1.5)
140
- activesupport (= 5.1.5)
144
+ rails-html-sanitizer (1.0.4)
145
+ loofah (~> 2.2, >= 2.2.2)
146
+ railties (5.2.0)
147
+ actionpack (= 5.2.0)
148
+ activesupport (= 5.2.0)
141
149
  method_source
142
150
  rake (>= 0.8.7)
143
151
  thor (>= 0.18.1, < 2.0)
144
- rake (12.3.0)
152
+ rake (12.3.1)
145
153
  rb-fsevent (0.10.3)
146
154
  rb-inotify (0.9.10)
147
155
  ffi (>= 0.5.0, < 2)
148
156
  ruby_parser (3.11.0)
149
157
  sexp_processor (~> 4.9)
150
- sass (3.5.5)
158
+ sass (3.5.6)
151
159
  sass-listen (~> 4.0.0)
152
160
  sass-listen (4.0.0)
153
161
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -158,11 +166,11 @@ GEM
158
166
  sprockets (>= 2.8, < 4.0)
159
167
  sprockets-rails (>= 2.0, < 4.0)
160
168
  tilt (>= 1.1, < 3)
161
- sexp_processor (4.10.1)
162
- simple_form (3.5.1)
163
- actionpack (> 4, < 5.2)
164
- activemodel (> 4, < 5.2)
165
- simplecov (0.15.1)
169
+ sexp_processor (4.11.0)
170
+ simple_form (4.0.0)
171
+ actionpack (> 4)
172
+ activemodel (> 4)
173
+ simplecov (0.13.0)
166
174
  docile (~> 1.1.0)
167
175
  json (>= 1.8, < 3)
168
176
  simplecov-html (~> 0.10.0)
@@ -181,7 +189,7 @@ GEM
181
189
  tilt (2.0.8)
182
190
  tzinfo (1.2.5)
183
191
  thread_safe (~> 0.1)
184
- websocket-driver (0.6.5)
192
+ websocket-driver (0.7.0)
185
193
  websocket-extensions (>= 0.1.0)
186
194
  websocket-extensions (0.1.3)
187
195
  will-paginate-i18n (0.1.15)
@@ -22,6 +22,8 @@
22
22
  componentTarget.multiSelect('refresh') if componentTarget.hasClass('multi-column-field')
23
23
  componentTarget.selectpicker('refresh') if componentTarget.hasClass('dropdown-select-field')
24
24
  componentTarget.multiselect('rebuild') if componentTarget.hasClass('multi-select-field')
25
+ componentTarget.attr("disabled", false)
26
+ componentTarget.removeClass("disabled")
25
27
  componentTarget.change()
26
28
 
27
29
  updateTargetRefreshButton = (componentTarget, component) ->
@@ -6,11 +6,10 @@
6
6
  @dropdown()
7
7
  @checkbox()
8
8
  @popover()
9
+ @notify()
9
10
 
10
11
  nav: ->
11
- $('.nav-tabs a').click (e) ->
12
- e.preventDefault()
13
- $(this).tab('show')
12
+ $('.nav-tabs nav-link').tab('show')
14
13
 
15
14
  popover: ->
16
15
  $('[data-toggle="popover"]').popover({ html: true })
@@ -22,6 +21,16 @@
22
21
  dropdown: ->
23
22
  $('.dropdown-toggle').dropdown()
24
23
 
24
+ notify: ->
25
+ $('.alert').each ->
26
+ timeoutValue = $(this).data('timeout')
27
+ if timeoutValue?
28
+ me = $(this)
29
+ setTimeout ->
30
+ me.addClass('fade')
31
+ , timeoutValue
32
+
33
+
25
34
  checkbox: ->
26
35
  $('.abc-checkbox.indeterminate input[type=checkbox]').on 'click', ->
27
36
  el = $(this)
@@ -39,24 +39,21 @@
39
39
 
40
40
  @UiBibz = class UiBibz
41
41
 
42
- constructor: ->
43
- @table = new window.UiBibzTable()
44
- @form = new window.UiBibzForm()
45
- @interface = new window.UiBibzInterface()
46
- @formula = new window.UiBibzFormula()
47
- #delete window.UiBibzTable
48
- #delete window.UiBibzForm
49
- #delete window.UiBibzInterface
50
-
51
- ready = ->
52
- new UiBibz
53
- # Fix for turbolinks
54
- $( "textarea[data-provide*='markdown']" ).markdown() # fix markdown js if turbolinks exists
55
-
56
- # turbolinks:load and ready together load twice time javascript
57
- #$(document).on('ready turbolinks:load page:change', ready) # catch event for turbolinks and fix in ready() function
58
- if Turbolinks?
59
- ready()
60
- $(document).on('turbolinks:load page:change', ready) # catch event for turbolinks and fix in ready() function
61
- else
62
- $(document).on('ready', ready) # catch event for turbolinks and fix in ready() function
42
+ constructor: (args = {}) ->
43
+ @turbolinks = args.turbolinks
44
+ return this
45
+
46
+ load: ->
47
+ new window.UiBibzTable()
48
+ new window.UiBibzForm()
49
+ new window.UiBibzInterface()
50
+ new window.UiBibzFormula()
51
+ $( "textarea[data-provide*='markdown']" ).markdown() # fix markdown js if turbolinks exists
52
+ return false
53
+
54
+ ready: ->
55
+ me = this
56
+ if @turbolinks?
57
+ $(document).on('turbolinks:load', me.load) # catch event for turbolinks and fix in ready() function
58
+ else
59
+ $(document).on('ready', me.load)
@@ -5,10 +5,10 @@ $panel-spacer-y: .75rem !default
5
5
  $panel-spacer-x: 1.25rem !default
6
6
  $panel-border-width: $border-width !default
7
7
  $panel-border-radius: $border-radius !default
8
- $panel-border-color: rgba($black, .125) !default
8
+ $panel-border-color: $card-border-color
9
9
  $panel-inner-border-radius: calc(#{$panel-border-radius} - #{$panel-border-width}) !default
10
- $panel-cap-bg: rgba($black, .03) !default
11
- $panel-bg: $white !default
10
+ $panel-cap-bg: $card-cap-bg
11
+ $panel-bg: $card-bg
12
12
 
13
13
  $panel-img-overlay-padding: 1.25rem !default
14
14
 
@@ -42,7 +42,7 @@
42
42
  > .panel-toolbar {
43
43
  border-top: none;
44
44
  padding: $panel-spacer;
45
- background-color: rgba($black, .015);
45
+ background-color: $panel-cap-bg;
46
46
  border-bottom: $panel-border-width solid $panel-border-color;
47
47
  }
48
48
 
@@ -11,7 +11,7 @@
11
11
  border-top-right-radius: 0 !important
12
12
  width: 100%
13
13
  .form-control[readonly]
14
- background-color: white
14
+ background-color: darken($body-bg, 2%)
15
15
  .formula-field_alert, .formula-field-result, .formula-field-sign
16
16
  display: none
17
17
 
@@ -22,8 +22,8 @@
22
22
  .btn
23
23
  padding: 10px 16px
24
24
 
25
- .input-group-addon.abc-checkbox label, .input-group-addon.abc-radio label
26
- margin-bottom: 0
25
+ // .input-group-addon.abc-checkbox label, .input-group-addon.abc-radio label
26
+ // margin-bottom: 0
27
27
 
28
28
  .checkbox-inline, .radio-inline
29
29
  display: inline-block
@@ -44,8 +44,6 @@
44
44
  min-width: 104px
45
45
 
46
46
  .ui_surround_field
47
- select
48
- -webkit-appearance: none
49
47
  .mr-sm-2
50
48
  margin-right: 0px !important
51
49
  input:not(:first-child):not(:last-child)
@@ -9,3 +9,6 @@
9
9
 
10
10
  .progress-bar-line
11
11
  height: 1px
12
+
13
+ .nav-link
14
+ cursor: pointer
@@ -8,3 +8,10 @@
8
8
 
9
9
  .glyph
10
10
  padding: .25rem 0
11
+
12
+ .fa,
13
+ .fas,
14
+ .far,
15
+ .fal,
16
+ .fab
17
+ line-height: 0.7 !important
@@ -1,5 +1,5 @@
1
1
  module UiBibzForm
2
- if defined?(SimpleForm)
2
+ #if defined?(SimpleForm)
3
3
  class UiBibzFormBuilder < SimpleForm::FormBuilder
4
4
  include ActionView::Helpers::TagHelper
5
5
  include ActionView::Helpers::TextHelper
@@ -11,12 +11,21 @@ module UiBibzForm
11
11
  content = (options || {}).merge(content || {})
12
12
  content = content.merge(template: @template, form: self)
13
13
 
14
- input_classes = UiBibz::Utils::Screwdriver.join_classes('form-group', 'surround_field', options[:input_html].try(:[], :class))
15
- wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
14
+ input_classes = UiBibz::Utils::Screwdriver.join_classes('form-group', 'surround_field', options[:input_html].try(:[], :class))
15
+ wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
16
+ surround_field = UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(content, opts, html_options).tap(&block)
17
+ errors_text = surround_field.errors.flatten.to_sentence
18
+ required = surround_field.required_fields.any?{ |u| u == true }
19
+ wrapper_classes = UiBibz::Utils::Screwdriver.join_classes(("has-error" unless errors_text.blank?), wrapper_html.try(:[], :class))
20
+ label_classes = UiBibz::Utils::Screwdriver.join_classes(("required" if required), 'control-label')
21
+ abbr_html = content_tag("abbr", I18n.t(:"simple_form.required.mark", default: '*'), title: I18n.t(:"simple_form.required.text", default: 'required')) if required
22
+
23
+ wrapper_html[:class] = wrapper_classes
16
24
 
17
25
  content_tag :div, wrapper_html do
18
- concat content_tag(:label, content[:label]) unless content[:label].nil?
19
- concat UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(content, opts, html_options).tap(&block).render
26
+ concat content_tag(:label, "#{ abbr_html } #{ content[:label] }".html_safe, class: label_classes) if content[:label]
27
+ concat surround_field.render
28
+ concat content_tag(:span, errors_text || content[:hint], class: 'help-block') if !errors_text.blank? || !content[:hint].nil?
20
29
  end
21
30
  end
22
31
 
@@ -34,5 +43,5 @@ module UiBibzForm
34
43
  end
35
44
 
36
45
  end
37
- end
46
+ #end
38
47
  end
@@ -12,7 +12,7 @@ module UiBibzInputs
12
12
  private
13
13
 
14
14
  def input_attribute_name
15
- "#{ @builder.object.class.to_s.underscore }[#{ attribute_name }]"
15
+ "#{ @builder.object.class.name.gsub('::', "").underscore }[#{ attribute_name }]"
16
16
  end
17
17
 
18
18
  end
@@ -55,7 +55,7 @@ module UiBibzInputs
55
55
  end
56
56
 
57
57
  def input_attribute_name
58
- "#{ @builder.object.class.to_s.parameterize.underscore }[#{ attribute_name }]"
58
+ "#{ @builder.object.class.name.gsub('::', "").underscore }[#{ attribute_name }]"
59
59
  end
60
60
 
61
61
  def collection
@@ -1,5 +1,5 @@
1
1
  module UiBibzInputs
2
- class StringInput < SimpleForm::Inputs::Base
2
+ class StringInput < BaseInput
3
3
 
4
4
  enable :placeholder, :maxlength, :minlength, :pattern
5
5
 
@@ -24,11 +24,5 @@ module UiBibzInputs
24
24
  input_type == :string
25
25
  end
26
26
 
27
- protected
28
-
29
- def input_attribute_name
30
- "#{ @builder.object.class.to_s.parameterize.underscore }[#{ attribute_name }]"
31
- end
32
-
33
27
  end
34
28
  end
@@ -7,7 +7,7 @@ module UiBibzInputs
7
7
  end
8
8
 
9
9
  def input_attribute_name
10
- "#{ @builder.object.class.to_s.parameterize.underscore }[#{ attribute_name }]"
10
+ "#{ @builder.object.class.name.gsub('::', "").underscore }[#{ attribute_name }]"
11
11
  end
12
12
  end
13
13
  end
@@ -13,12 +13,19 @@ module UiBibz
13
13
  initializer "ui_bibz.helpers" do
14
14
  ActionView::Base.send :include, UiBibz::Helpers::UtilsHelper
15
15
  end
16
+
16
17
  initializer "ui_bibz.helpers.ui" do
17
18
  ActionView::Base.send :include, UiBibz::Helpers::Ui::CoreHelper
18
19
  ActionView::Base.send :include, UiBibz::Helpers::Ui::UxHelper
19
20
  end
20
21
 
22
+
21
23
  config.autoload_paths += Dir["#{config.root}/lib/ui_bibz/inputs/**/"] if defined?(::SimpleForm)
24
+ initializer "ui_bibz.helpers.form" do
25
+ ActionView::Base.send :include, UiBibzForm
26
+ #Dir["#{config.root}/lib/ui_bibz/inputs/**/**"].each{ |b| require b } if defined?(::SimpleForm)
27
+ end
28
+
22
29
 
23
30
  end
24
31
  end
@@ -40,8 +40,8 @@ module UiBibz::Ui::Core::Boxes::Components
40
40
 
41
41
  # Render html tag
42
42
  def pre_render
43
- #image_tag asset_path("assets/#{content}"), html_options
44
- image_tag content, html_options
43
+ #image_tag content, html_options
44
+ image_tag asset_path("assets/#{content}"), html_options
45
45
  end
46
46
 
47
47
  private
@@ -98,11 +98,11 @@ module UiBibz::Ui::Core
98
98
  # Override this method to add html data
99
99
  def component_html_data
100
100
  # To stimulusjs
101
- add_html_data :target, options.try(:delete, :target)
102
- add_html_data :controller, options.try(:delete, :controller)
103
- add_html_data :action, options.try(:delete, :action)
101
+ add_html_data :target, html_options.try(:[], :data).try(:[], :target) || options.try(:delete, :target)
102
+ add_html_data :controller, html_options.try(:[], :data).try(:[], :controller) || options.try(:delete, :controller)
103
+ add_html_data :action, html_options.try(:[], :data).try(:[], :action) || options.try(:delete, :action)
104
104
  # To turbolinks
105
- add_html_data :turbolinks, options.try(:delete, :turbolinks)
105
+ add_html_data :turbolinks, html_options.try(:[], :data).try(:[], :turbolinks) || options.try(:delete, :turbolinks)
106
106
  end
107
107
 
108
108
  # Override this method to add html Options
@@ -50,10 +50,14 @@ module UiBibz::Ui::Core::Forms::Surrounds
50
50
  #
51
51
  class SurroundField < UiBibz::Ui::Core::Component
52
52
 
53
+ attr_reader :errors, :required_fields
54
+
53
55
  # See UiBibz::Ui::Core::Component.initialize
54
56
  def initialize content = nil, options = nil, html_options = nil, &block
55
57
  super
56
58
  @items = []
59
+ @errors = []
60
+ @required_fields = []
57
61
  end
58
62
 
59
63
  # Render html tag
@@ -66,7 +70,10 @@ module UiBibz::Ui::Core::Forms::Surrounds
66
70
  end
67
71
 
68
72
  def input attribute_name, options = {}, &block
69
- @items << @options[:form].input(attribute_name, options.merge({ label: false, wrapper: false }), &block)
73
+ @items << @options[:form].input(attribute_name, options.merge({ label: false, wrapper: false, error: false }), &block)
74
+ obj = @options[:form].object
75
+ @errors << obj.errors[attribute_name] unless obj.errors[attribute_name].empty?
76
+ @required_fields << (obj._validators[attribute_name].try(:first).class.to_s == "ActiveRecord::Validations::PresenceValidator")
70
77
  end
71
78
 
72
79
  def glyph content = nil, options = {}, html_options = nil, &block
@@ -1,5 +1,6 @@
1
1
  require 'ui_bibz/ui/core/navigations/components/nav_link_link'
2
2
  require 'ui_bibz/ui/core/navigations/components/nav_link_list'
3
+ require 'ui_bibz/ui/core/navigations/components/nav_link_span'
3
4
  module UiBibz::Ui::Core::Navigations
4
5
 
5
6
  # Create a NavLink
@@ -43,6 +44,7 @@ module UiBibz::Ui::Core::Navigations
43
44
  # See UiBibz::Ui::Core::Component.initialize
44
45
  def initialize content = nil, options = nil, html_options = nil, &block
45
46
  super
47
+ @old_options = options
46
48
  end
47
49
 
48
50
  # Render html tag
@@ -50,7 +52,11 @@ module UiBibz::Ui::Core::Navigations
50
52
  if options[:nav_type] == "nav-links"
51
53
  UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, options, html_options).render
52
54
  else
53
- cont = UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, options).render
55
+ if options[:tag_type] == "span"
56
+ cont = UiBibz::Ui::Core::Navigations::NavLinkSpan.new(content, @old_options).render
57
+ else
58
+ cont = UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, options).render
59
+ end
54
60
  #html_options[:class] = remove_class(html_options[:class])
55
61
  remove_classes
56
62
  UiBibz::Ui::Core::Navigations::NavLinkList.new(cont, options, html_options).render
@@ -0,0 +1,51 @@
1
+ module UiBibz::Ui::Core::Navigations
2
+
3
+ # Create a NavLinkLink
4
+ #
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
6
+ #
7
+ # ==== Attributes
8
+ #
9
+ # * +content+ - Content of element
10
+ # * +options+ - Options of element
11
+ # * +html_options+ - Html Options of element
12
+ #
13
+ # ==== Options
14
+ #
15
+ # You can add HTML attributes using the +html_options+.
16
+ # You can pass arguments in options attribute:
17
+ # * +state+ - status of élement with symbol value:
18
+ # (+:active+)
19
+ #
20
+ class NavLinkSpan < UiBibz::Ui::Core::Component
21
+
22
+ # UiBibz::Ui::Core::Component.initialize
23
+ def initialize content = nil, options = nil, html_options = nil, &block
24
+ super
25
+ end
26
+
27
+ # Render html tag
28
+ def pre_render
29
+ content_tag :span, html_options do
30
+ concat glyph_and_content_html
31
+ concat tag_html if options[:tag]
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def component_html_classes
38
+ "nav-link"
39
+ end
40
+
41
+ def component_html_options
42
+ { "data-toggle" => "tab", role: 'tab' }
43
+ end
44
+
45
+ def component_html_data
46
+ super
47
+ add_html_data "link", options[:link] if options[:link]
48
+ end
49
+
50
+ end
51
+ end
@@ -63,8 +63,8 @@ module UiBibz::Ui::Core::Navigations
63
63
  when :ui_form_for
64
64
  begin
65
65
  @form = ui_form_for(@model_or_url, html_options, &@content)
66
- rescue
67
- raise 'You must install simple form to use ui_form_for.'
66
+ ## rescue
67
+ ## raise 'You must install simple form to use ui_form_for.'
68
68
  end
69
69
  else
70
70
  @form = form_tag_with_body(html_options, capture(&@content))
@@ -68,7 +68,7 @@ module UiBibz::Ui::Core::Navigations
68
68
  # Add nav link items
69
69
  # See UiBibz::Ui::Core::Navigations::NavLink
70
70
  def tab content = nil, options = {}, html_options = nil, &block
71
- block_given? ? content.merge!({ nav_type: type }) : options.merge!({ nav_type: type })
71
+ block_given? ? content.merge!({ nav_type: type, tag_type: @options[:tag_type] }) : options.merge!({ nav_type: type, tag_type: @options[:tag_type] })
72
72
  @items << NavLink.new(content, options, html_options, &block)
73
73
  end
74
74