ui_bibz 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.gitignore +1 -1
- data/.yardoc/checksums +52 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -21
- data/README.md +359 -239
- data/Rakefile +12 -13
- data/doc/UiBibz/Concerns/Models/Searchable/ClassMethods.html +174 -0
- data/doc/UiBibz/Concerns/Models/Searchable.html +120 -0
- data/doc/UiBibz/Helpers/MetaHelper.html +218 -0
- data/doc/UiBibz/Helpers/UiCoreHelper.html +1130 -0
- data/doc/UiBibz/Helpers/UiUxHelper.html +463 -0
- data/doc/UiBibz/Helpers/UtilsHelper.html +187 -0
- data/doc/UiBibz/Rails/Engine.html +123 -0
- data/doc/UiBibz/Rails.html +115 -0
- data/doc/UiBibz/Ui/Base.html +304 -0
- data/doc/UiBibz/Ui/Core/Alert.html +367 -0
- data/doc/UiBibz/Ui/Core/Bar.html +356 -0
- data/doc/UiBibz/Ui/Core/Breadcrumb.html +427 -0
- data/doc/UiBibz/Ui/Core/BreadcrumbLink.html +354 -0
- data/doc/UiBibz/Ui/Core/Button.html +363 -0
- data/doc/UiBibz/Ui/Core/ButtonDropdown.html +385 -0
- data/doc/UiBibz/Ui/Core/ButtonGroup.html +356 -0
- data/doc/UiBibz/Ui/Core/ButtonLink.html +365 -0
- data/doc/UiBibz/Ui/Core/ButtonSplitDropdown.html +387 -0
- data/doc/UiBibz/Ui/Core/Col.html +357 -0
- data/doc/UiBibz/Ui/Core/Component.html +1144 -0
- data/doc/UiBibz/Ui/Core/Dropdown.html +877 -0
- data/doc/UiBibz/Ui/Core/DropdownList.html +369 -0
- data/doc/UiBibz/Ui/Core/Glyph.html +742 -0
- data/doc/UiBibz/Ui/Core/Jumbotron.html +363 -0
- data/doc/UiBibz/Ui/Core/Label.html +361 -0
- data/doc/UiBibz/Ui/Core/List.html +486 -0
- data/doc/UiBibz/Ui/Core/ListGroup.html +446 -0
- data/doc/UiBibz/Ui/Core/Nav.html +474 -0
- data/doc/UiBibz/Ui/Core/NavDropdown.html +376 -0
- data/doc/UiBibz/Ui/Core/NavLink.html +347 -0
- data/doc/UiBibz/Ui/Core/Navbar.html +535 -0
- data/doc/UiBibz/Ui/Core/NavbarForm.html +341 -0
- data/doc/UiBibz/Ui/Core/NavbarNav.html +301 -0
- data/doc/UiBibz/Ui/Core/NavbarText.html +341 -0
- data/doc/UiBibz/Ui/Core/Panel.html +806 -0
- data/doc/UiBibz/Ui/Core/ProgressBar.html +433 -0
- data/doc/UiBibz/Ui/Core/Row.html +335 -0
- data/doc/UiBibz/Ui/Core.html +117 -0
- data/doc/UiBibz/Ui/Ux/Actionable.html +478 -0
- data/doc/UiBibz/Ui/Ux/Actions.html +314 -0
- data/doc/UiBibz/Ui/Ux/Column.html +1177 -0
- data/doc/UiBibz/Ui/Ux/Columns.html +312 -0
- data/doc/UiBibz/Ui/Ux/Grid.html +823 -0
- data/doc/UiBibz/Ui/Ux/Paginable.html +368 -0
- data/doc/UiBibz/Ui/Ux/Searchable.html +363 -0
- data/doc/UiBibz/Ui/Ux/Sortable.html +289 -0
- data/doc/UiBibz/Ui/Ux/Store.html +968 -0
- data/doc/UiBibz/Ui/Ux/Table.html +957 -0
- data/doc/UiBibz/Ui/Ux/TableAction.html +309 -0
- data/doc/UiBibz/Ui/Ux/TablePagination.html +319 -0
- data/doc/UiBibz/Ui/Ux/TablePaginationPerPage.html +331 -0
- data/doc/UiBibz/Ui/Ux/TablePanel.html +576 -0
- data/doc/UiBibz/Ui/Ux/TableSearchField.html +291 -0
- data/doc/UiBibz/Ui/Ux.html +117 -0
- data/doc/UiBibz/Ui.html +117 -0
- data/doc/UiBibz/Utils/Internationalization.html +262 -0
- data/doc/UiBibz/Utils.html +115 -0
- data/doc/UiBibz.html +129 -0
- data/doc/_index.html +635 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +1022 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/images/navbar.png +0 -0
- data/doc/index.html +1022 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1335 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/ui_bibz/helpers/ui_core_helper.rb +94 -0
- data/lib/ui_bibz/helpers/ui_ux_helper.rb +43 -0
- data/lib/ui_bibz/rails/engine.rb +2 -1
- data/lib/ui_bibz/ui/{ui.rb → base.rb} +1 -1
- data/lib/ui_bibz/ui/{alert.rb → core/alert.rb} +15 -7
- data/lib/ui_bibz/ui/core/breadcrumb/breadcrumb.rb +71 -0
- data/lib/ui_bibz/ui/{breadcrumb → core/breadcrumb}/components/breadcrumb_link.rb +6 -6
- data/lib/ui_bibz/ui/{button → core/button}/button.rb +13 -6
- data/lib/ui_bibz/ui/{button → core/button}/button_dropdown.rb +15 -4
- data/lib/ui_bibz/ui/{button → core/button}/button_group.rb +14 -6
- data/lib/ui_bibz/ui/{button → core/button}/button_link.rb +14 -6
- data/lib/ui_bibz/ui/{button → core/button}/button_split_dropdown.rb +15 -4
- data/lib/ui_bibz/ui/{grid/components → core}/col.rb +12 -6
- data/lib/ui_bibz/ui/{component.rb → core/component.rb} +7 -7
- data/lib/ui_bibz/ui/{dropdown → core/dropdown}/components/dropdown_list.rb +7 -7
- data/lib/ui_bibz/ui/{dropdown → core/dropdown}/dropdown.rb +18 -7
- data/lib/ui_bibz/ui/{glyph.rb → core/glyph.rb} +18 -10
- data/lib/ui_bibz/ui/{jumbotron.rb → core/jumbotron.rb} +14 -6
- data/lib/ui_bibz/ui/{label.rb → core/label.rb} +14 -6
- data/lib/ui_bibz/ui/{list → core/list}/components/list.rb +8 -8
- data/lib/ui_bibz/ui/{list → core/list}/list_group.rb +28 -6
- data/lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb +64 -0
- data/lib/ui_bibz/ui/{nav → core/nav}/components/nav_link.rb +6 -6
- data/lib/ui_bibz/ui/core/nav/components/navbar_form.rb +45 -0
- data/lib/ui_bibz/ui/core/nav/components/navbar_nav.rb +56 -0
- data/lib/ui_bibz/ui/core/nav/components/navbar_text.rb +45 -0
- data/lib/ui_bibz/ui/core/nav/nav.rb +90 -0
- data/lib/ui_bibz/ui/core/nav/navbar.rb +121 -0
- data/lib/ui_bibz/ui/{panel.rb → core/panel.rb} +36 -8
- data/lib/ui_bibz/ui/{progress_bar → core/progress_bar}/components/bar.rb +7 -7
- data/lib/ui_bibz/ui/{progress_bar → core/progress_bar}/progress_bar.rb +20 -9
- data/lib/ui_bibz/ui/{grid/components → core}/row.rb +12 -4
- data/lib/ui_bibz/ui/{grid → ux}/grid.rb +17 -8
- data/lib/ui_bibz/ui/{table → ux/table}/components/actions.rb +5 -5
- data/lib/ui_bibz/ui/ux/table/components/column.rb +34 -0
- data/lib/ui_bibz/ui/ux/table/components/columns.rb +16 -0
- data/lib/ui_bibz/ui/{table → ux/table}/components/store.rb +4 -4
- data/lib/ui_bibz/ui/{table → ux/table}/components/table_action.rb +2 -2
- data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/actionable.rb +3 -3
- data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/paginable.rb +5 -5
- data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/searchable.rb +4 -4
- data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/sortable.rb +3 -3
- data/lib/ui_bibz/ui/{table → ux/table}/table.rb +40 -22
- data/lib/ui_bibz/ui/ux/table/table_pagination.rb +51 -0
- data/lib/ui_bibz/ui/{table → ux/table}/table_pagination_per_page.rb +26 -4
- data/lib/ui_bibz/ui/ux/table/table_panel.rb +155 -0
- data/lib/ui_bibz/ui/{table → ux/table}/table_search_field.rb +7 -7
- data/lib/ui_bibz/version.rb +1 -1
- data/lib/ui_bibz.rb +40 -29
- data/test/store_test.rb +2 -2
- data/test/ui/button_test.rb +6 -6
- data/test/ui/component_test.rb +2 -2
- data/test/ui/dropdown_test.rb +1 -1
- data/test/ui/glyph_test.rb +3 -3
- data/test/ui/grid_test.rb +4 -4
- data/test/ui/list_group_test.rb +2 -2
- data/test/ui/nav_test.rb +3 -4
- data/test/ui/panel_test.rb +4 -4
- data/test/ui/table_test.rb +32 -32
- data/test/ui_helper_test.rb +18 -2
- data/ui_bibz.gemspec +1 -0
- data/vendor/assets/stylesheets/ui_bibz.sass +3 -0
- metadata +166 -132
- data/README.rdoc +0 -0
- data/lib/ui_bibz/helpers/ui_helper.rb +0 -119
- data/lib/ui_bibz/ui/breadcrumb/breadcrumb.rb +0 -54
- data/lib/ui_bibz/ui/nav/nav.rb +0 -65
- data/lib/ui_bibz/ui/table/components/column.rb +0 -34
- data/lib/ui_bibz/ui/table/components/columns.rb +0 -16
- data/lib/ui_bibz/ui/table/table_pagination.rb +0 -29
- data/lib/ui_bibz/ui/table/table_panel.rb +0 -66
data/test/ui/panel_test.rb
CHANGED
@@ -7,14 +7,14 @@ class PanelTest < ActionView::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
test 'simple panel' do
|
10
|
-
actual = UiBibz::Ui::Panel.new(@content).render
|
10
|
+
actual = UiBibz::Ui::Core::Panel.new(@content).render
|
11
11
|
expected = "<div class=\"panel-default panel\"><div class=\"panel-body\">#{ @content }</div></div>"
|
12
12
|
|
13
13
|
assert_equal expected, actual
|
14
14
|
end
|
15
15
|
|
16
16
|
test 'simple panel with block' do
|
17
|
-
actual = UiBibz::Ui::Panel.new do
|
17
|
+
actual = UiBibz::Ui::Core::Panel.new do
|
18
18
|
@content
|
19
19
|
end.render
|
20
20
|
expected = "<div class=\"panel-default panel\"><div class=\"panel-body\">#{ @content }</div></div>"
|
@@ -23,7 +23,7 @@ class PanelTest < ActionView::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
test 'simple panel with tap' do
|
26
|
-
actual = UiBibz::Ui::Panel.new().tap do |p|
|
26
|
+
actual = UiBibz::Ui::Core::Panel.new().tap do |p|
|
27
27
|
p.body @content
|
28
28
|
end.render
|
29
29
|
expected = "<div class=\"panel-default panel\"><div class=\"panel-body\">#{ @content }</div></div>"
|
@@ -32,7 +32,7 @@ class PanelTest < ActionView::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
test 'complex panel with tap' do
|
35
|
-
actual = UiBibz::Ui::Panel.new({state: :danger}, { class: 'example'}).tap do |p|
|
35
|
+
actual = UiBibz::Ui::Core::Panel.new({state: :danger}, { class: 'example'}).tap do |p|
|
36
36
|
p.header 'header', class: 'header-example'
|
37
37
|
p.body class: 'body-example' do
|
38
38
|
@content
|
data/test/ui/table_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require "ui_bibz/ui/table/components/store"
|
3
|
-
require "ui_bibz/ui/table/
|
4
|
-
require "ui_bibz/ui/table/
|
5
|
-
require "ui_bibz/ui/table/
|
6
|
-
require "ui_bibz/ui/table/
|
2
|
+
require "ui_bibz/ui/ux/table/components/store"
|
3
|
+
require "ui_bibz/ui/ux/table/extensions/paginable"
|
4
|
+
require "ui_bibz/ui/ux/table/extensions/searchable"
|
5
|
+
require "ui_bibz/ui/ux/table/extensions/sortable"
|
6
|
+
require "ui_bibz/ui/ux/table/extensions/actionable"
|
7
7
|
include UiBibz::Helpers
|
8
8
|
class TableTest < ActionView::TestCase
|
9
9
|
|
@@ -19,18 +19,18 @@ class TableTest < ActionView::TestCase
|
|
19
19
|
page: 1
|
20
20
|
}
|
21
21
|
@users = User.table_search_pagination(params, session)
|
22
|
-
@store = UiBibz::Ui::Store.new @users
|
22
|
+
@store = UiBibz::Ui::Ux::Store.new @users
|
23
23
|
end
|
24
24
|
|
25
25
|
test 'table search field' do
|
26
|
-
actual = UiBibz::Ui::TableSearchField.new({ store: @users}).render
|
27
|
-
expected = "<form action=\"/users\" accept-charset=\"UTF-8\" method=\"get\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-search\"></i></span><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by name_fr and name_en...\" /><span class=\"clear-search-btn input-group-addon\"><i class=\"glyph fa fa-times-circle\"></i></span></div></form>"
|
26
|
+
actual = UiBibz::Ui::Ux::TableSearchField.new({ store: @users}).render
|
27
|
+
expected = "<form class=\"form-table-search-field\" action=\"/users\" accept-charset=\"UTF-8\" method=\"get\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-search\"></i></span><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by name_fr and name_en...\" /><span class=\"clear-search-btn input-group-addon\"><i class=\"glyph fa fa-times-circle\"></i></span></div></form>"
|
28
28
|
|
29
29
|
assert_equal expected, actual
|
30
30
|
end
|
31
31
|
|
32
32
|
test 'table pagination' do
|
33
|
-
actual = UiBibz::Ui::TablePagination.new({ store: @users}).render
|
33
|
+
actual = UiBibz::Ui::Ux::TablePagination.new({ store: @users }).render
|
34
34
|
expected = "<ul class=\"pagination pagination\"><li class=\"prev disabled\"><span>← Previous</span></li> <li class=\"active\"><span>1</span></li> <li><a rel=\"next\" href=\"/users?page=2\">2</a></li> <li><a href=\"/users?page=3\">3</a></li> <li><a href=\"/users?page=4\">4</a></li> <li><a href=\"/users?page=5\">5</a></li> <li><a href=\"/users?page=6\">6</a></li> <li><a href=\"/users?page=7\">7</a></li> <li><a href=\"/users?page=8\">8</a></li> <li><a href=\"/users?page=9\">9</a></li> <li class=\"disabled\"><span>…</span></li> <li><a href=\"/users?page=12\">12</a></li> <li><a href=\"/users?page=13\">13</a></li> <li class=\"next\"><a rel=\"next\" href=\"/users?page=2\">Next →</a></li></ul>"
|
35
35
|
|
36
36
|
assert_equal expected, actual
|
@@ -38,7 +38,7 @@ class TableTest < ActionView::TestCase
|
|
38
38
|
|
39
39
|
test 'table non sortable' do
|
40
40
|
options = { sortable: false }
|
41
|
-
actual = UiBibz::Ui::Sortable.new(@store, options).header(@store.columns.list.first)
|
41
|
+
actual = UiBibz::Ui::Ux::Sortable.new(@store, options).header(@store.columns.list.first)
|
42
42
|
expected = "Id"
|
43
43
|
|
44
44
|
assert_equal expected, actual
|
@@ -46,7 +46,7 @@ class TableTest < ActionView::TestCase
|
|
46
46
|
|
47
47
|
test 'table sortable' do
|
48
48
|
options = { sortable: true }
|
49
|
-
actual = UiBibz::Ui::Sortable.new(@store, options).header(@store.columns.list.first)
|
49
|
+
actual = UiBibz::Ui::Ux::Sortable.new(@store, options).header(@store.columns.list.first)
|
50
50
|
expected = "<a class=\"dropup\" href=\"/users?direction=asc&search=Name+fr&sort=users.id\">Id</a>"
|
51
51
|
|
52
52
|
assert_equal expected, actual
|
@@ -54,7 +54,7 @@ class TableTest < ActionView::TestCase
|
|
54
54
|
|
55
55
|
test 'table non paginable' do
|
56
56
|
options = { paginable: false }
|
57
|
-
pagination = UiBibz::Ui::Paginable.new(@store, options)
|
57
|
+
pagination = UiBibz::Ui::Ux::Paginable.new(@store, options)
|
58
58
|
actual = pagination.render if pagination.paginable?
|
59
59
|
expected = nil
|
60
60
|
|
@@ -63,42 +63,42 @@ class TableTest < ActionView::TestCase
|
|
63
63
|
|
64
64
|
test 'table paginable' do
|
65
65
|
options = { paginable: true }
|
66
|
-
pagination = UiBibz::Ui::Paginable.new(@store, options)
|
66
|
+
pagination = UiBibz::Ui::Ux::Paginable.new(@store, options)
|
67
67
|
actual = pagination.render if pagination.paginable?
|
68
68
|
expected = "<div><ul class=\"pagination pagination\"><li class=\"prev disabled\"><span>← Previous</span></li> <li class=\"active\"><span>1</span></li> <li><a rel=\"next\" href=\"/users?page=2\">2</a></li> <li><a href=\"/users?page=3\">3</a></li> <li><a href=\"/users?page=4\">4</a></li> <li><a href=\"/users?page=5\">5</a></li> <li><a href=\"/users?page=6\">6</a></li> <li><a href=\"/users?page=7\">7</a></li> <li><a href=\"/users?page=8\">8</a></li> <li><a href=\"/users?page=9\">9</a></li> <li class=\"disabled\"><span>…</span></li> <li><a href=\"/users?page=12\">12</a></li> <li><a href=\"/users?page=13\">13</a></li> <li class=\"next\"><a rel=\"next\" href=\"/users?page=2\">Next →</a></li></ul><form action=\"/users\" accept-charset=\"UTF-8\" method=\"get\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><div class=\"table-pagination-per-page\">Displaying User <b>1 - 2</b> of <b>25</b> in total | Per page: <select name=\"per_page\" id=\"per_page\" class=\"form-control\"><option value=\"25\">25</option>
|
69
69
|
<option value=\"50\">50</option>
|
70
|
-
<option value=\"100\">100</option></select></div></form><br class=\"clear\" /></div>"
|
70
|
+
<option value=\"100\">100</option></select></div></form><br class=\"ui-bibz-clear\" /></div>"
|
71
71
|
|
72
72
|
assert_equal expected, actual
|
73
73
|
end
|
74
74
|
|
75
75
|
test 'table non searchable' do
|
76
76
|
options = { searchable: false }
|
77
|
-
actual = UiBibz::Ui::Searchable.new(@store, options).render
|
78
|
-
expected = "<div><div class=\"title\">Users list</div><br class=\"clear\" /></div>"
|
77
|
+
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
78
|
+
expected = "<div><div class=\"title\">Users list</div><br class=\"ui-bibz-clear\" /></div>"
|
79
79
|
|
80
80
|
assert_equal expected, actual
|
81
81
|
end
|
82
82
|
|
83
83
|
test 'table non searchable with a title and glyph' do
|
84
84
|
options = { searchable: false, glyph: 'toto', title: 'Title list' }
|
85
|
-
actual = UiBibz::Ui::Searchable.new(@store, options).render
|
86
|
-
expected = "<div><div class=\"title\"><i class=\"glyph fa fa-toto\"></i>Title list</div><br class=\"clear\" /></div>"
|
85
|
+
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
86
|
+
expected = "<div><div class=\"title\"><i class=\"glyph fa fa-toto\"></i>Title list</div><br class=\"ui-bibz-clear\" /></div>"
|
87
87
|
|
88
88
|
assert_equal expected, actual
|
89
89
|
end
|
90
90
|
|
91
91
|
test 'table searchable' do
|
92
92
|
options = { searchable: true }
|
93
|
-
actual = UiBibz::Ui::Searchable.new(@store, options).render
|
94
|
-
expected = "<div><div class=\"title\">Users list</div><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-search\"></i></span><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by name_fr and name_en...\" /><span class=\"clear-search-btn input-group-addon\"><i class=\"glyph fa fa-times-circle\"></i></span></div><br class=\"clear\" /></div>"
|
93
|
+
actual = UiBibz::Ui::Ux::Searchable.new(@store, options).render
|
94
|
+
expected = "<div><div class=\"title\">Users list</div><div class=\"input-group input-group-sm table-search-field\"><span class=\"input-group-addon\"><i class=\"glyph fa fa-search\"></i></span><input type=\"search\" value=\"Name fr\" name=\"search\" class=\"form-control\" placeholder=\"Search by name_fr and name_en...\" /><span class=\"clear-search-btn input-group-addon\"><i class=\"glyph fa fa-times-circle\"></i></span></div><br class=\"ui-bibz-clear\" /></div>"
|
95
95
|
|
96
96
|
assert_equal expected, actual
|
97
97
|
end
|
98
98
|
|
99
99
|
test 'table actionable header' do
|
100
100
|
options = { actionable: true }
|
101
|
-
action = UiBibz::Ui::Actionable.new(@store, options)
|
101
|
+
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
102
102
|
actual = action.header []
|
103
103
|
expected = ["<th class=\"action\"></th>"]
|
104
104
|
|
@@ -107,7 +107,7 @@ class TableTest < ActionView::TestCase
|
|
107
107
|
|
108
108
|
test 'table actionable body' do
|
109
109
|
options = { actionable: true }
|
110
|
-
action = UiBibz::Ui::Actionable.new(@store, options)
|
110
|
+
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
111
111
|
actual = action.body @store.records.first, []
|
112
112
|
expected = ["<td><div class=\"btn-group-xs dropdown-action dropdown\"><button class=\"btn btn-default dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-expanded=\"false\"><i class=\"glyph fa fa-ellipsis-v fa-fw\"></i> Actions <span class=\"caret\"></span></button><ul class=\"dropdown-menu dropdown-menu-right\" role=\"menu\"></ul></div></td>"]
|
113
113
|
|
@@ -116,7 +116,7 @@ class TableTest < ActionView::TestCase
|
|
116
116
|
|
117
117
|
test 'table actionable inject_url' do
|
118
118
|
options = { actionable: true }
|
119
|
-
action = UiBibz::Ui::Actionable.new(@store, options)
|
119
|
+
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
120
120
|
actual = action.inject_url 'http://localhost/users/id/test', @store.records.first
|
121
121
|
expected = "http://localhost/users/1/test"
|
122
122
|
|
@@ -125,7 +125,7 @@ class TableTest < ActionView::TestCase
|
|
125
125
|
|
126
126
|
test 'table non actionable header' do
|
127
127
|
options = { actionable: false }
|
128
|
-
action = UiBibz::Ui::Actionable.new(@store, options)
|
128
|
+
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
129
129
|
actual = action.header []
|
130
130
|
expected = []
|
131
131
|
|
@@ -134,7 +134,7 @@ class TableTest < ActionView::TestCase
|
|
134
134
|
|
135
135
|
test 'table non actionable body' do
|
136
136
|
options = { actionable: false }
|
137
|
-
action = UiBibz::Ui::Actionable.new(@store, options)
|
137
|
+
action = UiBibz::Ui::Ux::Actionable.new(@store, options)
|
138
138
|
actual = action.body @store.records.first, []
|
139
139
|
expected = []
|
140
140
|
|
@@ -142,11 +142,11 @@ class TableTest < ActionView::TestCase
|
|
142
142
|
end
|
143
143
|
|
144
144
|
test 'simple table_panel' do
|
145
|
-
actual = UiBibz::Ui::TablePanel.new(store: @users, tap: true).render
|
145
|
+
actual = UiBibz::Ui::Ux::TablePanel.new(store: @users, tap: true).render
|
146
146
|
end
|
147
147
|
|
148
148
|
test 'complex table_panel' do
|
149
|
-
actual = UiBibz::Ui::TablePanel.new({ store: @users, tap: true }, { class: 'toto' }).tap do |pane|
|
149
|
+
actual = UiBibz::Ui::Ux::TablePanel.new({ store: @users, tap: true }, { class: 'toto' }).tap do |pane|
|
150
150
|
pane.header 'Test header'
|
151
151
|
pane.body class: 'ui' do
|
152
152
|
'Test body'
|
@@ -155,16 +155,16 @@ class TableTest < ActionView::TestCase
|
|
155
155
|
end
|
156
156
|
|
157
157
|
test 'complex table_panel with custom actions' do
|
158
|
-
actual = UiBibz::Ui::TablePanel.new({ store: @users, tap: true }, { class: 'toto'}).tap do |pane|
|
158
|
+
actual = UiBibz::Ui::Ux::TablePanel.new({ store: @users, tap: true }, { class: 'toto'}).tap do |pane|
|
159
159
|
pane.header 'Test header'
|
160
160
|
pane.body cls: 'ui' do
|
161
161
|
'Test body'
|
162
162
|
end
|
163
163
|
pane.columns do |c|
|
164
|
-
c.column(
|
165
|
-
c.column(
|
166
|
-
c.column(
|
167
|
-
c.column(
|
164
|
+
c.column('#', { data_index: 'id' })
|
165
|
+
c.column('Name fr', { data_index: 'name_fr', link: edit_user_path(:id), order: 2 })
|
166
|
+
c.column('Name en', { data_index: 'name_en', order: 1 })
|
167
|
+
c.column('Name en', { data_index: 'name_en', format: lambda{ |records, record| "name #{ record.id}"}})
|
168
168
|
end
|
169
169
|
pane.actions do |a|
|
170
170
|
a.action 'toto', url: users_path(:id), glyph: 'eye'
|
data/test/ui_helper_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
include UiBibz::Helpers
|
3
|
+
include UiBibz::Helpers::UiCoreHelper
|
4
4
|
class UiHelperTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test 'breadcrumb' do
|
@@ -48,8 +48,24 @@ class UiHelperTest < ActionView::TestCase
|
|
48
48
|
assert_equal expected, actual
|
49
49
|
end
|
50
50
|
|
51
|
+
test 'navbar' do
|
52
|
+
actual = navbar(title: 'My title', position: :bottom, type: :inverse, glyph: 'pencil') do |nb|
|
53
|
+
nb.nav do |n|
|
54
|
+
n.link 'Toto', url: '#'
|
55
|
+
n.link 'Tata', url: '#'
|
56
|
+
end
|
57
|
+
nb.nav(position: :right) do |n|
|
58
|
+
n.link 'lala', url: '#'
|
59
|
+
n.link 'lolo', url: '#'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
expected = "<nav class=\"navbar navbar-inverse navbar-fixed-bottom\"><div class=\"container-fluid\"><div class=\"navbar-header\"><button class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar-collapse-57604740876218660627112051613797907862\"><span class=\"sr-only\">Toggle navigation</span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"navbar-brand\" href=\"#\"><i class=\"glyph fa fa-pencil\"></i> My title</a></div><div class=\"collapse navbar-collapse\" id=\"navbar-collapse-57604740876218660627112051613797907862\"><ul class=\"nav navbar-nav\"><li role=\"presentation\"><a href=\"#\">Toto</a></li><li role=\"presentation\"><a href=\"#\">Tata</a></li></ul><ul class=\"nav navbar-nav nav-right\"><li role=\"presentation\"><a href=\"#\">lala</a></li><li role=\"presentation\"><a href=\"#\">lolo</a></li></ul></div></div></nav>"
|
63
|
+
|
64
|
+
refute_equal expected, actual
|
65
|
+
end
|
66
|
+
|
51
67
|
test 'progress bar with several bars' do
|
52
|
-
actual
|
68
|
+
actual = progress_bar(tap: true) do |pb|
|
53
69
|
pb.bar 20, type: :animated
|
54
70
|
pb.bar 30, state: :success
|
55
71
|
pb.bar 10, type: :striped
|
data/ui_bibz.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency 'sass-rails', '~> 5.0.1'
|
30
30
|
|
31
31
|
s.add_development_dependency "minitest"
|
32
|
+
s.add_development_dependency "rdoc"
|
32
33
|
s.add_development_dependency "sqlite3"
|
33
34
|
s.add_development_dependency "factory_girl_rails", "~> 4.0"
|
34
35
|
s.add_development_dependency "codeclimate-test-reporter"
|