ui_bibz 3.0.0.beta5 → 3.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ui_bibz/infos.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/files/file_field.rb +8 -14
- data/test/simple_form_test.rb +1 -1
- data/test/ui/core/boxes/card_test.rb +1 -1
- data/test/ui/core/forms/files/file_field_test.rb +1 -1
- data/test/ui/core/navigations/navbar_test.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab074570076dac77f62df00073048e54f4bf3d935a7d3d2c13438000ffdb8506
|
4
|
+
data.tar.gz: 91005c842ed00077ecc28ea4fadf1a8d766af041e2c59b573a9a5fbf93b57d46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52c51c4e4075e0ad2bcaa0445aa0201b188e961d96c7a46126626f501115fd11bc1c81877be36456c272e2d427592056a51f98844f39809b4315100dbe1624a
|
7
|
+
data.tar.gz: 13033afe527ecfb013e00a4772920d41b0ee3880fa795e5ef09c6934f4c51d5fb634240394a243c681091d573ac84ae0691341589cc6a3132881e5018ec9ac0f
|
data/Gemfile.lock
CHANGED
data/lib/ui_bibz/infos.rb
CHANGED
@@ -45,19 +45,17 @@ module UiBibz::Ui::Core::Forms::Files
|
|
45
45
|
|
46
46
|
# Render html tag
|
47
47
|
def pre_render
|
48
|
-
|
49
|
-
concat file_field_tag content, class: 'form-file-input', multiple: options[:multiple], disabled: disabled?
|
50
|
-
concat label_text_and_button
|
51
|
-
end
|
48
|
+
file_field_tag content, html_options
|
52
49
|
end
|
53
50
|
|
54
51
|
private
|
55
52
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
def component_html_options
|
54
|
+
super.merge({
|
55
|
+
multiple: options[:multiple],
|
56
|
+
disabled: disabled?,
|
57
|
+
value: format_value(options[:input_text] || options[:value])
|
58
|
+
})
|
61
59
|
end
|
62
60
|
|
63
61
|
def format_value(value)
|
@@ -70,12 +68,8 @@ module UiBibz::Ui::Core::Forms::Files
|
|
70
68
|
value.to_s
|
71
69
|
end
|
72
70
|
|
73
|
-
def label_name
|
74
|
-
html_options[:id] || content
|
75
|
-
end
|
76
|
-
|
77
71
|
def component_html_classes
|
78
|
-
super << 'form-
|
72
|
+
super << 'form-control'
|
79
73
|
end
|
80
74
|
end
|
81
75
|
end
|
data/test/simple_form_test.rb
CHANGED
@@ -202,7 +202,7 @@ test1</textarea></div></form>"
|
|
202
202
|
f.input :name_fr, as: :ui_file_field
|
203
203
|
end
|
204
204
|
|
205
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_file_field optional user_name_fr\"><label class=\"control-label ui_file_field optional\" for=\"user_name_fr\">Name fr</label><
|
205
|
+
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_file_field optional user_name_fr\"><label class=\"control-label ui_file_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"file\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"ui_file_field optional form-control\" /></div></form>"
|
206
206
|
|
207
207
|
assert_equal expected, actual
|
208
208
|
end
|
@@ -69,7 +69,7 @@ class CardTest < ActionView::TestCase
|
|
69
69
|
p.body do |b|
|
70
70
|
b.title 'Special title treatment'
|
71
71
|
b.subtitle 'The subtitle'
|
72
|
-
b.text
|
72
|
+
b.text 'With supporting text below as a natural lead-in to additional content.'
|
73
73
|
b.link 'Go somewhere', url: '#go-somewhere', class: 'btn btn-primary'
|
74
74
|
end
|
75
75
|
end
|
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
class FileFieldTest < ActionView::TestCase
|
6
6
|
test 'file_field' do
|
7
7
|
actual = UiBibz::Ui::Core::Forms::Files::FileField.new('test').render
|
8
|
-
expected = "<
|
8
|
+
expected = "<input type=\"file\" name=\"test\" id=\"test\" value=\"\" class=\"form-control\" />"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
@@ -4,14 +4,14 @@ require 'test_helper'
|
|
4
4
|
class NavbarTest < ActionView::TestCase
|
5
5
|
test 'Navbar' do
|
6
6
|
actual = UiBibz::Ui::Core::Navigations::Navbar.new
|
7
|
-
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
7
|
+
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
8
8
|
|
9
9
|
assert_equal expected, actual.render
|
10
10
|
end
|
11
11
|
|
12
12
|
test 'Navbar with options' do
|
13
13
|
actual = UiBibz::Ui::Core::Navigations::Navbar.new(title: 'Brand', expand_size: :xs, status: :primary, position: :top, brand_position: :right)
|
14
|
-
expected = "<nav class=\"bg-primary navbar navbar-light fixed-top navbar-expand-xs\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><span class=\"navbar-brand\">Brand</span><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
14
|
+
expected = "<nav class=\"bg-primary navbar navbar-light fixed-top navbar-expand-xs\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><span class=\"navbar-brand\">Brand</span><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
15
15
|
|
16
16
|
assert_equal expected, actual.render
|
17
17
|
end
|
@@ -30,7 +30,7 @@ class NavbarTest < ActionView::TestCase
|
|
30
30
|
end
|
31
31
|
nb.text 'test'
|
32
32
|
end
|
33
|
-
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\">Brand</span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"d-flex\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><button class=\"btn-secondary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></div></nav>"
|
33
|
+
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\">Brand</span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"d-flex\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><button class=\"btn-secondary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></div></nav>"
|
34
34
|
|
35
35
|
assert_equal expected, actual.render
|
36
36
|
end
|
@@ -43,7 +43,7 @@ class NavbarTest < ActionView::TestCase
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
expected =
|
46
|
-
"<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\"><img src=\"/images/ruby-white\" /></span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#link\" class=\"nav-link\">Link</a></li></ul></div></div></nav>"
|
46
|
+
"<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\"><img src=\"/images/ruby-white\" /></span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#link\" class=\"nav-link\">Link</a></li></ul></div></div></nav>"
|
47
47
|
|
48
48
|
assert_equal expected, actual.render
|
49
49
|
end
|