ui_bibz 2.0.0.alpha10 → 2.0.0.alpha11
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -7
- data/app/assets/stylesheets/table.sass +2 -0
- data/app/assets/stylesheets/ui_bibz.sass +0 -2
- data/lib/ui_bibz/ui/core/alert.rb +4 -4
- data/lib/ui_bibz/ui/core/breadcrumb/breadcrumb.rb +2 -2
- data/lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb +2 -2
- data/lib/ui_bibz/ui/core/button/button.rb +10 -10
- data/lib/ui_bibz/ui/core/button/button_choice.rb +5 -5
- data/lib/ui_bibz/ui/core/button/button_dropdown.rb +3 -3
- data/lib/ui_bibz/ui/core/button/button_group.rb +5 -1
- data/lib/ui_bibz/ui/core/button/button_link.rb +2 -2
- data/lib/ui_bibz/ui/core/button/button_split_dropdown.rb +5 -5
- data/lib/ui_bibz/ui/core/card/card.rb +4 -4
- data/lib/ui_bibz/ui/core/card/components/block/card_block_text.rb +1 -1
- data/lib/ui_bibz/ui/core/component.rb +7 -7
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_link.rb +2 -2
- data/lib/ui_bibz/ui/core/dropdown/dropdown.rb +6 -6
- data/lib/ui_bibz/ui/core/glyph.rb +3 -3
- data/lib/ui_bibz/ui/core/input/autocomplete_field.rb +7 -1
- data/lib/ui_bibz/ui/core/input/dropdown_select_field.rb +2 -2
- data/lib/ui_bibz/ui/core/input/formula_field.rb +1 -1
- data/lib/ui_bibz/ui/core/input/multi_select_field.rb +2 -2
- data/lib/ui_bibz/ui/core/input/surround_field.rb +9 -1
- data/lib/ui_bibz/ui/core/input/switch_field.rb +4 -4
- data/lib/ui_bibz/ui/core/label.rb +4 -4
- data/lib/ui_bibz/ui/core/list/components/list.rb +7 -7
- data/lib/ui_bibz/ui/core/list/list_group.rb +5 -5
- data/lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb +2 -2
- data/lib/ui_bibz/ui/core/nav/components/nav_link.rb +3 -3
- data/lib/ui_bibz/ui/core/nav/components/nav_link_link.rb +1 -1
- data/lib/ui_bibz/ui/core/nav/components/navbar_nav.rb +1 -1
- data/lib/ui_bibz/ui/core/nav/nav.rb +1 -1
- data/lib/ui_bibz/ui/core/nav/navbar.rb +3 -3
- data/lib/ui_bibz/ui/core/progress.rb +5 -5
- data/lib/ui_bibz/ui/core/stars.rb +3 -3
- data/lib/ui_bibz/ui/ux/table/components/actions.rb +4 -0
- data/lib/ui_bibz/ui/ux/table/components/as.rb +8 -4
- data/lib/ui_bibz/ui/ux/table/components/column.rb +17 -16
- data/lib/ui_bibz/ui/ux/table/components/thead.rb +4 -4
- data/lib/ui_bibz/ui/ux/table/table.rb +8 -8
- data/lib/ui_bibz/ui/ux/table/table_card.rb +4 -4
- data/lib/ui_bibz/version.rb +1 -1
- data/test/dummy/db/schema.rb +1 -1
- data/test/ui/breadcrumb_test.rb +2 -2
- data/test/ui/button_test.rb +24 -24
- data/test/ui/card_test.rb +5 -5
- data/test/ui/component_test.rb +2 -2
- data/test/ui/dropdown_test.rb +1 -1
- data/test/ui/input_switch_field_test.rb +3 -3
- data/test/ui/inputs_test.rb +5 -5
- data/test/ui/list_group_test.rb +5 -5
- data/test/ui/nav_test.rb +3 -3
- data/test/ui/stars_test.rb +2 -2
- data/test/ui/table_test.rb +7 -7
- data/test/ui_helper_test.rb +16 -16
- data/ui_bibz.gemspec +2 -2
- metadata +5 -109
- data/doc/UiBibz.html +0 -129
- data/doc/UiBibz/Concerns.html +0 -115
- data/doc/UiBibz/Concerns/Models.html +0 -115
- data/doc/UiBibz/Concerns/Models/Searchable.html +0 -120
- data/doc/UiBibz/Concerns/Models/Searchable/ClassMethods.html +0 -174
- data/doc/UiBibz/Helpers.html +0 -115
- data/doc/UiBibz/Helpers/MetaHelper.html +0 -273
- data/doc/UiBibz/Helpers/UiCoreHelper.html +0 -1234
- data/doc/UiBibz/Helpers/UiUxHelper.html +0 -463
- data/doc/UiBibz/Helpers/UtilsHelper.html +0 -187
- data/doc/UiBibz/Rails.html +0 -115
- data/doc/UiBibz/Rails/Engine.html +0 -123
- data/doc/UiBibz/Ui.html +0 -119
- data/doc/UiBibz/Ui/Base.html +0 -304
- data/doc/UiBibz/Ui/Core.html +0 -128
- data/doc/UiBibz/Ui/Core/Alert.html +0 -383
- data/doc/UiBibz/Ui/Core/Bar.html +0 -372
- data/doc/UiBibz/Ui/Core/Breadcrumb.html +0 -442
- data/doc/UiBibz/Ui/Core/BreadcrumbLink.html +0 -369
- data/doc/UiBibz/Ui/Core/Button.html +0 -380
- data/doc/UiBibz/Ui/Core/ButtonDropdown.html +0 -401
- data/doc/UiBibz/Ui/Core/ButtonGroup.html +0 -372
- data/doc/UiBibz/Ui/Core/ButtonLink.html +0 -382
- data/doc/UiBibz/Ui/Core/ButtonSplitDropdown.html +0 -403
- data/doc/UiBibz/Ui/Core/Col.html +0 -373
- data/doc/UiBibz/Ui/Core/Component.html +0 -1087
- data/doc/UiBibz/Ui/Core/Dropdown.html +0 -663
- data/doc/UiBibz/Ui/Core/DropdownDivider.html +0 -301
- data/doc/UiBibz/Ui/Core/DropdownHeader.html +0 -355
- data/doc/UiBibz/Ui/Core/DropdownLink.html +0 -376
- data/doc/UiBibz/Ui/Core/DropdownList.html +0 -382
- data/doc/UiBibz/Ui/Core/Glyph.html +0 -385
- data/doc/UiBibz/Ui/Core/Jumbotron.html +0 -379
- data/doc/UiBibz/Ui/Core/Label.html +0 -379
- data/doc/UiBibz/Ui/Core/List.html +0 -528
- data/doc/UiBibz/Ui/Core/ListGroup.html +0 -474
- data/doc/UiBibz/Ui/Core/Modal.html +0 -543
- data/doc/UiBibz/Ui/Core/ModalBody.html +0 -353
- data/doc/UiBibz/Ui/Core/ModalFooter.html +0 -353
- data/doc/UiBibz/Ui/Core/ModalHeader.html +0 -359
- data/doc/UiBibz/Ui/Core/Nav.html +0 -515
- data/doc/UiBibz/Ui/Core/NavDropdown.html +0 -391
- data/doc/UiBibz/Ui/Core/NavLink.html +0 -364
- data/doc/UiBibz/Ui/Core/Navbar.html +0 -646
- data/doc/UiBibz/Ui/Core/NavbarForm.html +0 -364
- data/doc/UiBibz/Ui/Core/NavbarNav.html +0 -302
- data/doc/UiBibz/Ui/Core/NavbarText.html +0 -355
- data/doc/UiBibz/Ui/Core/Panel.html +0 -617
- data/doc/UiBibz/Ui/Core/ProgressBar.html +0 -462
- data/doc/UiBibz/Ui/Core/Row.html +0 -350
- data/doc/UiBibz/Ui/Core/Stars.html +0 -371
- data/doc/UiBibz/Ui/Ux.html +0 -128
- data/doc/UiBibz/Ui/Ux/Actionable.html +0 -478
- data/doc/UiBibz/Ui/Ux/Actions.html +0 -602
- data/doc/UiBibz/Ui/Ux/Column.html +0 -1249
- data/doc/UiBibz/Ui/Ux/Columns.html +0 -338
- data/doc/UiBibz/Ui/Ux/Grid.html +0 -485
- data/doc/UiBibz/Ui/Ux/Paginable.html +0 -381
- data/doc/UiBibz/Ui/Ux/Searchable.html +0 -376
- data/doc/UiBibz/Ui/Ux/Sortable.html +0 -300
- data/doc/UiBibz/Ui/Ux/Store.html +0 -1176
- data/doc/UiBibz/Ui/Ux/Table.html +0 -694
- data/doc/UiBibz/Ui/Ux/TableAction.html +0 -309
- data/doc/UiBibz/Ui/Ux/TablePagination.html +0 -342
- data/doc/UiBibz/Ui/Ux/TablePaginationPerPage.html +0 -348
- data/doc/UiBibz/Ui/Ux/TablePanel.html +0 -680
- data/doc/UiBibz/Ui/Ux/TableSearchField.html +0 -304
- data/doc/UiBibz/Utils.html +0 -115
- data/doc/UiBibz/Utils/Internationalization.html +0 -262
- data/doc/_index.html +0 -706
- data/doc/class_list.html +0 -58
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/file.README.html +0 -1261
- data/doc/file_list.html +0 -60
- data/doc/frames.html +0 -26
- data/doc/images/alert.png +0 -0
- data/doc/images/breadcrumb.png +0 -0
- data/doc/images/button.png +0 -0
- data/doc/images/button_dropdown.png +0 -0
- data/doc/images/button_group.png +0 -0
- data/doc/images/button_link.png +0 -0
- data/doc/images/button_split_dropdown.png +0 -0
- data/doc/images/etiquette.png +0 -0
- data/doc/images/glyph.png +0 -0
- data/doc/images/list.png +0 -0
- data/doc/images/modal.png +0 -0
- data/doc/images/nav.png +0 -0
- data/doc/images/navbar.png +0 -0
- data/doc/images/panel.png +0 -0
- data/doc/images/progress_bar.png +0 -0
- data/doc/images/stars.png +0 -0
- data/doc/images/table.png +0 -0
- data/doc/images/table_pagination_per_page.png +0 -0
- data/doc/images/table_panel.png +0 -0
- data/doc/images/table_search_field.png +0 -0
- data/doc/images/ui-bibz-logo-without-border.gif +0 -0
- data/doc/images/ui-bibz-logo.gif +0 -0
- data/doc/index.html +0 -1261
- data/doc/js/app.js +0 -219
- data/doc/js/full_list.js +0 -181
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1329
- data/doc/top-level-namespace.html +0 -112
@@ -14,7 +14,7 @@ module UiBibz::Ui::Ux
|
|
14
14
|
#
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
|
-
# * +
|
17
|
+
# * +status+ - status of élement with symbol value:
|
18
18
|
# (+:inverse+, +:default+)
|
19
19
|
#
|
20
20
|
# ==== Signatures
|
@@ -27,7 +27,7 @@ module UiBibz::Ui::Ux
|
|
27
27
|
#
|
28
28
|
# ==== Examples
|
29
29
|
#
|
30
|
-
# UiBibz::Ui::Ux::Thead.new(content, {
|
30
|
+
# UiBibz::Ui::Ux::Thead.new(content, { status: :inverse }).render
|
31
31
|
#
|
32
32
|
class Thead < UiBibz::Ui::Core::Component
|
33
33
|
|
@@ -43,8 +43,8 @@ module UiBibz::Ui::Ux
|
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
-
def
|
47
|
-
"thead-#{ @options[:
|
46
|
+
def status
|
47
|
+
"thead-#{ @options[:status] }" unless @options[:status].nil?
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -32,11 +32,11 @@ module UiBibz::Ui::Ux
|
|
32
32
|
# * +sortable+ - Boolean
|
33
33
|
# * +searchable+ - Boolean
|
34
34
|
# * +default_actions+ - Boolean
|
35
|
-
# * +
|
35
|
+
# * +status+
|
36
36
|
# (+:inverse+, +:default+, +:success+, +:primary+, +:secondary+, +:info+,
|
37
37
|
# +:danger+, +:warning+)
|
38
38
|
# * +thead+ - Hash
|
39
|
-
# (+
|
39
|
+
# (+status+)
|
40
40
|
# (+:inverse+, +:default+)
|
41
41
|
# * +bordered+ - Boolean
|
42
42
|
# * +hoverable+ - Boolean
|
@@ -67,10 +67,10 @@ module UiBibz::Ui::Ux
|
|
67
67
|
# c.column :id, { name: '#' }
|
68
68
|
# c.column :name_fr', { link: edit_user_path(:id), order: 2 }
|
69
69
|
# c.column :name_en'
|
70
|
-
# c.column :
|
70
|
+
# c.column :state_id, { name: 'state', format: lambda{ |records, record| "Test #{ record.id}"} }
|
71
71
|
# end
|
72
72
|
# t.actions do |a|
|
73
|
-
# a.link '
|
73
|
+
# a.link 'state', url: users_path(:id), glyph: 'eye'
|
74
74
|
# a.divider
|
75
75
|
# a.link 'momo', url: users_path(:id), glyph: 'home'
|
76
76
|
# end
|
@@ -184,9 +184,9 @@ module UiBibz::Ui::Ux
|
|
184
184
|
content = content.strftime(col.date_format) unless col.date_format.nil?
|
185
185
|
content = link_to content, action.inject_url(col.link, record) unless col.link.nil?
|
186
186
|
content = col.format.call(@store.records, record) unless col.format.nil?
|
187
|
-
content = As.new(col, record, content).render unless col.as.nil?
|
188
|
-
content
|
189
187
|
end
|
188
|
+
content = As.new(col, record, content, @options).render unless col.as.nil?
|
189
|
+
content
|
190
190
|
end
|
191
191
|
|
192
192
|
private
|
@@ -195,8 +195,8 @@ module UiBibz::Ui::Ux
|
|
195
195
|
["table", striped, bordered, hoverable, size, responsive, reflow]
|
196
196
|
end
|
197
197
|
|
198
|
-
def
|
199
|
-
"table-#{ @options[:
|
198
|
+
def status
|
199
|
+
"table-#{ @options[:status] }" unless @options[:status].nil?
|
200
200
|
end
|
201
201
|
|
202
202
|
def striped
|
@@ -22,10 +22,10 @@ module UiBibz::Ui::Ux
|
|
22
22
|
# * +actionable+ - Boolean
|
23
23
|
# * +sortable+ - Boolean
|
24
24
|
# * +searchable+ - Boolean
|
25
|
-
# * +
|
25
|
+
# * +status+
|
26
26
|
# (+:inverse+)
|
27
27
|
# * +thead+ - Hash
|
28
|
-
# (+
|
28
|
+
# (+status+)
|
29
29
|
# (+inverse+, +default+)
|
30
30
|
# * +bordered+ - Boolean
|
31
31
|
# * +hoverable+ - Boolean
|
@@ -58,10 +58,10 @@ module UiBibz::Ui::Ux
|
|
58
58
|
# c.column :id, { name: '# }, { class: 'column-id' }
|
59
59
|
# c.column :name_fr, { name: 'Name FR', link: edit_user_path(:id), order: 2 }
|
60
60
|
# c.column :name_en
|
61
|
-
# c.column :
|
61
|
+
# c.column :state_id, { name: 'state', format: lambda{ |records, record| "Test #{ record.id}"} }
|
62
62
|
# end
|
63
63
|
# t.actions do |a|
|
64
|
-
# a.link '
|
64
|
+
# a.link 'state', url: users_path(:id), glyph: 'eye'
|
65
65
|
# a.divider
|
66
66
|
# a.link 'momo', url: users_path(:id), glyph: 'home'
|
67
67
|
# end
|
data/lib/ui_bibz/version.rb
CHANGED
data/test/dummy/db/schema.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current
|
2
|
+
# This file is auto-generated from the current status of the database. Instead
|
3
3
|
# of editing this file, please use the migrations feature of Active Record to
|
4
4
|
# incrementally modify your database, and then regenerate this schema definition.
|
5
5
|
#
|
data/test/ui/breadcrumb_test.rb
CHANGED
@@ -5,9 +5,9 @@ class NavTest < ActionView::TestCase
|
|
5
5
|
test 'breadcrumb' do
|
6
6
|
actual = UiBibz::Ui::Core::Breadcrumb.new.tap do |b|
|
7
7
|
b.link 'Home', url: '#home', glyph: 'home'
|
8
|
-
b.link '
|
8
|
+
b.link 'state', { url: '#state', state: :active }
|
9
9
|
end.render
|
10
|
-
expected = "<ol class=\"breadcrumb\"><li><a href=\"#home\"><i class=\"glyph fa fa-home\"></i> Home</a></li><li class=\"active\"><a href=\"#
|
10
|
+
expected = "<ol class=\"breadcrumb\"><li><a href=\"#home\"><i class=\"glyph fa fa-home\"></i> Home</a></li><li class=\"active\"><a href=\"#state\">state</a></li></ol>"
|
11
11
|
|
12
12
|
assert_equal expected, actual
|
13
13
|
end
|
data/test/ui/button_test.rb
CHANGED
@@ -4,91 +4,91 @@ include UiBibz::Helpers
|
|
4
4
|
class ButtonTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test "button" do
|
7
|
-
actual = UiBibz::Ui::Core::Button.new('
|
8
|
-
expected = "<button class=\"btn-success btn\">
|
7
|
+
actual = UiBibz::Ui::Core::Button.new('state', status: :success).render
|
8
|
+
expected = "<button class=\"btn-success btn\">state</button>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'button group' do
|
14
14
|
actual = UiBibz::Ui::Core::ButtonGroup.new position: :vertical do
|
15
|
-
UiBibz::Ui::Core::Button.new('
|
15
|
+
UiBibz::Ui::Core::Button.new('state').render
|
16
16
|
end.render
|
17
|
-
expected = "<div class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-primary btn\">
|
17
|
+
expected = "<div data-toggle=\"buttons\" class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-primary btn\">state</button></div>"
|
18
18
|
|
19
19
|
assert_equal expected, actual
|
20
20
|
end
|
21
21
|
|
22
22
|
test 'link button' do
|
23
|
-
actual = UiBibz::Ui::Core::ButtonLink.new('
|
24
|
-
expected = "<a class=\"btn-danger btn\" href=\"/users\"><i class=\"glyph fa fa-add\"></i>
|
23
|
+
actual = UiBibz::Ui::Core::ButtonLink.new('state', { url: users_path, status: :danger, glyph: 'add'}).render
|
24
|
+
expected = "<a class=\"btn-danger btn\" href=\"/users\"><i class=\"glyph fa fa-add\"></i> state</a>"
|
25
25
|
|
26
26
|
assert_equal expected, actual
|
27
27
|
end
|
28
28
|
|
29
29
|
test 'button outline' do
|
30
|
-
actual = UiBibz::Ui::Core::Button.new('
|
31
|
-
expected = "<button class=\"btn-success-outline btn\">
|
30
|
+
actual = UiBibz::Ui::Core::Button.new('state', status: :success, outline: true).render
|
31
|
+
expected = "<button class=\"btn-success-outline btn\">state</button>"
|
32
32
|
|
33
33
|
assert_equal expected, actual
|
34
34
|
end
|
35
35
|
|
36
36
|
test 'checkbox button checked' do
|
37
|
-
actual = UiBibz::Ui::Core::ButtonChoice.new('
|
38
|
-
expected = "<label class=\"active btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" checked=\"checked\" />
|
37
|
+
actual = UiBibz::Ui::Core::ButtonChoice.new('state', { state: :active }).render
|
38
|
+
expected = "<label class=\"active btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" checked=\"checked\" />state</label>"
|
39
39
|
|
40
40
|
assert_equal expected, actual
|
41
41
|
end
|
42
42
|
|
43
43
|
test 'checkbox button non checked' do
|
44
|
-
actual = UiBibz::Ui::Core::ButtonChoice.new('
|
45
|
-
expected = "<label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" name=\"
|
44
|
+
actual = UiBibz::Ui::Core::ButtonChoice.new('state', { name: 'state', id: 'state', input_html_options: { class: 'state'}}).render
|
45
|
+
expected = "<label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" name=\"state\" id=\"state\" class=\"state\" />state</label>"
|
46
46
|
|
47
47
|
assert_equal expected, actual
|
48
48
|
end
|
49
49
|
|
50
50
|
test 'button group choice checkbox' do
|
51
51
|
actual = UiBibz::Ui::Core::ButtonGroup.new do
|
52
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('
|
53
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('
|
52
|
+
concat UiBibz::Ui::Core::ButtonChoice.new('state1').render
|
53
|
+
concat UiBibz::Ui::Core::ButtonChoice.new('state2').render
|
54
54
|
end.render
|
55
|
-
expected = "<div class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />
|
55
|
+
expected = "<div data-toggle=\"buttons\" class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />state1</label><label class=\"btn-primary btn\"><input type=\"checkbox\" autocomplete=\"off\" />state2</label></div>"
|
56
56
|
|
57
57
|
assert_equal expected, actual
|
58
58
|
end
|
59
59
|
|
60
60
|
test 'button group choice radio' do
|
61
61
|
actual = UiBibz::Ui::Core::ButtonGroup.new do
|
62
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('
|
63
|
-
concat UiBibz::Ui::Core::ButtonChoice.new('
|
62
|
+
concat UiBibz::Ui::Core::ButtonChoice.new('state1', type: :radio).render
|
63
|
+
concat UiBibz::Ui::Core::ButtonChoice.new('state2', type: :radio).render
|
64
64
|
end.render
|
65
|
-
expected = "<div class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />
|
65
|
+
expected = "<div data-toggle=\"buttons\" class=\"btn-group\" role=\"group\"><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />state1</label><label class=\"btn-primary btn\"><input type=\"radio\" autocomplete=\"off\" />state2</label></div>"
|
66
66
|
|
67
67
|
assert_equal expected, actual
|
68
68
|
end
|
69
69
|
|
70
70
|
test 'button dropdown' do
|
71
|
-
actual = UiBibz::Ui::Core::ButtonDropdown.new("Dropdown", type: :dropup,
|
72
|
-
d.link '
|
71
|
+
actual = UiBibz::Ui::Core::ButtonDropdown.new("Dropdown", type: :dropup, status: :success).tap do |d|
|
72
|
+
d.link 'state'
|
73
73
|
d.header 'header'
|
74
74
|
d.link 'momo'
|
75
75
|
d.divider
|
76
76
|
d.link 'lolo'
|
77
77
|
end.render
|
78
|
-
expected = "<div class=\"btn-group dropup\" role=\"group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#\">
|
78
|
+
expected = "<div class=\"btn-group dropup\" role=\"group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Dropdown <span class=\"caret\"></span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#\">state</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#\">momo</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#\">lolo</a></div></div>"
|
79
79
|
|
80
80
|
assert_equal expected, actual
|
81
81
|
end
|
82
82
|
|
83
83
|
test 'button split dropdown' do
|
84
|
-
actual = UiBibz::Ui::Core::ButtonSplitDropdown.new("Dropdown", type: :dropup,
|
85
|
-
d.link '
|
84
|
+
actual = UiBibz::Ui::Core::ButtonSplitDropdown.new("Dropdown", type: :dropup, status: :primary).tap do |d|
|
85
|
+
d.link 'state'
|
86
86
|
d.header 'header'
|
87
87
|
d.link 'momo'
|
88
88
|
d.divider
|
89
89
|
d.link 'lolo'
|
90
90
|
end.render
|
91
|
-
expected = "<div class=\"btn-group dropup\" role=\"group\"><button class=\"btn btn-primary\">Dropdown</button><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"caret\"></span><span class=\"sr-only\">Toggle Dropdown</span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#\">
|
91
|
+
expected = "<div class=\"btn-group dropup\" role=\"group\"><button class=\"btn btn-primary\">Dropdown</button><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\"><span class=\"caret\"></span><span class=\"sr-only\">Toggle Dropdown</span></button><div class=\"dropdown-menu dropdown-menu-left\"><a class=\"dropdown-item\" href=\"#\">state</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#\">momo</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#\">lolo</a></div></div>"
|
92
92
|
|
93
93
|
assert_equal expected, actual
|
94
94
|
end
|
data/test/ui/card_test.rb
CHANGED
@@ -34,12 +34,12 @@ class CardTest < ActionView::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
test 'create card with header, block and footer' do
|
37
|
-
actual = card(
|
38
|
-
p.header '
|
39
|
-
p.block '
|
40
|
-
p.footer '
|
37
|
+
actual = card(status: :danger, tap: true, class: 'state') do |p|
|
38
|
+
p.header 'state', glyph: 'eye'
|
39
|
+
p.block 'state'
|
40
|
+
p.footer 'state'
|
41
41
|
end
|
42
|
-
expected = "<div class=\"card-danger
|
42
|
+
expected = "<div class=\"card-danger state card\"><div class=\"card-header\"><i class=\"glyph fa fa-eye\"></i> state</div><div class=\"card-block\">state</div><div class=\"card-footer\">state</div></div>"
|
43
43
|
|
44
44
|
assert_equal expected, actual
|
45
45
|
end
|
data/test/ui/component_test.rb
CHANGED
@@ -4,14 +4,14 @@ include UiBibz::Helpers
|
|
4
4
|
class ComponentTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test 'create complex component' do
|
7
|
-
actual = UiBibz::Ui::Core::Component.new('New component', {
|
7
|
+
actual = UiBibz::Ui::Core::Component.new('New component', { state: :active, glyph: 'add' }, { class: 'new-class' }).render
|
8
8
|
expected = '<i class="glyph fa fa-add"></i> New component'
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'create complex component with block' do
|
14
|
-
actual = UiBibz::Ui::Core::Component.new(
|
14
|
+
actual = UiBibz::Ui::Core::Component.new(state: :active) do
|
15
15
|
"New content"
|
16
16
|
end.render
|
17
17
|
expected = 'New content'
|
data/test/ui/dropdown_test.rb
CHANGED
@@ -3,7 +3,7 @@ include UiBibz::Helpers
|
|
3
3
|
class DropdownTest < ActionView::TestCase
|
4
4
|
|
5
5
|
test 'Dropdown' do
|
6
|
-
actual = UiBibz::Ui::Core::Dropdown.new("Dropdown", type: :dropup,
|
6
|
+
actual = UiBibz::Ui::Core::Dropdown.new("Dropdown", type: :dropup, status: :success).tap do |d|
|
7
7
|
d.link 'Link 1', url: '#link1', glyph: 'eye'
|
8
8
|
d.header 'header'
|
9
9
|
d.link 'Link 2', url: '#link2'
|
@@ -28,9 +28,9 @@ class InputsSwitchFieldTest < ActionView::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# OK
|
31
|
-
test 'switch_field
|
32
|
-
actual = UiBibz::Ui::Core::SwitchField.new('test', {},
|
33
|
-
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\"
|
31
|
+
test 'switch_field state' do
|
32
|
+
actual = UiBibz::Ui::Core::SwitchField.new('test', {}, state: "disabled").render
|
33
|
+
expected = "<input type=\"checkbox\" name=\"test\" id=\"test\" state=\"disabled\" class=\"switch\" />"
|
34
34
|
|
35
35
|
assert_equal expected, actual
|
36
36
|
end
|
data/test/ui/inputs_test.rb
CHANGED
@@ -27,9 +27,9 @@ class InputsTest < ActionView::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
test "Multi Column Field data html options" do
|
30
|
-
grouped_options = { 'North America' => [['United
|
30
|
+
grouped_options = { 'North America' => [['United statuss','US'], 'Canada'], 'Europe' => ['Denmark','Germany','France'] }
|
31
31
|
actual = UiBibz::Ui::Core::MultiColumnField.new('example', { option_tags: grouped_options_for_select(grouped_options), searchable: true, selectable_opt_group: true }).render
|
32
|
-
expected = "<select name=\"example[]\" id=\"example\" data-searchable=\"true\" data-selectable-optgroup=\"true\" class=\"multi-column\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United
|
32
|
+
expected = "<select name=\"example[]\" id=\"example\" data-searchable=\"true\" data-selectable-optgroup=\"true\" class=\"multi-column\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
|
33
33
|
<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
|
34
34
|
<option value=\"Germany\">Germany</option>
|
35
35
|
<option value=\"France\">France</option></optgroup></select>"
|
@@ -47,9 +47,9 @@ class InputsTest < ActionView::TestCase
|
|
47
47
|
end
|
48
48
|
|
49
49
|
test "Multi Select Field data html options" do
|
50
|
-
grouped_options = { 'North America' => [['United
|
51
|
-
actual = UiBibz::Ui::Core::MultiSelectField.new('example', { option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_option: true,
|
52
|
-
expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" class=\"danger btn multi-select\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United
|
50
|
+
grouped_options = { 'North America' => [['United statuss','US'], 'Canada'], 'Europe' => ['Denmark','Germany','France'] }
|
51
|
+
actual = UiBibz::Ui::Core::MultiSelectField.new('example', { option_tags: grouped_options_for_select(grouped_options), clickable_opt_group: true, collapsible_opt_group: true, searchable: true, select_all_option: true, status: :danger }).render
|
52
|
+
expected = "<select name=\"example[]\" id=\"example\" data-enable-clickable-opt-groups=\"true\" data-enable-collapsible-opt-groups=\"true\" data-enable-filtering=\"true\" data-include-select-all-option=\"true\" class=\"danger btn multi-select\" multiple=\"multiple\"><optgroup label=\"North America\"><option value=\"US\">United statuss</option>
|
53
53
|
<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>
|
54
54
|
<option value=\"Germany\">Germany</option>
|
55
55
|
<option value=\"France\">France</option></optgroup></select>"
|
data/test/ui/list_group_test.rb
CHANGED
@@ -4,13 +4,13 @@ class ListGroupTest < ActionView::TestCase
|
|
4
4
|
|
5
5
|
test 'list_group with link' do
|
6
6
|
actual = UiBibz::Ui::Core::ListGroup.new(type: :link).tap do |lg|
|
7
|
-
lg.list 'Momo', {
|
8
|
-
lg.list({ tap: true, active: true, url: '#
|
7
|
+
lg.list 'Momo', { status: :success, url: '#momo' }
|
8
|
+
lg.list({ tap: true, active: true, url: '#state' }) do |l|
|
9
9
|
l.header 'My title'
|
10
10
|
l.body 'My body'
|
11
11
|
end
|
12
12
|
end.render
|
13
|
-
expected = "<div class=\"list-group\"><a class=\"list-group-item-success list-group-item\" href=\"#momo\">Momo</a><a type=\"link\" class=\"list-group-item\" href=\"#
|
13
|
+
expected = "<div class=\"list-group\"><a class=\"list-group-item-success list-group-item\" href=\"#momo\">Momo</a><a type=\"link\" class=\"list-group-item\" href=\"#state\"><h4 class=\"list-group-item-heading\">My title</h4><p class=\"list-group-item-text\">My body</p></a></div>"
|
14
14
|
|
15
15
|
assert_equal expected, actual
|
16
16
|
end
|
@@ -18,9 +18,9 @@ class ListGroupTest < ActionView::TestCase
|
|
18
18
|
test 'list_group' do
|
19
19
|
actual = UiBibz::Ui::Core::ListGroup.new().tap do |lg|
|
20
20
|
lg.list 'Lulu'
|
21
|
-
lg.list '
|
21
|
+
lg.list 'state'
|
22
22
|
end.render
|
23
|
-
expected = "<ul class=\"list-group\"><li class=\"list-group-item\">Lulu</li><li class=\"list-group-item\">
|
23
|
+
expected = "<ul class=\"list-group\"><li class=\"list-group-item\">Lulu</li><li class=\"list-group-item\">state</li></ul>"
|
24
24
|
|
25
25
|
assert_equal expected, actual
|
26
26
|
end
|
data/test/ui/nav_test.rb
CHANGED
@@ -4,7 +4,7 @@ class NavTest < ActionView::TestCase
|
|
4
4
|
|
5
5
|
test 'Nav with tab' do
|
6
6
|
actual = UiBibz::Ui::Core::Nav.new(type: :tabs).tap do |n|
|
7
|
-
n.link 'Home',
|
7
|
+
n.link 'Home', state: :active, url: "#Home", selector: 'home'
|
8
8
|
n.link 'Profile', url: "#profile", selector: 'profile'
|
9
9
|
n.link 'Messages', url: "#messages", selector: 'messages'
|
10
10
|
end.render
|
@@ -14,9 +14,9 @@ class NavTest < ActionView::TestCase
|
|
14
14
|
|
15
15
|
test 'Nav with pills' do
|
16
16
|
actual = UiBibz::Ui::Core::Nav.new(type: :pills, position: :justified).tap do |n|
|
17
|
-
n.link 'Home',
|
17
|
+
n.link 'Home', state: :active, url: "#Home", selector: 'home'
|
18
18
|
n.link 'Profile', url: "#profile", selector: 'profile', label: 16
|
19
|
-
n.link 'Messages', url: "#messages", selector: 'messages',
|
19
|
+
n.link 'Messages', url: "#messages", selector: 'messages', state: :disabled
|
20
20
|
end.render
|
21
21
|
expected = "<ul class=\"nav nav-pills pull-justified\"><li class=\"nav-item\"><a class=\"active nav-link\" href=\"#Home\">Home</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#profile\">Profile<span class=\"label-default pull-right label label-pill\">16</span></a></li><li class=\"nav-item\"><a class=\"disabled nav-link\" href=\"#messages\">Messages</a></li></ul>"
|
22
22
|
|
data/test/ui/stars_test.rb
CHANGED
@@ -15,8 +15,8 @@ class StarsTest < ActionView::TestCase
|
|
15
15
|
assert_equal expected, actual
|
16
16
|
end
|
17
17
|
|
18
|
-
test "stars with 3.6 with
|
19
|
-
actual = UiBibz::Ui::Core::Stars.new(3.6, {
|
18
|
+
test "stars with 3.6 with status danger" do
|
19
|
+
actual = UiBibz::Ui::Core::Stars.new(3.6, { status: :danger }).render
|
20
20
|
expected = "<span class=\"stars-notation\"><i class=\"glyph-danger glyph fa fa-star\"></i> <i class=\"glyph-danger glyph fa fa-star\"></i> <i class=\"glyph-danger glyph fa fa-star\"></i> <i class=\"glyph-danger glyph fa fa-star-half-o\"></i> <i class=\"glyph-danger glyph fa fa-star-o\"></i></span>"
|
21
21
|
assert_equal expected, actual
|
22
22
|
end
|
data/test/ui/table_test.rb
CHANGED
@@ -87,9 +87,9 @@ class TableTest < ActionView::TestCase
|
|
87
87
|
end
|
88
88
|
|
89
89
|
test 'table non searchable with a title and glyph' do
|
90
|
-
options = { searchable: false, glyph: '
|
90
|
+
options = { searchable: false, glyph: 'state', title: 'Title list' }
|
91
91
|
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
92
|
-
expected = "<div><div class=\"title\"><i class=\"glyph fa fa-
|
92
|
+
expected = "<div><div class=\"title\"><i class=\"glyph fa fa-state\"></i>Title list</div><br class=\"ui-bibz-clear\" /></div>"
|
93
93
|
|
94
94
|
assert_equal expected, actual
|
95
95
|
end
|
@@ -152,7 +152,7 @@ class TableTest < ActionView::TestCase
|
|
152
152
|
end
|
153
153
|
|
154
154
|
test 'complex table_card' do
|
155
|
-
actual = UiBibz::Ui::Ux::TableCard.new({ store: @users, tap: true }, { class: '
|
155
|
+
actual = UiBibz::Ui::Ux::TableCard.new({ store: @users, tap: true }, { class: 'state' }).tap do |pane|
|
156
156
|
pane.header 'Test header'
|
157
157
|
pane.block class: 'ui' do
|
158
158
|
'Test body'
|
@@ -161,7 +161,7 @@ class TableTest < ActionView::TestCase
|
|
161
161
|
end
|
162
162
|
|
163
163
|
test 'complex table_card with custom actions' do
|
164
|
-
actual = UiBibz::Ui::Ux::TableCard.new({ store: @users, tap: true }, { class: '
|
164
|
+
actual = UiBibz::Ui::Ux::TableCard.new({ store: @users, tap: true }, { class: 'state'}).tap do |pane|
|
165
165
|
pane.header 'Test header'
|
166
166
|
pane.block cls: 'ui' do
|
167
167
|
'Test body'
|
@@ -173,7 +173,7 @@ class TableTest < ActionView::TestCase
|
|
173
173
|
c.column(:name_en, { name: 'Name en', format: lambda{ |records, record| "name #{ record.id}"}})
|
174
174
|
end
|
175
175
|
pane.actions do |a|
|
176
|
-
a.link '
|
176
|
+
a.link 'state', url: users_path(:id), glyph: 'eye'
|
177
177
|
a.divider
|
178
178
|
a.link 'momo', url: users_path(:id), glyph: 'home'
|
179
179
|
end
|
@@ -195,7 +195,7 @@ class TableTest < ActionView::TestCase
|
|
195
195
|
end
|
196
196
|
|
197
197
|
test 'table visual options' do
|
198
|
-
table = UiBibz::Ui::Ux::Table.new(store: @users, striped: true,
|
198
|
+
table = UiBibz::Ui::Ux::Table.new(store: @users, striped: true, status: :inverse, responsive: true, bordered: true, size: :sm, hoverable: true, reflow: true).render
|
199
199
|
actual = Nokogiri::HTML(table).xpath("//table")[0].attributes["class"].value
|
200
200
|
expected = "table-inverse table table-striped table-bordered table-hoverable table-sm table-responsive table-reflow"
|
201
201
|
|
@@ -203,7 +203,7 @@ class TableTest < ActionView::TestCase
|
|
203
203
|
end
|
204
204
|
|
205
205
|
test 'table thead visual options' do
|
206
|
-
table = UiBibz::Ui::Ux::Table.new(store: @users, thead: {
|
206
|
+
table = UiBibz::Ui::Ux::Table.new(store: @users, thead: { status: :default }).render
|
207
207
|
actual = Nokogiri::HTML(table).xpath("//thead")[0].attributes["class"].value
|
208
208
|
expected = "thead-default"
|
209
209
|
|