ui_bibz 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. checksums.yaml +13 -5
  2. data/.gitignore +1 -1
  3. data/.yardoc/checksums +52 -0
  4. data/.yardoc/object_types +0 -0
  5. data/.yardoc/objects/root.dat +0 -0
  6. data/.yardoc/proxy_types +0 -0
  7. data/Gemfile +1 -1
  8. data/Gemfile.lock +11 -21
  9. data/README.md +359 -239
  10. data/Rakefile +12 -13
  11. data/doc/UiBibz/Concerns/Models/Searchable/ClassMethods.html +174 -0
  12. data/doc/UiBibz/Concerns/Models/Searchable.html +120 -0
  13. data/doc/UiBibz/Helpers/MetaHelper.html +218 -0
  14. data/doc/UiBibz/Helpers/UiCoreHelper.html +1130 -0
  15. data/doc/UiBibz/Helpers/UiUxHelper.html +463 -0
  16. data/doc/UiBibz/Helpers/UtilsHelper.html +187 -0
  17. data/doc/UiBibz/Rails/Engine.html +123 -0
  18. data/doc/UiBibz/Rails.html +115 -0
  19. data/doc/UiBibz/Ui/Base.html +304 -0
  20. data/doc/UiBibz/Ui/Core/Alert.html +367 -0
  21. data/doc/UiBibz/Ui/Core/Bar.html +356 -0
  22. data/doc/UiBibz/Ui/Core/Breadcrumb.html +427 -0
  23. data/doc/UiBibz/Ui/Core/BreadcrumbLink.html +354 -0
  24. data/doc/UiBibz/Ui/Core/Button.html +363 -0
  25. data/doc/UiBibz/Ui/Core/ButtonDropdown.html +385 -0
  26. data/doc/UiBibz/Ui/Core/ButtonGroup.html +356 -0
  27. data/doc/UiBibz/Ui/Core/ButtonLink.html +365 -0
  28. data/doc/UiBibz/Ui/Core/ButtonSplitDropdown.html +387 -0
  29. data/doc/UiBibz/Ui/Core/Col.html +357 -0
  30. data/doc/UiBibz/Ui/Core/Component.html +1144 -0
  31. data/doc/UiBibz/Ui/Core/Dropdown.html +877 -0
  32. data/doc/UiBibz/Ui/Core/DropdownList.html +369 -0
  33. data/doc/UiBibz/Ui/Core/Glyph.html +742 -0
  34. data/doc/UiBibz/Ui/Core/Jumbotron.html +363 -0
  35. data/doc/UiBibz/Ui/Core/Label.html +361 -0
  36. data/doc/UiBibz/Ui/Core/List.html +486 -0
  37. data/doc/UiBibz/Ui/Core/ListGroup.html +446 -0
  38. data/doc/UiBibz/Ui/Core/Nav.html +474 -0
  39. data/doc/UiBibz/Ui/Core/NavDropdown.html +376 -0
  40. data/doc/UiBibz/Ui/Core/NavLink.html +347 -0
  41. data/doc/UiBibz/Ui/Core/Navbar.html +535 -0
  42. data/doc/UiBibz/Ui/Core/NavbarForm.html +341 -0
  43. data/doc/UiBibz/Ui/Core/NavbarNav.html +301 -0
  44. data/doc/UiBibz/Ui/Core/NavbarText.html +341 -0
  45. data/doc/UiBibz/Ui/Core/Panel.html +806 -0
  46. data/doc/UiBibz/Ui/Core/ProgressBar.html +433 -0
  47. data/doc/UiBibz/Ui/Core/Row.html +335 -0
  48. data/doc/UiBibz/Ui/Core.html +117 -0
  49. data/doc/UiBibz/Ui/Ux/Actionable.html +478 -0
  50. data/doc/UiBibz/Ui/Ux/Actions.html +314 -0
  51. data/doc/UiBibz/Ui/Ux/Column.html +1177 -0
  52. data/doc/UiBibz/Ui/Ux/Columns.html +312 -0
  53. data/doc/UiBibz/Ui/Ux/Grid.html +823 -0
  54. data/doc/UiBibz/Ui/Ux/Paginable.html +368 -0
  55. data/doc/UiBibz/Ui/Ux/Searchable.html +363 -0
  56. data/doc/UiBibz/Ui/Ux/Sortable.html +289 -0
  57. data/doc/UiBibz/Ui/Ux/Store.html +968 -0
  58. data/doc/UiBibz/Ui/Ux/Table.html +957 -0
  59. data/doc/UiBibz/Ui/Ux/TableAction.html +309 -0
  60. data/doc/UiBibz/Ui/Ux/TablePagination.html +319 -0
  61. data/doc/UiBibz/Ui/Ux/TablePaginationPerPage.html +331 -0
  62. data/doc/UiBibz/Ui/Ux/TablePanel.html +576 -0
  63. data/doc/UiBibz/Ui/Ux/TableSearchField.html +291 -0
  64. data/doc/UiBibz/Ui/Ux.html +117 -0
  65. data/doc/UiBibz/Ui.html +117 -0
  66. data/doc/UiBibz/Utils/Internationalization.html +262 -0
  67. data/doc/UiBibz/Utils.html +115 -0
  68. data/doc/UiBibz.html +129 -0
  69. data/doc/_index.html +635 -0
  70. data/doc/class_list.html +58 -0
  71. data/doc/css/common.css +1 -0
  72. data/doc/css/full_list.css +57 -0
  73. data/doc/css/style.css +339 -0
  74. data/doc/file.README.html +1022 -0
  75. data/doc/file_list.html +60 -0
  76. data/doc/frames.html +26 -0
  77. data/doc/images/navbar.png +0 -0
  78. data/doc/index.html +1022 -0
  79. data/doc/js/app.js +219 -0
  80. data/doc/js/full_list.js +181 -0
  81. data/doc/js/jquery.js +4 -0
  82. data/doc/method_list.html +1335 -0
  83. data/doc/top-level-namespace.html +112 -0
  84. data/lib/ui_bibz/helpers/ui_core_helper.rb +94 -0
  85. data/lib/ui_bibz/helpers/ui_ux_helper.rb +43 -0
  86. data/lib/ui_bibz/rails/engine.rb +2 -1
  87. data/lib/ui_bibz/ui/{ui.rb → base.rb} +1 -1
  88. data/lib/ui_bibz/ui/{alert.rb → core/alert.rb} +15 -7
  89. data/lib/ui_bibz/ui/core/breadcrumb/breadcrumb.rb +71 -0
  90. data/lib/ui_bibz/ui/{breadcrumb → core/breadcrumb}/components/breadcrumb_link.rb +6 -6
  91. data/lib/ui_bibz/ui/{button → core/button}/button.rb +13 -6
  92. data/lib/ui_bibz/ui/{button → core/button}/button_dropdown.rb +15 -4
  93. data/lib/ui_bibz/ui/{button → core/button}/button_group.rb +14 -6
  94. data/lib/ui_bibz/ui/{button → core/button}/button_link.rb +14 -6
  95. data/lib/ui_bibz/ui/{button → core/button}/button_split_dropdown.rb +15 -4
  96. data/lib/ui_bibz/ui/{grid/components → core}/col.rb +12 -6
  97. data/lib/ui_bibz/ui/{component.rb → core/component.rb} +7 -7
  98. data/lib/ui_bibz/ui/{dropdown → core/dropdown}/components/dropdown_list.rb +7 -7
  99. data/lib/ui_bibz/ui/{dropdown → core/dropdown}/dropdown.rb +18 -7
  100. data/lib/ui_bibz/ui/{glyph.rb → core/glyph.rb} +18 -10
  101. data/lib/ui_bibz/ui/{jumbotron.rb → core/jumbotron.rb} +14 -6
  102. data/lib/ui_bibz/ui/{label.rb → core/label.rb} +14 -6
  103. data/lib/ui_bibz/ui/{list → core/list}/components/list.rb +8 -8
  104. data/lib/ui_bibz/ui/{list → core/list}/list_group.rb +28 -6
  105. data/lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb +64 -0
  106. data/lib/ui_bibz/ui/{nav → core/nav}/components/nav_link.rb +6 -6
  107. data/lib/ui_bibz/ui/core/nav/components/navbar_form.rb +45 -0
  108. data/lib/ui_bibz/ui/core/nav/components/navbar_nav.rb +56 -0
  109. data/lib/ui_bibz/ui/core/nav/components/navbar_text.rb +45 -0
  110. data/lib/ui_bibz/ui/core/nav/nav.rb +90 -0
  111. data/lib/ui_bibz/ui/core/nav/navbar.rb +121 -0
  112. data/lib/ui_bibz/ui/{panel.rb → core/panel.rb} +36 -8
  113. data/lib/ui_bibz/ui/{progress_bar → core/progress_bar}/components/bar.rb +7 -7
  114. data/lib/ui_bibz/ui/{progress_bar → core/progress_bar}/progress_bar.rb +20 -9
  115. data/lib/ui_bibz/ui/{grid/components → core}/row.rb +12 -4
  116. data/lib/ui_bibz/ui/{grid → ux}/grid.rb +17 -8
  117. data/lib/ui_bibz/ui/{table → ux/table}/components/actions.rb +5 -5
  118. data/lib/ui_bibz/ui/ux/table/components/column.rb +34 -0
  119. data/lib/ui_bibz/ui/ux/table/components/columns.rb +16 -0
  120. data/lib/ui_bibz/ui/{table → ux/table}/components/store.rb +4 -4
  121. data/lib/ui_bibz/ui/{table → ux/table}/components/table_action.rb +2 -2
  122. data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/actionable.rb +3 -3
  123. data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/paginable.rb +5 -5
  124. data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/searchable.rb +4 -4
  125. data/lib/ui_bibz/ui/{table/ux → ux/table/extensions}/sortable.rb +3 -3
  126. data/lib/ui_bibz/ui/{table → ux/table}/table.rb +40 -22
  127. data/lib/ui_bibz/ui/ux/table/table_pagination.rb +51 -0
  128. data/lib/ui_bibz/ui/{table → ux/table}/table_pagination_per_page.rb +26 -4
  129. data/lib/ui_bibz/ui/ux/table/table_panel.rb +155 -0
  130. data/lib/ui_bibz/ui/{table → ux/table}/table_search_field.rb +7 -7
  131. data/lib/ui_bibz/version.rb +1 -1
  132. data/lib/ui_bibz.rb +40 -29
  133. data/test/store_test.rb +2 -2
  134. data/test/ui/button_test.rb +6 -6
  135. data/test/ui/component_test.rb +2 -2
  136. data/test/ui/dropdown_test.rb +1 -1
  137. data/test/ui/glyph_test.rb +3 -3
  138. data/test/ui/grid_test.rb +4 -4
  139. data/test/ui/list_group_test.rb +2 -2
  140. data/test/ui/nav_test.rb +3 -4
  141. data/test/ui/panel_test.rb +4 -4
  142. data/test/ui/table_test.rb +32 -32
  143. data/test/ui_helper_test.rb +18 -2
  144. data/ui_bibz.gemspec +1 -0
  145. data/vendor/assets/stylesheets/ui_bibz.sass +3 -0
  146. metadata +166 -132
  147. data/README.rdoc +0 -0
  148. data/lib/ui_bibz/helpers/ui_helper.rb +0 -119
  149. data/lib/ui_bibz/ui/breadcrumb/breadcrumb.rb +0 -54
  150. data/lib/ui_bibz/ui/nav/nav.rb +0 -65
  151. data/lib/ui_bibz/ui/table/components/column.rb +0 -34
  152. data/lib/ui_bibz/ui/table/components/columns.rb +0 -16
  153. data/lib/ui_bibz/ui/table/table_pagination.rb +0 -29
  154. data/lib/ui_bibz/ui/table/table_panel.rb +0 -66
@@ -0,0 +1,90 @@
1
+ require 'ui_bibz/ui/core/nav/components/nav_link'
2
+ require 'ui_bibz/ui/core/nav/components/nav_dropdown'
3
+ module UiBibz::Ui::Core
4
+
5
+ # Create a nav
6
+ #
7
+ # This element is an extend of UiBibz::Ui::Core::Component.
8
+ #
9
+ # ==== Attributes
10
+ #
11
+ # * +content+ - Content of element
12
+ # * +options+ - Options of element
13
+ # * +html_options+ - Html Options of element
14
+ #
15
+ # ==== Options
16
+ #
17
+ # You can add HTML attributes using the +html_options+.
18
+ # You can pass arguments in options attribute:
19
+ # * +type+ - Symbol
20
+ # (+:pills+, +:tab+)
21
+ #
22
+ # ==== Signatures
23
+ #
24
+ # UiBibz::Ui::Core::Nav.new(content, options = nil, html_options = nil)
25
+ #
26
+ # UiBibz::Ui::Core::Nav.new(options = nil, html_options = nil).tap do |n|
27
+ # ...
28
+ # n.link content = nil, options = nil, html_options = nil, block
29
+ # n.link content = nil, options = nil, html_options = nil, block
30
+ # n.dropdown content = nil, options = nil, html_options = nil, block
31
+ # ...
32
+ # end
33
+ #
34
+ # ==== Examples
35
+ #
36
+ # UiBibz::Ui::Core::Nav.new(type: :pills).tap do |n|
37
+ # n.link 'Test', url: '#test'
38
+ # n.link 'Test2', url: '#test2', status: :active
39
+ # n.dropdown('Action') do |d|
40
+ # d.list content = nil, options = nil, html_options = nil, &block
41
+ # end
42
+ # end.render
43
+ #
44
+ # ==== Helper
45
+ #
46
+ # nav(options = { tap: true }, html_options = {}) do |n|
47
+ # n.link(content, options = {}, html_options = {})
48
+ # n.link(options = {}, html_options = {}) do
49
+ # content
50
+ # end
51
+ # n.dropdown(name, options = {}, html_options = {}) do |d|
52
+ # d.list(content, options = {}, html_options = {})
53
+ # d.list(options = {}, html_options = {}) do
54
+ # content
55
+ # end
56
+ # end
57
+ # end
58
+ #
59
+ class Nav < Component
60
+
61
+ def initialize content = nil, options = nil, html_options = nil, &block
62
+ super
63
+ @items = []
64
+ end
65
+
66
+ def render
67
+ content_tag :ul, @items.join.html_safe, class_and_html_options(["nav", type, position])
68
+ end
69
+
70
+ def link content = nil, options = {}, html_options = nil, &block
71
+ @items << NavLink.new(content, options.merge({ nav_type: type }), html_options, &block).render
72
+ end
73
+
74
+ def dropdown content = nil, options = {}, html_options = nil, &block
75
+ @items << NavDropdown.new(content, options, html_options).tap(&block).render
76
+ end
77
+
78
+ private
79
+
80
+ # tabs or pills
81
+ def type
82
+ "nav-#{ @options[:type] || :tabs }"
83
+ end
84
+
85
+ def position
86
+ "nav-#{ @options[:position] }" unless @options[:position].nil?
87
+ end
88
+
89
+ end
90
+ end
@@ -0,0 +1,121 @@
1
+ require 'ui_bibz/ui/core/nav/components/navbar_nav'
2
+ module UiBibz::Ui::Core
3
+
4
+ # Create a Navbar
5
+ #
6
+ # This element is an extend of UiBibz::Ui::Core::Component.
7
+ #
8
+ # ==== Attributes
9
+ #
10
+ # * +content+ - Content of element
11
+ # * +options+ - Options of element
12
+ # * +html_options+ - Html Options of element
13
+ #
14
+ # ==== Options
15
+ #
16
+ # You can add HTML attributes using the +html_options+.
17
+ # You can pass arguments in options attribute:
18
+ # * +type+ - Symbol (default: :default)
19
+ # (+:inverse+, +:default+)
20
+ # * +glyph+
21
+ # * +position+ - Symbol
22
+ # (+:top+, +:bottom+)
23
+ # * +title+ - String
24
+ #
25
+ # ==== Signatures
26
+ #
27
+ #
28
+ # UiBibz::Ui::Core::Navbar.new(options = nil, html_options = nil).tap do |nb|
29
+ # ...
30
+ # nb.nav(options = nil, html_options = nil) do |n|
31
+ # n.link content options = nil, html_options = nil, &block
32
+ # n.link content options = nil, html_options = nil, &block
33
+ # end
34
+ # ...
35
+ # end
36
+ #
37
+ # ==== Examples
38
+ #
39
+ # UiBibz::Ui::Core::Navbar.new().tap do |nb|
40
+ # nb.nav(position: :right) do |n|
41
+ # n.link 'Link 1', "#"
42
+ # n.link 'Link 2', "#"
43
+ # end
44
+ # end.render
45
+ #
46
+ # ==== Helper
47
+ #
48
+ # navbar(options = { tap: true }, html_options = {}) do |nb|
49
+ # nb.nav(options = { tap: true }, html_options = {}) do |n|
50
+ # n.link(content, options = {}, html_options = {})
51
+ # n.link(options = {}, html_options = {}) do
52
+ # content
53
+ # end
54
+ # end
55
+ # end
56
+ #
57
+ class Navbar < Component
58
+
59
+ def initialize content = nil, options = nil, html_options = nil, &block
60
+ super
61
+ @items = []
62
+ end
63
+
64
+ def render
65
+ content_tag :nav, class_and_html_options(['navbar', type, position]) do
66
+ content_tag :div, class: 'container-fluid' do
67
+ concat header_html
68
+ concat body_html
69
+ end
70
+ end
71
+ end
72
+
73
+ def nav content = nil, options = nil, html_options = nil, &block
74
+ options = options || {}
75
+ @items << UiBibz::Ui::Core::NavbarNav.new(content, options, html_options).tap(&block).render
76
+ end
77
+
78
+ def form content = nil, options = nil, html_options = nil, &block
79
+ # @items << UiBibz::Ui::Core::Form.new(content, options, html_options).tap(&block)
80
+ end
81
+
82
+ def text content = nil, options = nil, html_options = nil, &block
83
+ # @items << UiBibz::Ui::Core::Text.new(content, options, html_options).tap(&block)
84
+ end
85
+
86
+ private
87
+
88
+ def header_html
89
+ content_tag :div, class: 'navbar-header' do
90
+ concat navbar_toggle_button_html
91
+ concat link_to [glyph_with_space, @options[:title]].compact.join.html_safe, '#', class: 'navbar-brand'
92
+ end
93
+ end
94
+
95
+ def body_html
96
+ content_tag :div, @items.join.html_safe, class: "collapse navbar-collapse", id: id
97
+ end
98
+
99
+ def id
100
+ @id ||= "navbar-collapse-#{ Random.new_seed }"
101
+ end
102
+
103
+ def navbar_toggle_button_html
104
+ content_tag :button, class: 'navbar-toggle collapsed', data: { toggle: 'collapse', target:"##{ id }" } do
105
+ concat content_tag :span, 'Toggle navigation', class: 'sr-only'
106
+ concat content_tag :span, '', class: 'icon-bar'
107
+ concat content_tag :span, '', class: 'icon-bar'
108
+ concat content_tag :span, '', class: 'icon-bar'
109
+ end
110
+ end
111
+
112
+ def position
113
+ "navbar-fixed-#{ @options[:position] }" unless @options[:position].nil?
114
+ end
115
+
116
+ def type
117
+ "navbar-#{ @options[:type] || 'default' }"
118
+ end
119
+
120
+ end
121
+ end
@@ -1,8 +1,8 @@
1
- module UiBibz::Ui
1
+ module UiBibz::Ui::Core
2
2
 
3
3
  # Create a panel
4
4
  #
5
- # This element is an extend of UiBibz::Ui::Component.
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
6
6
  # You can use tap method to add header, body or footer element.
7
7
  #
8
8
  # ==== Attributes
@@ -20,13 +20,13 @@ module UiBibz::Ui
20
20
  #
21
21
  # ==== Signatures
22
22
  #
23
- # UiBibz::Ui::Panel.new(content, options = nil, html_options = nil)
23
+ # UiBibz::Ui::Core::Panel.new(content, options = nil, html_options = nil)
24
24
  #
25
- # UiBibz::Ui::Panel.new(options = nil, html_options = nil) do
25
+ # UiBibz::Ui::Core::Panel.new(options = nil, html_options = nil) do
26
26
  # content
27
27
  # end
28
28
  #
29
- # UiBibz::Ui::Panel.new(options = nil, html_options = nil).tap do |p|
29
+ # UiBibz::Ui::Core::Panel.new(options = nil, html_options = nil).tap do |p|
30
30
  # p.header content = nil, options = nil, html_options = nil, &block
31
31
  # p.body content = nil, options = nil, html_options = nil, &block
32
32
  # p.footer content = nil, options = nil, html_options = nil, &block
@@ -34,13 +34,13 @@ module UiBibz::Ui
34
34
  #
35
35
  # ==== Examples
36
36
  #
37
- # UiBibz::Ui::Panel('test').render
37
+ # UiBibz::Ui::Core::Panel('test').render
38
38
  #
39
- # UiBibz::Ui::Panel(state: :primary) do |d|
39
+ # UiBibz::Ui::Core::Panel(state: :primary) do |d|
40
40
  # 'test'
41
41
  # end.render
42
42
  #
43
- # UiBibz::Ui::Panel.new().tap do |p|
43
+ # UiBibz::Ui::Core::Panel.new().tap do |p|
44
44
  # p.header 'header', glyph: 'eye', class: 'header-test'
45
45
  # p.body do
46
46
  # 'body'
@@ -48,6 +48,34 @@ module UiBibz::Ui
48
48
  # p.footer 'footer'
49
49
  # end.render
50
50
  #
51
+ # ==== Helper
52
+ #
53
+ # panel(content, options = {}, html_options = {})
54
+ #
55
+ # panel(options = {}, html_options = {}) do
56
+ # content
57
+ # end
58
+ #
59
+ # panel(options = { tap: true }, html_options = {}) do |p|
60
+ # p.header(content, options = {}, html_options = {})
61
+ # # or
62
+ # p.header(options = {}, html_options = {}) do
63
+ # content
64
+ # end
65
+ #
66
+ # p.body(content, options = {}, html_options = {})
67
+ # # or
68
+ # p.body(options = {}, html_options = {}) do
69
+ # content
70
+ # end
71
+ #
72
+ # p.footer(content, options = {}, html_options = {})
73
+ # # or
74
+ # p.footer(options = {}, html_options = {}) do
75
+ # content
76
+ # end
77
+ # end
78
+ #
51
79
  class Panel < Component
52
80
 
53
81
  def initialize content = nil, options = nil, html_options = nil, &block
@@ -1,8 +1,8 @@
1
- module UiBibz::Ui
1
+ module UiBibz::Ui::Core
2
2
 
3
3
  # Create a NavLink
4
4
  #
5
- # This element is an extend of UiBibz::Ui::Component.
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
6
6
  #
7
7
  # ==== Attributes
8
8
  #
@@ -25,19 +25,19 @@ module UiBibz::Ui
25
25
  #
26
26
  # ==== Signatures
27
27
  #
28
- # UiBibz::Ui::Bar.new(percentage, options = nil, html_options = nil)
28
+ # UiBibz::Ui::Core::Bar.new(percentage, options = nil, html_options = nil)
29
29
  #
30
- # UiBibz::Ui::Bar.new(options = nil, html_options = nil) do
30
+ # UiBibz::Ui::Core::Bar.new(options = nil, html_options = nil) do
31
31
  # percentage
32
32
  # end
33
33
  #
34
34
  # ==== Examples
35
35
  #
36
- # UiBibz::Ui::Bar.new(10)
36
+ # UiBibz::Ui::Core::Bar.new(10)
37
37
  # # or
38
- # UiBibz::Ui::Bar.new(10, { state: :success, sr_only: true, label: 'Loading...' },{ class: 'test' }).render
38
+ # UiBibz::Ui::Core::Bar.new(10, { state: :success, sr_only: true, label: 'Loading...' },{ class: 'test' }).render
39
39
  # # or
40
- # UiBibz::Ui::Bar.new({ state: :primary }) do
40
+ # UiBibz::Ui::Core::Bar.new({ state: :primary }) do
41
41
  # 40
42
42
  # end.render
43
43
  #
@@ -1,9 +1,9 @@
1
- require 'ui_bibz/ui/progress_bar/components/bar'
2
- module UiBibz::Ui
1
+ require 'ui_bibz/ui/core/progress_bar/components/bar'
2
+ module UiBibz::Ui::Core
3
3
 
4
4
  # Create a progress bar
5
5
  #
6
- # This element is an extend of UiBibz::Ui::Component.
6
+ # This element is an extend of UiBibz::Ui::Core::Component.
7
7
  #
8
8
  # ==== Attributes
9
9
  #
@@ -28,13 +28,13 @@ module UiBibz::Ui
28
28
  #
29
29
  # ==== Signatures
30
30
  #
31
- # UiBibz::Ui::ProgressBar.new(percentage, options = nil, html_options = nil)
31
+ # UiBibz::Ui::Core::ProgressBar.new(percentage, options = nil, html_options = nil)
32
32
  #
33
- # UiBibz::Ui::ProgressBar.new(options = nil, html_options = nil) do
33
+ # UiBibz::Ui::Core::ProgressBar.new(options = nil, html_options = nil) do
34
34
  # percentage
35
35
  # end
36
36
  #
37
- # UiBibz::Ui::ProgressBar.new(tap: true).tap do |pb|
37
+ # UiBibz::Ui::Core::ProgressBar.new(tap: true).tap do |pb|
38
38
  # pb.bar percentage, options = nil, html_options = nil
39
39
  # pb.bar options = nil, html_options = nil do
40
40
  # percentage
@@ -43,17 +43,28 @@ module UiBibz::Ui
43
43
  #
44
44
  # ==== Examples
45
45
  #
46
- # UiBibz::Ui::ProgressBar.new(50)
46
+ # UiBibz::Ui::Core::ProgressBar.new(50)
47
47
  # # or
48
- # UiBibz::Ui::ProgressBar.new(10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }).render
48
+ # UiBibz::Ui::Core::ProgressBar.new(10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }).render
49
49
  # # or
50
- # UiBibz::Ui::ProgressBar.new(tap: true).tap |pb|
50
+ # UiBibz::Ui::Core::ProgressBar.new(tap: true).tap |pb|
51
51
  # pb.bar 10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }
52
52
  # pb.bar { state: :primary } do
53
53
  # 20
54
54
  # end
55
55
  # end.render
56
56
  #
57
+ # ==== Helper
58
+ #
59
+ # progress_bar(integer, options = {}, html_options = {})
60
+ #
61
+ # progress_bar(options = { tap: true }, html_options = {}) do |pb|
62
+ # pb.bar(integer, options = {}, html_options = {})
63
+ # pb.bar(options = {}, html_options = {}) do
64
+ # integer
65
+ # end
66
+ # end
67
+ #
57
68
  class ProgressBar < Component
58
69
 
59
70
  def initialize content = nil, options = nil, html_options = nil, &block
@@ -1,8 +1,8 @@
1
- module UiBibz::Ui
1
+ module UiBibz::Ui::Core
2
2
 
3
3
  # Create a row
4
4
  #
5
- # This element is an extend of UiBibz::Ui::Component.
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
6
6
  #
7
7
  # ==== Attributes
8
8
  #
@@ -12,12 +12,20 @@ module UiBibz::Ui
12
12
  #
13
13
  # ==== Signatures
14
14
  #
15
- # UiBibz::Ui::Row.new(content, options = {}, html_options = {})
15
+ # UiBibz::Ui::Core::Row.new(content, options = {}, html_options = {})
16
16
  #
17
- # UiBibz::Ui::Row.new(options = {}, html_options = {}) do
17
+ # UiBibz::Ui::Core::Row.new(options = {}, html_options = {}) do
18
18
  # #content
19
19
  # end
20
20
  #
21
+ # ==== Helper
22
+ #
23
+ # row(content, options = {}, html_options = {})
24
+ #
25
+ # row(options = {}, html_options = {}) do
26
+ # content
27
+ # end
28
+ #
21
29
  class Row < Component
22
30
 
23
31
  def initialize content = nil, options = nil, html_options = nil, &block
@@ -1,8 +1,8 @@
1
- module UiBibz::Ui
1
+ module UiBibz::Ui::Ux
2
2
 
3
3
  # Create a Grid
4
4
  #
5
- # This element is an extend of UiBibz::Ui::Component.
5
+ # This element is an extend of UiBibz::Ui::Ux::Component.
6
6
  #
7
7
  # ==== Attributes
8
8
  #
@@ -17,7 +17,7 @@ module UiBibz::Ui
17
17
  #
18
18
  # ==== Signatures
19
19
  #
20
- # UiBibz::Ui::Grid.new().tap do |g|
20
+ # UiBibz::Ui::Ux::Grid.new().tap do |g|
21
21
  # ...
22
22
  # g.view content = nil, options = nil, html_options = nil, &block
23
23
  # ...
@@ -25,7 +25,7 @@ module UiBibz::Ui
25
25
  #
26
26
  # ==== Exemples
27
27
  #
28
- # UiBibz::Ui::Grid.new().tap do |g|
28
+ # UiBibz::Ui::Ux::Grid.new().tap do |g|
29
29
  # g.view num: 5, position: :left do
30
30
  # 'left'
31
31
  # end
@@ -43,7 +43,16 @@ module UiBibz::Ui
43
43
  # end
44
44
  # end.render
45
45
  #
46
- class Grid < Component
46
+ # ==== Helper
47
+ #
48
+ # grid(options = { tap: true }, html_options = {}) do |g|
49
+ # g.view(content, options = {}, html_options = {})
50
+ # g.view(options = {}, html_options = {}) do
51
+ # content
52
+ # end
53
+ # end
54
+ #
55
+ class Grid < UiBibz::Ui::Core::Component
47
56
 
48
57
  COL_NUM = 12
49
58
 
@@ -54,14 +63,14 @@ module UiBibz::Ui
54
63
 
55
64
  def view content = nil, options = nil, html_options = nil, &block
56
65
  o = content.kind_of?(Hash) ? content : options
57
- c = UiBibz::Ui::Component.new content, options, html_options, &block
66
+ c = UiBibz::Ui::Core::Component.new content, options, html_options, &block
58
67
  h = Hash[o[:position], { component: c, num: o[:num]}]
59
68
  @views = @views.merge(h)
60
69
  end
61
70
 
62
71
  def render
63
72
  define_col_nums
64
- UiBibz::Ui::Row.new(class: 'grid') do
73
+ UiBibz::Ui::Core::Row.new(class: 'grid') do
65
74
  # top
66
75
  concat top_view unless @views[:top].nil?
67
76
  # left
@@ -76,7 +85,7 @@ module UiBibz::Ui
76
85
  end
77
86
 
78
87
  def view_by_num c, num, item_class
79
- UiBibz::Ui::Col.new(c.content, c.options.merge({ num: num }), c.class_and_html_options(['col', item_class])).render
88
+ UiBibz::Ui::Core::Col.new(c.content, c.options.merge({ num: num }), c.class_and_html_options(['col', item_class])).render
80
89
  end
81
90
 
82
91
  def top_view
@@ -1,5 +1,5 @@
1
- require "ui_bibz/ui/table/components/table_action"
2
- module UiBibz::Ui
1
+ require "ui_bibz/ui/ux/table/components/table_action"
2
+ module UiBibz::Ui::Ux
3
3
  class Actions
4
4
 
5
5
  def initialize store
@@ -19,9 +19,9 @@ module UiBibz::Ui
19
19
 
20
20
  def defaults_actions
21
21
  [
22
- TableAction.new(show_name, url: { controller: @store.controller, action: 'show', id: :id }, glyph: 'eye').render,
23
- TableAction.new(edit_name, url:{ controller: @store.controller, action: 'edit', id: :id }, glyph: 'pencil').render,
24
- TableAction.new(delete_name, url: { controller: @store.controller, id: :id }, method: :delete, glyph: 'trash', data: { confirm: 'Are you sure?' }).render,
22
+ UiBibz::Ui::Ux::TableAction.new(show_name, url: { controller: @store.controller, action: 'show', id: :id }, glyph: 'eye').render,
23
+ UiBibz::Ui::Ux::TableAction.new(edit_name, url:{ controller: @store.controller, action: 'edit', id: :id }, glyph: 'pencil').render,
24
+ UiBibz::Ui::Ux::TableAction.new(delete_name, { glyph: 'trash', url: { controller: @store.controller, action: 'destroy', id: :id }}, data: { confirm: 'Are you sure?', method: :delete }).render
25
25
  ]
26
26
  end
27
27
 
@@ -0,0 +1,34 @@
1
+ module UiBibz::Ui::Ux
2
+ class Column < UiBibz::Ui::Core::Component
3
+
4
+ attr_accessor :hidden, :link, :name, :data_index, :date_format, :sort, :format, :date_format, :count, :custom_sort, :parent
5
+
6
+ def initialize content = nil, options = nil, html_options = nil, &block
7
+ super
8
+ @name = @content
9
+ @link = @options[:link] # for show or edit action
10
+ @order = @options[:order]
11
+ @data_index = @options[:data_index]
12
+ @date_format = @options[:date_format]
13
+ @sort = @options[:sort]
14
+ @custom_sort = @options[:custom_sort]
15
+ @parent = @options[:parent]
16
+ @count = @options[:count]
17
+ @format = @options[:format]
18
+ @hidden = @options[:hidden]
19
+ end
20
+
21
+ def linkable?
22
+ !@link.nil?
23
+ end
24
+
25
+ def order
26
+ @order || 0
27
+ end
28
+
29
+ def hidden?
30
+ @hidden == true
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,16 @@
1
+ module UiBibz::Ui::Ux
2
+ class Columns
3
+
4
+ def initialize columns = nil
5
+ @columns = columns || []
6
+ end
7
+
8
+ def column name = nil, options = nil, html_options = nil, &block
9
+ @columns << Column.new(name, options, html_options, &block)
10
+ end
11
+
12
+ def list
13
+ @columns
14
+ end
15
+ end
16
+ end
@@ -1,6 +1,6 @@
1
- require 'ui_bibz/ui/table/components/columns'
2
- require 'ui_bibz/ui/table/components/column'
3
- module UiBibz::Ui
1
+ require 'ui_bibz/ui/ux/table/components/columns'
2
+ require 'ui_bibz/ui/ux/table/components/column'
3
+ module UiBibz::Ui::Ux
4
4
  class Store
5
5
 
6
6
  attr_accessor :records
@@ -44,7 +44,7 @@ module UiBibz::Ui
44
44
  end
45
45
 
46
46
  def columns
47
- @columns ||= Columns.new model.new.attributes.keys.map{ |record| Column.new({ data_index: record, name: record.humanize }) }
47
+ @columns ||= Columns.new model.new.attributes.keys.map{ |record| Column.new(record.humanize, { data_index: record }) }
48
48
  end
49
49
 
50
50
  def model
@@ -1,5 +1,5 @@
1
- module UiBibz::Ui
2
- class TableAction < Component
1
+ module UiBibz::Ui::Ux
2
+ class TableAction < UiBibz::Ui::Core::Component
3
3
 
4
4
  DIVIDER = '---'
5
5
 
@@ -1,5 +1,5 @@
1
- module UiBibz::Ui
2
- class Actionable < Ui
1
+ module UiBibz::Ui::Ux
2
+ class Actionable < UiBibz::Ui::Base
3
3
 
4
4
  def initialize store, options, actions = nil
5
5
  @store = store
@@ -29,7 +29,7 @@ module UiBibz::Ui
29
29
  private
30
30
 
31
31
  def dropdown_action record
32
- UiBibz::Ui::Dropdown.new(dropdown_action_name, { position: :right, glyph: actions_glyph }, class: 'btn-group-xs dropdown-action').tap do |d|
32
+ UiBibz::Ui::Core::Dropdown.new(dropdown_action_name, { position: :right, glyph: actions_glyph }, class: 'btn-group-xs dropdown-action').tap do |d|
33
33
  unless @actions.nil?
34
34
  actions_links(record).each do |l|
35
35
  d.list l.html_safe
@@ -1,5 +1,5 @@
1
- module UiBibz::Ui
2
- class Paginable < Ui
1
+ module UiBibz::Ui::Ux
2
+ class Paginable < UiBibz::Ui::Base
3
3
  include WillPaginate::ActionView
4
4
 
5
5
  def initialize store, options
@@ -9,9 +9,9 @@ module UiBibz::Ui
9
9
 
10
10
  def render
11
11
  content_tag :div do
12
- concat UiBibz::Ui::TablePagination.new(store: @store).render
13
- concat UiBibz::Ui::TablePaginationPerPage.new(store: @store).render
14
- concat tag(:br, class: 'clear')
12
+ concat UiBibz::Ui::Ux::TablePagination.new(store: @store).render
13
+ concat UiBibz::Ui::Ux::TablePaginationPerPage.new(store: @store).render
14
+ concat tag(:br, class: 'ui-bibz-clear')
15
15
  end
16
16
  end
17
17
 
@@ -1,5 +1,5 @@
1
- module UiBibz::Ui
2
- class Searchable < Ui
1
+ module UiBibz::Ui::Ux
2
+ class Searchable < UiBibz::Ui::Base
3
3
 
4
4
  def initialize store, options
5
5
  @store = store
@@ -10,7 +10,7 @@ module UiBibz::Ui
10
10
  content_tag :div do
11
11
  concat content_tag(:div, table_name, class: 'title')
12
12
  concat TableSearchField.new(store: @store, wrap_form: false).render if searchable?
13
- concat tag :br, class: 'clear'
13
+ concat tag :br, class: 'ui-bibz-clear'
14
14
  end
15
15
  end
16
16
 
@@ -40,7 +40,7 @@ module UiBibz::Ui
40
40
  end
41
41
 
42
42
  def table_glyph
43
- Glyph.new(@options[:glyph]).render unless @options[:glyph].nil?
43
+ UiBibz::Ui::Core::Glyph.new(@options[:glyph]).render unless @options[:glyph].nil?
44
44
  end
45
45
 
46
46
  end
@@ -1,5 +1,5 @@
1
- module UiBibz::Ui
2
- class Sortable < Ui
1
+ module UiBibz::Ui::Ux
2
+ class Sortable < UiBibz::Ui::Base
3
3
 
4
4
  def initialize store, options
5
5
  @store = store
@@ -8,7 +8,7 @@ module UiBibz::Ui
8
8
 
9
9
  def header column, name = nil
10
10
  @column = column
11
- name = name || @column.name.titleize
11
+ name = name || @column.name.try('titleize')
12
12
  defaults = [translate_headers_by_defaults, translate_headers_by_defaults_active_record, translate_headers_by_active_record, name]
13
13
  @name = UiBibz::Utils::Internationalization.new(translate_headers_by_model, default: defaults).translate
14
14
  sortable? ? sortable_link : title