ui_bibz 1.2.5.3 → 2.0.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -7
- data/README.md +8 -1042
- data/app/assets/javascripts/multi_column.coffee +45 -0
- data/app/assets/javascripts/{ui_bibz.js.coffee → ui_bibz.coffee} +16 -3
- data/app/assets/stylesheets/fix-bootstrap-4.sass +2 -0
- data/app/assets/stylesheets/ui_bibz.sass +22 -9
- data/app/inputs/custom_inputs/date_picker_input.rb +10 -0
- data/app/inputs/custom_inputs/date_picker_input_old.rb +61 -0
- data/app/inputs/custom_inputs/multi_column_input.rb +18 -0
- data/app/inputs/custom_inputs/multi_select_input.rb +15 -0
- data/app/inputs/custom_inputs/surround_input.rb +10 -0
- data/doc/UiBibz.html +2 -2
- data/doc/UiBibz/Concerns.html +1 -1
- data/doc/UiBibz/Concerns/Models.html +1 -1
- data/doc/UiBibz/Concerns/Models/Searchable.html +1 -1
- data/doc/UiBibz/Concerns/Models/Searchable/ClassMethods.html +5 -5
- data/doc/UiBibz/Helpers.html +1 -1
- data/doc/UiBibz/Helpers/MetaHelper.html +1 -1
- data/doc/UiBibz/Helpers/UiCoreHelper.html +1 -1
- data/doc/UiBibz/Helpers/UiUxHelper.html +1 -1
- data/doc/UiBibz/Helpers/UtilsHelper.html +1 -1
- data/doc/UiBibz/Rails.html +1 -1
- data/doc/UiBibz/Rails/Engine.html +1 -1
- data/doc/UiBibz/Ui.html +1 -1
- data/doc/UiBibz/Ui/Base.html +1 -1
- data/doc/UiBibz/Ui/Core.html +1 -1
- data/doc/UiBibz/Ui/Core/Alert.html +1 -1
- data/doc/UiBibz/Ui/Core/Bar.html +1 -1
- data/doc/UiBibz/Ui/Core/Breadcrumb.html +1 -1
- data/doc/UiBibz/Ui/Core/BreadcrumbLink.html +1 -1
- data/doc/UiBibz/Ui/Core/Button.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonDropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonGroup.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonLink.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonSplitDropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/Col.html +1 -1
- data/doc/UiBibz/Ui/Core/Component.html +1 -1
- data/doc/UiBibz/Ui/Core/Dropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/DropdownDivider.html +1 -1
- data/doc/UiBibz/Ui/Core/DropdownHeader.html +1 -1
- data/doc/UiBibz/Ui/Core/DropdownLink.html +1 -1
- data/doc/UiBibz/Ui/Core/Glyph.html +1 -1
- data/doc/UiBibz/Ui/Core/Jumbotron.html +1 -1
- data/doc/UiBibz/Ui/Core/Label.html +1 -1
- data/doc/UiBibz/Ui/Core/List.html +1 -1
- data/doc/UiBibz/Ui/Core/ListGroup.html +1 -1
- data/doc/UiBibz/Ui/Core/Modal.html +1 -1
- data/doc/UiBibz/Ui/Core/ModalBody.html +1 -1
- data/doc/UiBibz/Ui/Core/ModalFooter.html +1 -1
- data/doc/UiBibz/Ui/Core/ModalHeader.html +1 -1
- data/doc/UiBibz/Ui/Core/Nav.html +1 -1
- data/doc/UiBibz/Ui/Core/NavDropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/NavLink.html +1 -1
- data/doc/UiBibz/Ui/Core/Navbar.html +1 -1
- data/doc/UiBibz/Ui/Core/NavbarForm.html +1 -1
- data/doc/UiBibz/Ui/Core/NavbarNav.html +1 -1
- data/doc/UiBibz/Ui/Core/NavbarText.html +1 -1
- data/doc/UiBibz/Ui/Core/Panel.html +1 -1
- data/doc/UiBibz/Ui/Core/ProgressBar.html +1 -1
- data/doc/UiBibz/Ui/Core/Row.html +1 -1
- data/doc/UiBibz/Ui/Core/Stars.html +1 -1
- data/doc/UiBibz/Ui/Ux.html +1 -1
- data/doc/UiBibz/Ui/Ux/Actionable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Actions.html +1 -1
- data/doc/UiBibz/Ui/Ux/Column.html +1 -1
- data/doc/UiBibz/Ui/Ux/Columns.html +1 -1
- data/doc/UiBibz/Ui/Ux/Grid.html +1 -1
- data/doc/UiBibz/Ui/Ux/Paginable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Searchable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Sortable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Store.html +18 -70
- data/doc/UiBibz/Ui/Ux/Table.html +1 -1
- data/doc/UiBibz/Ui/Ux/TablePagination.html +1 -1
- data/doc/UiBibz/Ui/Ux/TablePaginationPerPage.html +1 -1
- data/doc/UiBibz/Ui/Ux/TablePanel.html +1 -1
- data/doc/UiBibz/Ui/Ux/TableSearchField.html +1 -1
- data/doc/UiBibz/Utils.html +1 -1
- data/doc/UiBibz/Utils/Internationalization.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +47 -51
- data/doc/index.html +47 -51
- data/doc/method_list.html +69 -75
- data/doc/top-level-namespace.html +1 -1
- data/lib/ui_bibz.rb +14 -7
- data/lib/ui_bibz/helpers/ui_core_helper.rb +46 -11
- data/lib/ui_bibz/helpers/ui_ux_helper.rb +7 -3
- data/lib/ui_bibz/rails/engine.rb +2 -2
- data/lib/ui_bibz/ui/base.rb +5 -0
- data/lib/ui_bibz/ui/core/alert.rb +15 -6
- data/lib/ui_bibz/ui/core/breadcrumb/breadcrumb.rb +37 -2
- data/lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb +3 -3
- data/lib/ui_bibz/ui/core/button/button.rb +39 -6
- data/lib/ui_bibz/ui/core/button/button_choice.rb +104 -0
- data/lib/ui_bibz/ui/core/button/button_dropdown.rb +15 -2
- data/lib/ui_bibz/ui/core/button/button_group.rb +17 -5
- data/lib/ui_bibz/ui/core/button/button_link.rb +8 -11
- data/lib/ui_bibz/ui/core/button/button_split_dropdown.rb +15 -5
- data/lib/ui_bibz/ui/core/card/card.rb +158 -0
- data/lib/ui_bibz/ui/core/card/card_column.rb +60 -0
- data/lib/ui_bibz/ui/core/card/card_deck.rb +62 -0
- data/lib/ui_bibz/ui/core/card/card_group.rb +60 -0
- data/lib/ui_bibz/ui/core/card/components/block/card_block_link.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/block/card_block_text.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/block/card_block_title.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/card_block.rb +67 -0
- data/lib/ui_bibz/ui/core/card/components/card_footer.rb +55 -0
- data/lib/ui_bibz/ui/core/card/components/card_header.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/card_image.rb +57 -0
- data/lib/ui_bibz/ui/core/card/components/card_list_group.rb +47 -0
- data/lib/ui_bibz/ui/core/component.rb +78 -32
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_divider.rb +1 -1
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_header.rb +11 -1
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_link.rb +11 -4
- data/lib/ui_bibz/ui/core/dropdown/dropdown.rb +14 -6
- data/lib/ui_bibz/ui/core/glyph.rb +22 -4
- data/lib/ui_bibz/ui/core/input/date_picker_field.rb +125 -0
- data/lib/ui_bibz/ui/core/input/multi_column_field.rb +77 -0
- data/lib/ui_bibz/ui/core/input/multi_select_field.rb +89 -0
- data/lib/ui_bibz/ui/core/input/surround_field.rb +74 -0
- data/lib/ui_bibz/ui/core/jumbotron.rb +10 -6
- data/lib/ui_bibz/ui/core/label.rb +13 -3
- data/lib/ui_bibz/ui/core/{col.rb → layout/col.rb} +38 -18
- data/lib/ui_bibz/ui/core/layout/container.rb +65 -0
- data/lib/ui_bibz/ui/core/{row.rb → layout/row.rb} +7 -1
- data/lib/ui_bibz/ui/core/list/components/list.rb +26 -11
- data/lib/ui_bibz/ui/core/list/components/list_body.rb +36 -0
- data/lib/ui_bibz/ui/core/list/components/list_header.rb +36 -0
- data/lib/ui_bibz/ui/core/list/list_group.rb +7 -3
- data/lib/ui_bibz/ui/core/modal/components/modal_body.rb +7 -1
- data/lib/ui_bibz/ui/core/modal/components/modal_footer.rb +7 -1
- data/lib/ui_bibz/ui/core/modal/components/modal_header.rb +5 -2
- data/lib/ui_bibz/ui/core/modal/modal.rb +13 -2
- data/lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb +6 -2
- data/lib/ui_bibz/ui/core/nav/components/nav_link.rb +7 -18
- data/lib/ui_bibz/ui/core/nav/components/nav_link_link.rb +45 -0
- data/lib/ui_bibz/ui/core/nav/components/nav_link_list.rb +35 -0
- data/lib/ui_bibz/ui/core/nav/components/navbar_brand.rb +40 -0
- data/lib/ui_bibz/ui/core/nav/components/navbar_form.rb +2 -2
- data/lib/ui_bibz/ui/core/nav/components/navbar_nav.rb +1 -1
- data/lib/ui_bibz/ui/core/nav/components/navbar_text.rb +6 -2
- data/lib/ui_bibz/ui/core/nav/nav.rb +22 -4
- data/lib/ui_bibz/ui/core/nav/navbar.rb +26 -17
- data/lib/ui_bibz/ui/core/progress.rb +98 -0
- data/lib/ui_bibz/ui/core/stars.rb +13 -5
- data/lib/ui_bibz/ui/ux/table/components/actions.rb +4 -0
- data/lib/ui_bibz/ui/ux/table/components/store.rb +4 -4
- data/lib/ui_bibz/ui/ux/table/extensions/actionable.rb +15 -13
- data/lib/ui_bibz/ui/ux/table/extensions/paginable.rb +7 -6
- data/lib/ui_bibz/ui/ux/table/extensions/searchable.rb +6 -5
- data/lib/ui_bibz/ui/ux/table/table.rb +14 -7
- data/lib/ui_bibz/ui/ux/table/{table_panel.rb → table_card.rb} +34 -36
- data/lib/ui_bibz/ui/ux/table/table_search_field.rb +19 -11
- data/lib/ui_bibz/version.rb +1 -1
- data/test/ui/breadcrumb_test.rb +25 -0
- data/test/ui/button_test.rb +44 -4
- data/test/ui/card_test.rb +106 -0
- data/test/ui/col_test.rb +22 -0
- data/test/ui/dropdown_test.rb +1 -1
- data/test/ui/inputs_test.rb +81 -0
- data/test/ui/list_group_test.rb +1 -1
- data/test/ui/nav_test.rb +4 -5
- data/test/ui/table_test.rb +11 -11
- data/test/ui_helper_test.rb +29 -18
- data/ui_bibz.gemspec +3 -3
- data/vendor/assets/images/switch.png +0 -0
- data/vendor/assets/javascripts/bootstrap-4.0.0-alpha.min.js +7 -0
- data/vendor/assets/javascripts/bootstrap-multiselect.min.js +1180 -0
- data/vendor/assets/javascripts/jquery.multi-select.min.js +1 -0
- data/vendor/assets/javascripts/jquery.quicksearch.min.js +1 -0
- data/vendor/assets/stylesheets/bootstrap-4.0.0-alpha.min.css +6 -0
- data/vendor/assets/stylesheets/bootstrap-datepicker3.min.css +1 -1
- data/vendor/assets/stylesheets/bootstrap-multiselect.min.css +1 -0
- data/vendor/assets/stylesheets/multi-select.min.css +1 -0
- metadata +70 -24
- data/.yardoc/checksums +0 -59
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/lib/ui_bibz/helpers/meta_helper.rb +0 -32
- data/lib/ui_bibz/ui/core/panel.rb +0 -138
- data/lib/ui_bibz/ui/core/progress_bar/components/bar.rb +0 -105
- data/lib/ui_bibz/ui/core/progress_bar/progress_bar.rb +0 -94
- data/lib/ui_bibz/ui/ux/grid.rb +0 -121
- data/test/ui/grid_test.rb +0 -46
- data/test/ui/panel_test.rb +0 -52
@@ -50,7 +50,7 @@ module UiBibz::Ui::Core
|
|
50
50
|
if type == :form_for
|
51
51
|
@form = form_for(model_or_url, options, &block)
|
52
52
|
else
|
53
|
-
@form = form_tag(model_or_url, class: "navbar-form #{ position }", &block)
|
53
|
+
@form = form_tag(model_or_url, class: "navbar-form form-inline #{ position }", &block)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -74,7 +74,7 @@ module UiBibz::Ui::Core
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def position
|
77
|
-
"
|
77
|
+
"pull-#{ @options[:position] }" unless @options[:position].nil?
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
@@ -40,13 +40,17 @@ module UiBibz::Ui::Core
|
|
40
40
|
|
41
41
|
# Render html tag
|
42
42
|
def render
|
43
|
-
content_tag :ul,
|
43
|
+
content_tag :ul, content, html_options
|
44
44
|
end
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
+
def component_html_classes
|
49
|
+
["navbar-text", position]
|
50
|
+
end
|
51
|
+
|
48
52
|
def position
|
49
|
-
"navbar-#{
|
53
|
+
"navbar-#{ options[:position] }" unless options[:position].nil?
|
50
54
|
end
|
51
55
|
|
52
56
|
end
|
@@ -66,13 +66,19 @@ module UiBibz::Ui::Core
|
|
66
66
|
|
67
67
|
# Render html tag
|
68
68
|
def render
|
69
|
-
content_tag
|
69
|
+
content_tag tag, @items.join.html_safe, html_options
|
70
70
|
end
|
71
71
|
|
72
72
|
# Add nav link items
|
73
73
|
# See UiBibz::Ui::Core::NavLink
|
74
74
|
def link content = nil, options = {}, html_options = nil, &block
|
75
|
-
|
75
|
+
block_given? ? content.merge!({ nav_type: type }) : options.merge!({ nav_type: type })
|
76
|
+
@items << NavLink.new(content, options, html_options, &block).render
|
77
|
+
end
|
78
|
+
|
79
|
+
# Add nav in nav
|
80
|
+
def nav content = nil, options = {}, html_options = nil, &block
|
81
|
+
@items << content_tag(:li, Nav.new(content, options, html_options).tap(&block).render, class: 'nav-item')
|
76
82
|
end
|
77
83
|
|
78
84
|
# Add nav dropdown items
|
@@ -83,13 +89,25 @@ module UiBibz::Ui::Core
|
|
83
89
|
|
84
90
|
private
|
85
91
|
|
92
|
+
def component_html_classes
|
93
|
+
["nav", type, position, stacked]
|
94
|
+
end
|
95
|
+
|
86
96
|
# tabs or pills
|
87
97
|
def type
|
88
|
-
|
98
|
+
"nav-#{ @options[:type] }" unless @options[:type].nil?
|
89
99
|
end
|
90
100
|
|
91
101
|
def position
|
92
|
-
"
|
102
|
+
"pull-#{ @options[:position] }" unless @options[:position].nil?
|
103
|
+
end
|
104
|
+
|
105
|
+
def stacked
|
106
|
+
"nav-stacked" unless @options[:stacked].nil?
|
107
|
+
end
|
108
|
+
|
109
|
+
def tag
|
110
|
+
type == "nav-links" ? :nav : :ul
|
93
111
|
end
|
94
112
|
|
95
113
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ui_bibz/ui/core/nav/components/navbar_nav'
|
2
2
|
require 'ui_bibz/ui/core/nav/components/navbar_text'
|
3
3
|
require 'ui_bibz/ui/core/nav/components/navbar_form'
|
4
|
+
require 'ui_bibz/ui/core/nav/components/navbar_brand'
|
4
5
|
module UiBibz::Ui::Core
|
5
6
|
|
6
7
|
# Create a Navbar
|
@@ -17,9 +18,11 @@ module UiBibz::Ui::Core
|
|
17
18
|
#
|
18
19
|
# You can add HTML attributes using the +html_options+.
|
19
20
|
# You can pass arguments in options attribute:
|
20
|
-
# * +type+ - Symbol
|
21
|
-
# (+:
|
21
|
+
# * +type+ - Symbol
|
22
|
+
# (+:light+, +:dark+)
|
22
23
|
# * +glyph+
|
24
|
+
# * +state+
|
25
|
+
# (+:secondary+, +:primary+, +:info+, +:warning+, +:danger+, +inverse+)
|
23
26
|
# * +position+ - Symbol
|
24
27
|
# (+:top+, +:bottom+)
|
25
28
|
# * +title+ - String
|
@@ -71,7 +74,7 @@ module UiBibz::Ui::Core
|
|
71
74
|
|
72
75
|
# Render html tag
|
73
76
|
def render
|
74
|
-
content_tag :nav,
|
77
|
+
content_tag :nav, html_options do
|
75
78
|
content_tag :div, class: 'container-fluid' do
|
76
79
|
concat header_html
|
77
80
|
concat body_html
|
@@ -92,35 +95,42 @@ module UiBibz::Ui::Core
|
|
92
95
|
@items << UiBibz::Ui::Core::NavbarForm.new(model_or_url, options, &block).render
|
93
96
|
end
|
94
97
|
|
98
|
+
# Not use !!!!!
|
95
99
|
# Add navbar text items
|
96
100
|
# See UiBibz::Ui::Core::NavbarText
|
97
|
-
def text content = nil, options = nil, html_options = nil, &block
|
98
|
-
|
99
|
-
end
|
101
|
+
#def text content = nil, options = nil, html_options = nil, &block
|
102
|
+
#@items << UiBibz::Ui::Core::NavbarText.new(content, options, html_options, &block).render
|
103
|
+
#end
|
100
104
|
|
101
105
|
def brand content = nil, options = nil, html_options = nil, &block
|
102
|
-
@brand = UiBibz::Ui::Core::
|
106
|
+
@brand = UiBibz::Ui::Core::NavbarBrand.new(content, options, html_options, &block).render
|
103
107
|
end
|
104
108
|
|
105
109
|
private
|
106
110
|
|
111
|
+
def component_html_classes
|
112
|
+
['navbar', type, position]
|
113
|
+
end
|
114
|
+
|
107
115
|
def header_html
|
108
116
|
content_tag :div, class: 'navbar-header' do
|
109
117
|
concat navbar_toggle_button_html
|
110
|
-
concat link_to title.content, title.options[:url], title.class_and_html_options('navbar-brand') unless title.nil?
|
111
118
|
end
|
112
119
|
end
|
113
120
|
|
114
121
|
def title
|
115
122
|
@title ||= if @brand.nil?
|
116
|
-
brand(@options[:title]
|
123
|
+
brand(@options[:title]) unless @options[:title].nil?
|
117
124
|
else
|
118
125
|
@brand
|
119
126
|
end
|
120
127
|
end
|
121
128
|
|
122
129
|
def body_html
|
123
|
-
content_tag :div,
|
130
|
+
content_tag :div, class: "collapse navbar-toggleable-xs", id: id do
|
131
|
+
concat title
|
132
|
+
concat @items.join.html_safe
|
133
|
+
end
|
124
134
|
end
|
125
135
|
|
126
136
|
def id
|
@@ -128,12 +138,7 @@ module UiBibz::Ui::Core
|
|
128
138
|
end
|
129
139
|
|
130
140
|
def navbar_toggle_button_html
|
131
|
-
content_tag :button, class: 'navbar-
|
132
|
-
concat content_tag :span, 'Toggle navigation', class: 'sr-only'
|
133
|
-
concat content_tag :span, '', class: 'icon-bar'
|
134
|
-
concat content_tag :span, '', class: 'icon-bar'
|
135
|
-
concat content_tag :span, '', class: 'icon-bar'
|
136
|
-
end
|
141
|
+
content_tag :button, "☰", class: 'navbar-toggler hidden-sm-up', type: :button, data: { toggle: 'collapse', target:"##{ id }" }
|
137
142
|
end
|
138
143
|
|
139
144
|
def position
|
@@ -141,7 +146,11 @@ module UiBibz::Ui::Core
|
|
141
146
|
end
|
142
147
|
|
143
148
|
def type
|
144
|
-
"navbar-#{ @options[:type] || '
|
149
|
+
"navbar-#{ @options[:type] || 'light' }"
|
150
|
+
end
|
151
|
+
|
152
|
+
def state
|
153
|
+
"bg-#{ @options[:state] }" unless @options[:state].nil?
|
145
154
|
end
|
146
155
|
|
147
156
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a progress bar
|
4
|
+
#
|
5
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
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
|
+
# * +state+ - State of élement with symbol value:
|
18
|
+
# (+:secondary+, +:primary+, +:info+, +:warning+, +:danger+)
|
19
|
+
# * +max+ - Max value (default: 100)
|
20
|
+
# * +value+ - Value of percentage (default: content)
|
21
|
+
# * +animated+ - Boolean
|
22
|
+
# * +striped+ - Boolean
|
23
|
+
#
|
24
|
+
#
|
25
|
+
# ==== Signatures
|
26
|
+
#
|
27
|
+
# UiBibz::Ui::Core::Progress.new(percentage, options = nil, html_options = nil)
|
28
|
+
#
|
29
|
+
# UiBibz::Ui::Core::Progress.new(options = nil, html_options = nil) do
|
30
|
+
# percentage
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# ==== Examples
|
34
|
+
#
|
35
|
+
# UiBibz::Ui::Core::Progress.new(50%, { value: 50})
|
36
|
+
# # or
|
37
|
+
# UiBibz::Ui::Core::Progress.new(10%, { value: 10, state: :success },{ class: 'test' }).render
|
38
|
+
# # or
|
39
|
+
# UiBibz::Ui::Core::Progress.new({ value: 10, state: :success},{ class: 'test' }) do
|
40
|
+
# 10%
|
41
|
+
# end.render
|
42
|
+
#
|
43
|
+
# ==== Helper
|
44
|
+
#
|
45
|
+
# progress(integer, options = {}, html_options = {})
|
46
|
+
#
|
47
|
+
# progress(options = { tap: true }, html_options = {}) do |pb|
|
48
|
+
# pb.bar(integer, options = {}, html_options = {})
|
49
|
+
# pb.bar(options = {}, html_options = {}) do
|
50
|
+
# integer
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
class Progress < Component
|
55
|
+
|
56
|
+
# See UiBibz::Ui::Core::Component.initialize
|
57
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
58
|
+
super
|
59
|
+
@bars = []
|
60
|
+
end
|
61
|
+
|
62
|
+
# Render html tag
|
63
|
+
def render
|
64
|
+
content_tag :progress, content, html_options
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def component_html_classes
|
70
|
+
['progress', striped, animated]
|
71
|
+
end
|
72
|
+
|
73
|
+
def component_html_options
|
74
|
+
{ max: max, value: value }
|
75
|
+
end
|
76
|
+
|
77
|
+
def striped
|
78
|
+
'progress-striped' unless options[:striped].nil?
|
79
|
+
end
|
80
|
+
|
81
|
+
def animated
|
82
|
+
'progress-animated' unless options[:animated].nil?
|
83
|
+
end
|
84
|
+
|
85
|
+
def max
|
86
|
+
options[:max] || 100
|
87
|
+
end
|
88
|
+
|
89
|
+
def value
|
90
|
+
options[:value] || content.to_i
|
91
|
+
end
|
92
|
+
|
93
|
+
def state
|
94
|
+
"progress-#{ options[:state] }" unless options[:state].nil?
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
@@ -51,13 +51,18 @@ module UiBibz::Ui::Core
|
|
51
51
|
|
52
52
|
# Render html tag
|
53
53
|
def render
|
54
|
-
content_tag :span, stars_notation.join(' ').html_safe,
|
54
|
+
content_tag :span, stars_notation.join(' ').html_safe, html_options
|
55
55
|
end
|
56
56
|
|
57
57
|
private
|
58
58
|
|
59
|
+
|
60
|
+
def component_html_classes
|
61
|
+
'stars-notation'
|
62
|
+
end
|
63
|
+
|
59
64
|
def number
|
60
|
-
|
65
|
+
options[:num] || 5
|
61
66
|
end
|
62
67
|
|
63
68
|
def stars_notation
|
@@ -71,13 +76,16 @@ module UiBibz::Ui::Core
|
|
71
76
|
end
|
72
77
|
|
73
78
|
def glyph_opts
|
74
|
-
|
79
|
+
opts = {}
|
80
|
+
opts = opts.merge({ state: options[:state] }) unless options[:state].nil?
|
81
|
+
opts = opts.merge({ size: options[:size] }) unless options[:size].nil?
|
82
|
+
opts
|
75
83
|
end
|
76
84
|
|
77
85
|
def star_name star
|
78
|
-
if star <=
|
86
|
+
if star <= content
|
79
87
|
'star'
|
80
|
-
elsif star >
|
88
|
+
elsif star > content && !content.is_a?(Integer) && star < content + 1
|
81
89
|
'star-half-o'
|
82
90
|
else
|
83
91
|
'star-o'
|
@@ -21,23 +21,25 @@ module UiBibz::Ui::Ux
|
|
21
21
|
tds
|
22
22
|
end
|
23
23
|
|
24
|
-
# Add "id" in url to match with current record
|
25
|
-
def inject_url url, record
|
26
|
-
url.gsub(/(\/id\/?)/, "/#{ record.id }/")
|
27
|
-
end
|
28
|
-
|
29
24
|
private
|
30
25
|
|
26
|
+
def default_actions?
|
27
|
+
@options[:default_actions].nil? ? true : @options[:default_actions]
|
28
|
+
end
|
29
|
+
|
31
30
|
def dropdown_action record
|
32
|
-
|
33
|
-
unless @actions.nil?
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
unless @actions.nil?
|
32
|
+
@actions.format_action.call(record) unless @actions.format_action.nil?
|
33
|
+
unless (default_actions? != true && @actions.raw_list.empty?)
|
34
|
+
UiBibz::Ui::Core::Dropdown.new(dropdown_action_name, { position: :right, size: :sm, glyph: actions_glyph }, { class: 'dropdown-action' }).tap do |d|
|
35
|
+
actions_links(record).each do |l|
|
36
|
+
d.html l.to_s.html_safe
|
37
|
+
end
|
38
|
+
# Maybe remove this line
|
39
|
+
@actions.reset unless @actions.format_action.nil?
|
40
|
+
end.render
|
39
41
|
end
|
40
|
-
end
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
def actions_glyph
|
@@ -2,16 +2,17 @@ module UiBibz::Ui::Ux
|
|
2
2
|
class Paginable < UiBibz::Ui::Base
|
3
3
|
include WillPaginate::ActionView
|
4
4
|
|
5
|
-
def initialize store, options
|
6
|
-
@store
|
7
|
-
@options
|
5
|
+
def initialize store, options, html_options = nil
|
6
|
+
@store = store
|
7
|
+
@options = options
|
8
|
+
@html_options = html_options
|
8
9
|
end
|
9
10
|
|
10
11
|
# Render html tag
|
11
12
|
def render
|
12
|
-
content_tag :div do
|
13
|
-
concat UiBibz::Ui::Ux::TablePagination.new(
|
14
|
-
concat UiBibz::Ui::Ux::TablePaginationPerPage.new(
|
13
|
+
content_tag :div, @html_options do
|
14
|
+
concat UiBibz::Ui::Ux::TablePagination.new(store: @store).render
|
15
|
+
concat UiBibz::Ui::Ux::TablePaginationPerPage.new(store: @store).render
|
15
16
|
concat tag(:br, class: 'ui-bibz-clear')
|
16
17
|
end
|
17
18
|
end
|
@@ -1,16 +1,17 @@
|
|
1
1
|
module UiBibz::Ui::Ux
|
2
2
|
class Searchable < UiBibz::Ui::Base
|
3
3
|
|
4
|
-
def initialize store, options
|
5
|
-
@store
|
6
|
-
@options
|
4
|
+
def initialize store, options, html_options = nil
|
5
|
+
@store = store
|
6
|
+
@options = options
|
7
|
+
@html_options = html_options
|
7
8
|
end
|
8
9
|
|
9
10
|
# Render html tag
|
10
11
|
def render
|
11
|
-
content_tag :div do
|
12
|
+
content_tag :div, @html_options do
|
12
13
|
concat content_tag(:div, table_name, class: 'title')
|
13
|
-
concat TableSearchField.new(store: @store, wrap_form: false).render if searchable?
|
14
|
+
concat TableSearchField.new({ store: @store, wrap_form: false }).render if searchable?
|
14
15
|
concat tag :br, class: 'ui-bibz-clear'
|
15
16
|
end
|
16
17
|
end
|