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
@@ -1,17 +1,17 @@
|
|
1
|
-
require "ui_bibz/ui/table/components/store"
|
2
|
-
require "ui_bibz/ui/table/components/columns"
|
3
|
-
require "ui_bibz/ui/table/components/column"
|
4
|
-
require "ui_bibz/ui/table/components/actions"
|
5
|
-
require "ui_bibz/ui/table/
|
6
|
-
require "ui_bibz/ui/table/
|
7
|
-
require "ui_bibz/ui/table/
|
8
|
-
require "ui_bibz/ui/table/
|
9
|
-
require "ui_bibz/ui/table/
|
10
|
-
module UiBibz::Ui
|
1
|
+
require "ui_bibz/ui/ux/table/components/store"
|
2
|
+
require "ui_bibz/ui/ux/table/components/columns"
|
3
|
+
require "ui_bibz/ui/ux/table/components/column"
|
4
|
+
require "ui_bibz/ui/ux/table/components/actions"
|
5
|
+
require "ui_bibz/ui/ux/table/extensions/paginable"
|
6
|
+
require "ui_bibz/ui/ux/table/extensions/paginable"
|
7
|
+
require "ui_bibz/ui/ux/table/extensions/searchable"
|
8
|
+
require "ui_bibz/ui/ux/table/extensions/sortable"
|
9
|
+
require "ui_bibz/ui/ux/table/extensions/actionable"
|
10
|
+
module UiBibz::Ui::Ux
|
11
11
|
|
12
12
|
# Create a Table
|
13
13
|
#
|
14
|
-
# This element is an extend of UiBibz::Ui::Component.
|
14
|
+
# This element is an extend of UiBibz::Ui::Ux::Component.
|
15
15
|
#
|
16
16
|
# ==== Attributes
|
17
17
|
#
|
@@ -31,36 +31,54 @@ module UiBibz::Ui
|
|
31
31
|
#
|
32
32
|
# ==== Signatures
|
33
33
|
#
|
34
|
-
# UiBibz::Ui::Table.new(store: @store)
|
34
|
+
# UiBibz::Ui::Ux::Table.new(store: @store)
|
35
35
|
#
|
36
|
-
# UiBibz::Ui::Table.new(store: @store, tap: true) do |t|
|
36
|
+
# UiBibz::Ui::Ux::Table.new(store: @store, tap: true) do |t|
|
37
37
|
# t.columns do |c|
|
38
38
|
# c.column name: '#', data_index: '#'
|
39
39
|
# end
|
40
|
-
# t.
|
40
|
+
# t.actions do |a|
|
41
41
|
# a.action '', url: url, glyph: ''
|
42
42
|
# end
|
43
43
|
# end
|
44
44
|
#
|
45
45
|
# ==== Examples
|
46
46
|
#
|
47
|
-
# UiBibz::Ui::Table.new(store: @users).render
|
47
|
+
# UiBibz::Ui::Ux::Table.new(store: @users).render
|
48
48
|
#
|
49
|
-
# UiBibz::Ui::Table.new(store: @users).tap do |t|
|
49
|
+
# UiBibz::Ui::Ux::Table.new(store: @users).tap do |t|
|
50
50
|
# t.columns do |c|
|
51
|
-
# c.column
|
52
|
-
# c.column
|
53
|
-
# c.column
|
54
|
-
# c.column
|
51
|
+
# c.column '#', { data_index: 'id' }
|
52
|
+
# c.column 'Name fr', { data_index: 'name_fr', link: edit_user_path(:id), order: 2 }
|
53
|
+
# c.column 'Name en', { data_index: 'name_en', order: 1 }
|
54
|
+
# c.column 'Name en', { data_index: 'name_en', format: lambda{ |records, record| "name #{ record.id}"} }
|
55
55
|
# end
|
56
|
-
# t.
|
56
|
+
# t.actions do |a|
|
57
57
|
# a.action 'toto', url: users_path(:id), glyph: 'eye'
|
58
58
|
# a.action '---'
|
59
59
|
# a.action 'momo', url: users_path(:id), glyph: 'home'
|
60
60
|
# end
|
61
61
|
# end.render
|
62
62
|
#
|
63
|
-
|
63
|
+
# ==== Helper
|
64
|
+
#
|
65
|
+
# table(options = {}, html_options = {})
|
66
|
+
#
|
67
|
+
# table(options = { tap: true }, html_options = {}) do |t|
|
68
|
+
# t.columns do |cls|
|
69
|
+
# cls.column(name, options = {}, html_options = {})
|
70
|
+
# cls.column(options = {}, html_options = {}) do
|
71
|
+
# name
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
# t.actions do |acs|
|
75
|
+
# acs.action(content, options = {}, html_options = {})
|
76
|
+
# acs.action(options = {}, html_options = {}) do
|
77
|
+
# content
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
class Table < UiBibz::Ui::Core::Component
|
64
82
|
|
65
83
|
attr_accessor :columns
|
66
84
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'will_paginate'
|
2
|
+
require "will_paginate-bootstrap"
|
3
|
+
require "ui_bibz/ui/ux/table/components/store"
|
4
|
+
module UiBibz::Ui::Ux
|
5
|
+
|
6
|
+
# Create a pagination for table
|
7
|
+
#
|
8
|
+
# ==== Attributes
|
9
|
+
#
|
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
|
+
# * +store+ - Store generate by '+table_search_pagination+' method
|
18
|
+
#
|
19
|
+
# ==== Signatures
|
20
|
+
#
|
21
|
+
# UiBibz::Ui::Ux::TablePagination.new(store: @store)
|
22
|
+
#
|
23
|
+
# ==== Helper
|
24
|
+
#
|
25
|
+
# table_pagination(options = {})
|
26
|
+
#
|
27
|
+
class TablePagination < UiBibz::Ui::Base
|
28
|
+
include WillPaginate::ActionView
|
29
|
+
|
30
|
+
def initialize options = nil, html_options = nil
|
31
|
+
@pagination = UiBibz::Ui::Core::Component.new nil, options, html_options
|
32
|
+
end
|
33
|
+
|
34
|
+
def render
|
35
|
+
will_paginate(store.records, params: { controller: store.controller }, renderer: BootstrapPagination::Rails)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def store
|
41
|
+
@store ||= if @pagination.options[:store].nil?
|
42
|
+
raise 'Store is nil!'
|
43
|
+
elsif @pagination.options[:store].try(:records).nil?
|
44
|
+
raise 'Store can be created only with "table_search_pagination" method!'
|
45
|
+
else
|
46
|
+
Store.new @pagination.options.delete :store
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -1,10 +1,32 @@
|
|
1
|
-
require "ui_bibz/ui/table/components/store"
|
2
|
-
module UiBibz::Ui
|
3
|
-
|
1
|
+
require "ui_bibz/ui/ux/table/components/store"
|
2
|
+
module UiBibz::Ui::Ux
|
3
|
+
|
4
|
+
# Create a select pagination per page
|
5
|
+
#
|
6
|
+
# ==== Attributes
|
7
|
+
#
|
8
|
+
# * +options+ - Options of element
|
9
|
+
# * +html_options+ - Html Options of element
|
10
|
+
#
|
11
|
+
# ==== Options
|
12
|
+
#
|
13
|
+
# You can add HTML attributes using the +html_options+.
|
14
|
+
# You can pass arguments in options attribute:
|
15
|
+
# * +store+ - Store generate by '+table_search_pagination+' method
|
16
|
+
#
|
17
|
+
# ==== Signatures
|
18
|
+
#
|
19
|
+
# UiBibz::Ui::Ux::TablePaginationPerPage.new(store: @store)
|
20
|
+
#
|
21
|
+
# ==== Helper
|
22
|
+
#
|
23
|
+
# table_pagination_per_page(options = {})
|
24
|
+
#
|
25
|
+
class TablePaginationPerPage < UiBibz::Ui::Base
|
4
26
|
include WillPaginate::ActionView
|
5
27
|
|
6
28
|
def initialize options = nil, html_options = nil
|
7
|
-
@per_page_field = Component.new nil, options, html_options
|
29
|
+
@per_page_field = UiBibz::Ui::Core::Component.new nil, options, html_options
|
8
30
|
end
|
9
31
|
|
10
32
|
def render
|
@@ -0,0 +1,155 @@
|
|
1
|
+
module UiBibz::Ui::Ux
|
2
|
+
|
3
|
+
# Create a TablePanel
|
4
|
+
#
|
5
|
+
# This element is an extend of UiBibz::Ui::Ux::Panel.
|
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
|
+
# * +store+ - Store generate by '+table_search_pagination+' method
|
18
|
+
# * +url+ - String
|
19
|
+
# * tap - Boolean
|
20
|
+
# * columns - Add column
|
21
|
+
# * actions - Add action by row
|
22
|
+
#
|
23
|
+
# ==== Signatures
|
24
|
+
#
|
25
|
+
# UiBibz::Ui::Ux::TablePanel.new(store: @store)
|
26
|
+
#
|
27
|
+
# UiBibz::Ui::Ux::TablePanel.new(store: @store, tap: true) do |t|
|
28
|
+
# t.columns do |c|
|
29
|
+
# c.column '#', { data_index: '#' }
|
30
|
+
# end
|
31
|
+
# t.actions do |a|
|
32
|
+
# a.action '', url: url, glyph: ''
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# ==== Examples
|
37
|
+
#
|
38
|
+
# UiBibz::Ui::Ux::TablePanel.new(store: @users, pagination).render
|
39
|
+
#
|
40
|
+
# UiBibz::Ui::Ux::TablePanel.new(store: @users).tap do |t|
|
41
|
+
# t.header 'My Table panel'
|
42
|
+
# t.columns do |c|
|
43
|
+
# c.column '#', { data_index: 'id' }, { class: 'column-id' }
|
44
|
+
# c.column 'Name fr', { data_index: 'name_fr', link: edit_user_path(:id), order: 2 }
|
45
|
+
# c.column 'Name en', { data_index: 'name_en', order: 1 }
|
46
|
+
# c.column 'Name en', { data_index: 'name_en', format: lambda{ |records, record| "name #{ record.id}"} }
|
47
|
+
# end
|
48
|
+
# t.actions do |a|
|
49
|
+
# a.action 'toto', url: users_path(:id), glyph: 'eye'
|
50
|
+
# a.action '---'
|
51
|
+
# a.action 'momo', url: users_path(:id), glyph: 'home'
|
52
|
+
# end
|
53
|
+
# end.render
|
54
|
+
#
|
55
|
+
# ==== Helper
|
56
|
+
#
|
57
|
+
# table_panel(options = {}, html_options = {})
|
58
|
+
#
|
59
|
+
# table_panel(options = { tap: true }, html_options = {}) do |t|
|
60
|
+
# t.header(content, options = {}, html_options = {})
|
61
|
+
# # or
|
62
|
+
# t.header(options = {}, html_options = {}) do
|
63
|
+
# content
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# t.body(content, options = {}, html_options = {})
|
67
|
+
# # or
|
68
|
+
# t.body(options = {}, html_options = {}) do
|
69
|
+
# content
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# t.columns do |cls|
|
73
|
+
# cls.column(name, options = {}, html_options = {})
|
74
|
+
# cls.column(options = {}, html_options = {}) do
|
75
|
+
# name
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
# t.actions do |acs|
|
79
|
+
# acs.action(name, options = {}, html_options = {})
|
80
|
+
# acs.action(options = {}, html_options = {}) do
|
81
|
+
# content
|
82
|
+
# end
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# t.footer(content, options = {}, html_options = {})
|
86
|
+
# # or
|
87
|
+
# t.footer(options = {}, html_options = {}) do
|
88
|
+
# content
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
class TablePanel < UiBibz::Ui::Core::Panel
|
92
|
+
|
93
|
+
attr_accessor :columns
|
94
|
+
|
95
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
96
|
+
super
|
97
|
+
@store = @options.delete(:store) if @options[:store]
|
98
|
+
table_options = (@options[:table_options] || {}).merge({ store: @store })
|
99
|
+
@table = UiBibz::Ui::Ux::Table.new(table_options, @options[:table_html_options])
|
100
|
+
end
|
101
|
+
|
102
|
+
def render
|
103
|
+
initialize_header
|
104
|
+
initialize_footer
|
105
|
+
|
106
|
+
content_tag :div, class_and_html_options(panel_classes) do |f|
|
107
|
+
form_tag(url_for(controller: @store.controller, action: @store.action), method: :get) do
|
108
|
+
concat(header_html) unless @header.nil?
|
109
|
+
concat(body_html) unless @body.nil?
|
110
|
+
concat(table_html) unless @store.nil?
|
111
|
+
concat(footer_html) unless @footer.nil?
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def columns &block
|
117
|
+
@table.columns &block
|
118
|
+
end
|
119
|
+
|
120
|
+
def actions &block
|
121
|
+
@table.actions &block
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def table_html
|
127
|
+
content_tag :div, @table.render, class: 'panel-table'
|
128
|
+
end
|
129
|
+
|
130
|
+
def panel_classes
|
131
|
+
%w(panel panel-default table-panel)
|
132
|
+
end
|
133
|
+
|
134
|
+
def search
|
135
|
+
@search ||= Searchable.new @store, @options
|
136
|
+
end
|
137
|
+
|
138
|
+
def pagination
|
139
|
+
@pagination ||= Paginable.new @store, @options
|
140
|
+
end
|
141
|
+
|
142
|
+
def initialize_footer
|
143
|
+
@footer = @table.pagination
|
144
|
+
end
|
145
|
+
|
146
|
+
def initialize_header
|
147
|
+
@header = UiBibz::Ui::Core::Component.new search.render
|
148
|
+
end
|
149
|
+
|
150
|
+
def initialize_footer
|
151
|
+
@footer = UiBibz::Ui::Core::Component.new(pagination.render) if pagination.paginable?
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require "ui_bibz/ui/table/components/store"
|
2
|
-
module UiBibz::Ui
|
3
|
-
class TableSearchField < Ui
|
1
|
+
require "ui_bibz/ui/ux/table/components/store"
|
2
|
+
module UiBibz::Ui::Ux
|
3
|
+
class TableSearchField < UiBibz::Ui::Base
|
4
4
|
|
5
5
|
def initialize options = nil, html_options = nil
|
6
|
-
@search_field = Component.new nil, options, html_options
|
6
|
+
@search_field = UiBibz::Ui::Core::Component.new nil, options, html_options
|
7
7
|
end
|
8
8
|
|
9
9
|
def render
|
10
10
|
if @search_field.options[:wrap_form] != false
|
11
|
-
form_tag(url_for(controller: store.controller, action: store.action), method: :get) do
|
11
|
+
form_tag(url_for(controller: store.controller, action: store.action), method: :get, class: 'form-table-search-field') do
|
12
12
|
search_field_html
|
13
13
|
end
|
14
14
|
else
|
@@ -30,9 +30,9 @@ module UiBibz::Ui
|
|
30
30
|
|
31
31
|
def search_field_html
|
32
32
|
content_tag :div, @search_field.class_and_html_options(div_class) do
|
33
|
-
concat content_tag(:span, Glyph.new('search').render, class: 'input-group-addon')
|
33
|
+
concat content_tag(:span, UiBibz::Ui::Core::Glyph.new('search').render, class: 'input-group-addon')
|
34
34
|
concat tag(:input, type: 'search', value: store.search, name: 'search', class: 'form-control', placeholder: search_placeholder_field)
|
35
|
-
concat content_tag(:span, Glyph.new('times-circle').render, class: 'clear-search-btn input-group-addon')
|
35
|
+
concat content_tag(:span, UiBibz::Ui::Core::Glyph.new('times-circle').render, class: 'clear-search-btn input-group-addon')
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
data/lib/ui_bibz/version.rb
CHANGED
data/lib/ui_bibz.rb
CHANGED
@@ -7,38 +7,49 @@ module UiBibz
|
|
7
7
|
mattr_accessor :app_root
|
8
8
|
|
9
9
|
module Ui
|
10
|
-
|
11
|
-
autoload :
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
10
|
+
# Base
|
11
|
+
autoload :Base, "ui_bibz/ui/base"
|
12
|
+
|
13
|
+
# Core
|
14
|
+
module Core
|
15
|
+
autoload :Alert, "ui_bibz/ui/core/alert"
|
16
|
+
autoload :Breadcrumb, "ui_bibz/ui/core/breadcrumb/breadcrumb"
|
17
|
+
autoload :Button, "ui_bibz/ui/core/button/button"
|
18
|
+
autoload :ButtonDropdown, "ui_bibz/ui/core/button/button_dropdown"
|
19
|
+
autoload :ButtonGroup, "ui_bibz/ui/core/button/button_group"
|
20
|
+
autoload :ButtonLink, "ui_bibz/ui/core/button/button_link"
|
21
|
+
autoload :ButtonSplitDropdown, "ui_bibz/ui/core/button/button_split_dropdown"
|
22
|
+
autoload :Col, "ui_bibz/ui/core/col"
|
23
|
+
autoload :Component, "ui_bibz/ui/core/component"
|
24
|
+
autoload :Dropdown, "ui_bibz/ui/core/dropdown/dropdown"
|
25
|
+
autoload :Glyph, "ui_bibz/ui/core/glyph"
|
26
|
+
autoload :Jumbotron, "ui_bibz/ui/core/jumbotron"
|
27
|
+
autoload :Label, "ui_bibz/ui/core/label"
|
28
|
+
autoload :ListGroup, "ui_bibz/ui/core/list/list_group"
|
29
|
+
autoload :Nav, "ui_bibz/ui/core/nav/nav"
|
30
|
+
autoload :Navbar, "ui_bibz/ui/core/nav/navbar"
|
31
|
+
autoload :Panel, "ui_bibz/ui/core/panel"
|
32
|
+
autoload :ProgressBar, "ui_bibz/ui/core/progress_bar/progress_bar"
|
33
|
+
autoload :Row, "ui_bibz/ui/core/row"
|
34
|
+
autoload :Tab, "ui_bibz/ui/core/nav/tab"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Ux
|
38
|
+
module Ux
|
39
|
+
autoload :Grid, "ui_bibz/ui/ux/grid"
|
40
|
+
autoload :Table, "ui_bibz/ui/ux/table/table"
|
41
|
+
autoload :TablePanel, "ui_bibz/ui/ux/table/table_panel"
|
42
|
+
autoload :TableSearchField, "ui_bibz/ui/ux/table/table_search_field"
|
43
|
+
autoload :TablePagination, "ui_bibz/ui/ux/table/table_pagination"
|
44
|
+
autoload :TablePaginationPerPage, "ui_bibz/ui/ux/table/table_pagination_per_page"
|
45
|
+
end
|
36
46
|
end
|
37
47
|
|
38
48
|
module Helpers
|
39
|
-
autoload :MetaHelper,
|
40
|
-
autoload :
|
41
|
-
autoload :
|
49
|
+
autoload :MetaHelper, "ui_bibz/helpers/meta_helper"
|
50
|
+
autoload :UiCoreHelper, "ui_bibz/helpers/ui_core_helper"
|
51
|
+
autoload :UiUxHelper, "ui_bibz/helpers/ui_ux_helper"
|
52
|
+
autoload :UtilsHelper, "ui_bibz/helpers/utils_helper"
|
42
53
|
end
|
43
54
|
|
44
55
|
module Concerns
|
data/test/store_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require "ui_bibz/ui/table/components/store"
|
2
|
+
require "ui_bibz/ui/ux/table/components/store"
|
3
3
|
require 'will_paginate'
|
4
4
|
|
5
5
|
class StoreTest < ActionView::TestCase
|
@@ -16,7 +16,7 @@ class StoreTest < ActionView::TestCase
|
|
16
16
|
page: 1
|
17
17
|
}
|
18
18
|
users = User.table_search_pagination(params, session)
|
19
|
-
@store = UiBibz::Ui::Store.new users
|
19
|
+
@store = UiBibz::Ui::Ux::Store.new users
|
20
20
|
end
|
21
21
|
|
22
22
|
test 'total pages' do
|
data/test/ui/button_test.rb
CHANGED
@@ -4,15 +4,15 @@ include UiBibz::Helpers
|
|
4
4
|
class ButtonTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test "button" do
|
7
|
-
actual = UiBibz::Ui::Button.new('toto', state: :success).render
|
7
|
+
actual = UiBibz::Ui::Core::Button.new('toto', state: :success).render
|
8
8
|
expected = "<button class=\"btn-success btn\">toto</button>"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'button group' do
|
14
|
-
actual = UiBibz::Ui::ButtonGroup.new position: :vertical do
|
15
|
-
UiBibz::Ui::Button.new('toto').render
|
14
|
+
actual = UiBibz::Ui::Core::ButtonGroup.new position: :vertical do
|
15
|
+
UiBibz::Ui::Core::Button.new('toto').render
|
16
16
|
end.render
|
17
17
|
expected = "<div class=\"btn-group btn-group-vertical\" role=\"group\"><button class=\"btn-default btn\">toto</button></div>"
|
18
18
|
|
@@ -20,14 +20,14 @@ class ButtonTest < ActionView::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
test 'link button' do
|
23
|
-
actual = UiBibz::Ui::ButtonLink.new('Toto', { url: users_path, state: :danger, glyph: 'add'}).render
|
23
|
+
actual = UiBibz::Ui::Core::ButtonLink.new('Toto', { url: users_path, state: :danger, glyph: 'add'}).render
|
24
24
|
expected = "<a class=\"btn-danger btn\" href=\"/users\"><i class=\"glyph fa fa-add\"></i> Toto</a>"
|
25
25
|
|
26
26
|
assert_equal expected, actual
|
27
27
|
end
|
28
28
|
|
29
29
|
test 'button dropdown' do
|
30
|
-
actual = UiBibz::Ui::ButtonDropdown.new("Dropdown", type: :dropup, state: :success).tap do |d|
|
30
|
+
actual = UiBibz::Ui::Core::ButtonDropdown.new("Dropdown", type: :dropup, state: :success).tap do |d|
|
31
31
|
d.list 'toto'
|
32
32
|
d.list 'header', type: :header
|
33
33
|
d.list 'momo'
|
@@ -40,7 +40,7 @@ class ButtonTest < ActionView::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
test 'button split dropdown' do
|
43
|
-
actual = UiBibz::Ui::ButtonSplitDropdown.new("Dropdown", type: :dropup, state: :primary).tap do |d|
|
43
|
+
actual = UiBibz::Ui::Core::ButtonSplitDropdown.new("Dropdown", type: :dropup, state: :primary).tap do |d|
|
44
44
|
d.list 'toto'
|
45
45
|
d.list 'header', type: :header
|
46
46
|
d.list 'momo'
|
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::Component.new('New component', { status: :active, glyph: 'add' }, { class: 'new-class' }).render
|
7
|
+
actual = UiBibz::Ui::Core::Component.new('New component', { status: :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::Component.new(status: :active) do
|
14
|
+
actual = UiBibz::Ui::Core::Component.new(status: :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::Dropdown.new("Dropdown", type: :dropup, state: :success).tap do |d|
|
6
|
+
actual = UiBibz::Ui::Core::Dropdown.new("Dropdown", type: :dropup, state: :success).tap do |d|
|
7
7
|
d.list 'toto'
|
8
8
|
d.list 'header', type: :header
|
9
9
|
d.list 'momo'
|
data/test/ui/glyph_test.rb
CHANGED
@@ -4,19 +4,19 @@ include UiBibz::Helpers
|
|
4
4
|
class GlyphTest < ActionView::TestCase
|
5
5
|
|
6
6
|
test 'create glyph with a name' do
|
7
|
-
actual = UiBibz::Ui::Glyph.new('add').render
|
7
|
+
actual = UiBibz::Ui::Core::Glyph.new('add').render
|
8
8
|
expected = '<i class="glyph fa fa-add"></i>'
|
9
9
|
assert_equal expected, actual
|
10
10
|
end
|
11
11
|
|
12
12
|
test 'create glyph with hash' do
|
13
|
-
actual = UiBibz::Ui::Glyph.new({ name: 'add', size: 3, type: 'li'}).render
|
13
|
+
actual = UiBibz::Ui::Core::Glyph.new({ name: 'add', size: 3, type: 'li'}).render
|
14
14
|
expected = '<i class="glyph fa fa-add fa-3x fa-li"></i>'
|
15
15
|
assert_equal expected, actual
|
16
16
|
end
|
17
17
|
|
18
18
|
test 'create glyph with name and hash' do
|
19
|
-
actual = UiBibz::Ui::Glyph.new('add', { size: 3, type: 'li' }).render
|
19
|
+
actual = UiBibz::Ui::Core::Glyph.new('add', { size: 3, type: 'li' }).render
|
20
20
|
expected = '<i class="glyph fa fa-add fa-3x fa-li"></i>'
|
21
21
|
assert_equal expected, actual
|
22
22
|
end
|
data/test/ui/grid_test.rb
CHANGED
@@ -3,7 +3,7 @@ include UiBibz::Helpers
|
|
3
3
|
class GridTest < ActionView::TestCase
|
4
4
|
|
5
5
|
test 'row' do
|
6
|
-
actual = UiBibz::Ui::Row.new() do
|
6
|
+
actual = UiBibz::Ui::Core::Row.new() do
|
7
7
|
'test'
|
8
8
|
end.render
|
9
9
|
expected = "<div class=\"row\">test</div>"
|
@@ -12,7 +12,7 @@ class GridTest < ActionView::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
test 'col with simple arg' do
|
15
|
-
actual = UiBibz::Ui::Col.new({ size: :lg, num: 1}) do
|
15
|
+
actual = UiBibz::Ui::Core::Col.new({ size: :lg, num: 1}) do
|
16
16
|
'test'
|
17
17
|
end.render
|
18
18
|
expected = "<div class=\"col-lg-1\">test</div>"
|
@@ -21,7 +21,7 @@ class GridTest < ActionView::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
test 'col with multiple args' do
|
24
|
-
actual = UiBibz::Ui::Col.new([{ size: :lg, num: 1, offset: 2}, { num: 1 }], class: 'test') do
|
24
|
+
actual = UiBibz::Ui::Core::Col.new([{ size: :lg, num: 1, offset: 2}, { num: 1 }], class: 'test') do
|
25
25
|
'test'
|
26
26
|
end.render
|
27
27
|
expected = "<div class=\"test col-lg-1 col-offset-2 col-md-1\">test</div>"
|
@@ -30,7 +30,7 @@ class GridTest < ActionView::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
test 'grid' do
|
33
|
-
actual = UiBibz::Ui::Grid.new().tap do |g|
|
33
|
+
actual = UiBibz::Ui::Ux::Grid.new().tap do |g|
|
34
34
|
g.view position: :left do
|
35
35
|
'left'
|
36
36
|
end
|
data/test/ui/list_group_test.rb
CHANGED
@@ -3,7 +3,7 @@ include UiBibz::Helpers
|
|
3
3
|
class ListGroupTest < ActionView::TestCase
|
4
4
|
|
5
5
|
test 'list_group with link' do
|
6
|
-
actual = UiBibz::Ui::ListGroup.new(type: :link).tap do |lg|
|
6
|
+
actual = UiBibz::Ui::Core::ListGroup.new(type: :link).tap do |lg|
|
7
7
|
lg.list 'Momo', { state: :success, url: '#momo' }
|
8
8
|
lg.list({ tap: true, active: true, url: '#toto' }) do |l|
|
9
9
|
l.header 'My title'
|
@@ -16,7 +16,7 @@ class ListGroupTest < ActionView::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
test 'list_group' do
|
19
|
-
actual = UiBibz::Ui::ListGroup.new().tap do |lg|
|
19
|
+
actual = UiBibz::Ui::Core::ListGroup.new().tap do |lg|
|
20
20
|
lg.list 'Lulu'
|
21
21
|
lg.list 'Toto'
|
22
22
|
end.render
|
data/test/ui/nav_test.rb
CHANGED
@@ -3,18 +3,17 @@ include UiBibz::Helpers
|
|
3
3
|
class NavTest < ActionView::TestCase
|
4
4
|
|
5
5
|
test 'Nav with tab' do
|
6
|
-
actual = UiBibz::Ui::Nav.new().tap do |n|
|
6
|
+
actual = UiBibz::Ui::Core::Nav.new().tap do |n|
|
7
7
|
n.link 'Home', status: :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
|
11
|
-
expected = "<ul class=\"nav nav-tabs\"><li class=\"active\" role=\"presentation\"><a
|
12
|
-
|
11
|
+
expected = "<ul class=\"nav nav-tabs\"><li class=\"active\" role=\"presentation\"><a href=\"#Home\">Home</a></li><li role=\"presentation\"><a href=\"#profile\">Profile</a></li><li role=\"presentation\"><a href=\"#messages\">Messages</a></li></ul>"
|
13
12
|
assert_equal expected, actual
|
14
13
|
end
|
15
14
|
|
16
15
|
test 'Nav with pills' do
|
17
|
-
actual = UiBibz::Ui::Nav.new(type: :pills, position: :justified).tap do |n|
|
16
|
+
actual = UiBibz::Ui::Core::Nav.new(type: :pills, position: :justified).tap do |n|
|
18
17
|
n.link 'Home', status: :active, url: "#Home", selector: 'home'
|
19
18
|
n.link 'Profile', url: "#profile", selector: 'profile', badge: 16
|
20
19
|
n.link 'Messages', url: "#messages", selector: 'messages', status: :disabled
|