ui_bibz 2.0.0.alpha24 → 2.0.0.alpha26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTORS.md +19 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +60 -55
- data/app/assets/javascripts/interface.coffee +11 -0
- data/app/assets/javascripts/ui_bibz.coffee +3 -1
- data/app/assets/stylesheets/table.sass +1 -2
- data/app/assets/stylesheets/ui_bibz.sass +2 -0
- data/app/inputs/custom_inputs/autocomplete_input.rb +3 -2
- data/app/inputs/custom_inputs/date_picker_input.rb +2 -2
- data/app/inputs/custom_inputs/dropdown_select_input.rb +2 -2
- data/app/inputs/custom_inputs/formula_input.rb +2 -2
- data/app/inputs/custom_inputs/markdown_editor_input.rb +2 -2
- data/app/inputs/custom_inputs/multi_column_input.rb +2 -2
- data/app/inputs/custom_inputs/multi_select_input.rb +2 -2
- data/app/inputs/custom_inputs/radios_input.rb +20 -0
- data/app/inputs/custom_inputs/surround_input.rb +2 -2
- data/app/inputs/custom_inputs/switch_input.rb +2 -2
- data/config/initializers/will_paginate.rb +79 -0
- data/lib/ui_bibz.rb +56 -30
- data/lib/ui_bibz/helpers/ui_core_helper.rb +45 -37
- data/lib/ui_bibz/ui/core/alert.rb +1 -2
- data/lib/ui_bibz/ui/core/{breadcrumb/breadcrumb.rb → breadcrumb.rb} +5 -5
- data/lib/ui_bibz/ui/core/cards/card.rb +6 -6
- data/lib/ui_bibz/ui/core/cards/components/block/card_block_link.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/block/card_block_text.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/block/card_block_title.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_block.rb +4 -4
- data/lib/ui_bibz/ui/core/cards/components/card_footer.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_header.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_image.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_list_group.rb +2 -2
- data/lib/ui_bibz/ui/core/component.rb +4 -51
- data/lib/ui_bibz/ui/core/component/glyph_extension.rb +19 -0
- data/lib/ui_bibz/ui/core/component/klass_extension.rb +38 -0
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/components/dropdown_divider.rb +1 -1
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/components/dropdown_header.rb +2 -2
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/components/dropdown_link.rb +2 -2
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/dropdown.rb +11 -12
- data/lib/ui_bibz/ui/core/{buttons/button_split_dropdown.rb → dropdowns/split_dropdown.rb} +6 -10
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button.rb +5 -5
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button_choice.rb +8 -8
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button_group.rb +5 -5
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button_link.rb +13 -9
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +98 -0
- data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +98 -0
- data/lib/ui_bibz/ui/core/{inputs → forms/choices}/switch_field.rb +3 -3
- data/lib/ui_bibz/ui/core/{inputs → forms/dates}/date_picker_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{inputs → forms/numbers}/formula_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/selects}/dropdown_select_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/selects}/multi_column_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/selects}/multi_select_field.rb +8 -8
- data/lib/ui_bibz/ui/core/{inputs → forms/textareas}/markdown_editor_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/texts}/autocomplete_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/texts}/surround_field.rb +5 -5
- data/lib/ui_bibz/ui/core/glyph.rb +2 -1
- data/lib/ui_bibz/ui/core/{list → lists}/components/list.rb +11 -11
- data/lib/ui_bibz/ui/core/{list/components → lists/components/list}/list_body.rb +2 -2
- data/lib/ui_bibz/ui/core/{list/components → lists/components/list}/list_header.rb +2 -2
- data/lib/ui_bibz/ui/core/{list → lists}/list_group.rb +4 -4
- data/lib/ui_bibz/ui/core/navs/components/nav_dropdown.rb +1 -1
- data/lib/ui_bibz/ui/core/navs/components/navbar_form.rb +3 -1
- data/lib/ui_bibz/ui/core/paths/breadcrumb.rb +109 -0
- data/lib/ui_bibz/ui/core/{breadcrumb → paths}/components/breadcrumb_link.rb +6 -6
- data/lib/ui_bibz/ui/core/{stars.rb → star.rb} +14 -14
- data/lib/ui_bibz/ui/core/tag.rb +1 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/components/modal_body.rb +2 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/components/modal_footer.rb +2 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/components/modal_header.rb +2 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/modal.rb +8 -8
- data/lib/ui_bibz/ui/ux/tables/components/actions.rb +9 -9
- data/lib/ui_bibz/ui/ux/tables/extensions/actionable.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/table_pagination.rb +5 -4
- data/lib/ui_bibz/version.rb +1 -1
- data/test/dummy/app/controllers/users_controller.rb +18 -0
- data/test/dummy/app/models/user.rb +1 -0
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/initializers/simple_form_bootstrap.rb +155 -0
- data/test/simple_form_test.rb +123 -0
- data/test/test_helper.rb +2 -2
- data/test/ui/breadcrumb_test.rb +2 -2
- data/test/ui/button_test.rb +13 -39
- data/test/ui/dropdown_test.rb +14 -1
- data/test/ui/glyph_test.rb +6 -0
- data/test/ui/input_dropdown_select_field_test.rb +9 -9
- data/test/ui/input_switch_field_test.rb +11 -11
- data/test/ui/inputs_test.rb +26 -12
- data/test/ui/list_group_test.rb +2 -2
- data/test/ui/{stars_test.rb → star_test.rb} +7 -7
- data/test/ui/table_test.rb +3 -3
- data/test/ui_helper_test.rb +6 -1
- data/ui_bibz.gemspec +4 -3
- data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.scss +250 -0
- metadata +65 -39
- data/lib/ui_bibz/helpers/pagination_helper.rb +0 -55
- data/lib/ui_bibz/ui/core/buttons/button_dropdown.rb +0 -82
@@ -1,6 +1,6 @@
|
|
1
1
|
module UiBibz::Ui::Core
|
2
2
|
|
3
|
-
# Create
|
3
|
+
# Create star notation
|
4
4
|
#
|
5
5
|
# This element is an extend of UiBibz::Ui::Core::Component.
|
6
6
|
#
|
@@ -16,33 +16,33 @@ module UiBibz::Ui::Core
|
|
16
16
|
# You can pass arguments in options attribute:
|
17
17
|
# * +status+ - status of élement with symbol value:
|
18
18
|
# (+:default+, +:primary+, +:info+, +:warning+, +:danger+)
|
19
|
-
# * +num+ - Integer, number of
|
19
|
+
# * +num+ - Integer, number of star
|
20
20
|
#
|
21
21
|
# ==== Signatures
|
22
22
|
#
|
23
|
-
# UiBibz::Ui::Core::
|
23
|
+
# UiBibz::Ui::Core::Star.new(content, options = nil, html_options = nil)
|
24
24
|
#
|
25
|
-
# UiBibz::Ui::Core::
|
25
|
+
# UiBibz::Ui::Core::Star.new(options = nil, html_options = nil) do
|
26
26
|
# content
|
27
27
|
# end
|
28
28
|
#
|
29
29
|
# ==== Examples
|
30
30
|
#
|
31
|
-
# UiBibz::Ui::Core::
|
31
|
+
# UiBibz::Ui::Core::Star.new(content, status: :success).render
|
32
32
|
#
|
33
|
-
# UiBibz::Ui::Core::
|
33
|
+
# UiBibz::Ui::Core::Star.new({ num: 10 }) do
|
34
34
|
# #content
|
35
35
|
# end.render
|
36
36
|
#
|
37
37
|
# ==== Helper
|
38
38
|
#
|
39
|
-
#
|
39
|
+
# star(content, options = {}, html_options = {})
|
40
40
|
#
|
41
|
-
#
|
41
|
+
# star(options = {}, html_options = {}) do
|
42
42
|
# content
|
43
43
|
# end
|
44
44
|
#
|
45
|
-
class
|
45
|
+
class Star < UiBibz::Ui::Core::Component
|
46
46
|
|
47
47
|
# See UiBibz::Ui::Core::Component.initialize
|
48
48
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -51,7 +51,7 @@ module UiBibz::Ui::Core
|
|
51
51
|
|
52
52
|
# Render html tag
|
53
53
|
def render
|
54
|
-
content_tag :span,
|
54
|
+
content_tag :span, star_notation.join(' ').html_safe, html_options
|
55
55
|
end
|
56
56
|
|
57
57
|
private
|
@@ -62,13 +62,13 @@ module UiBibz::Ui::Core
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def number
|
65
|
-
options[:num] || 5
|
65
|
+
(options[:num] || 5).to_i
|
66
66
|
end
|
67
67
|
|
68
|
-
def
|
68
|
+
def star_notation
|
69
69
|
stars = []
|
70
|
-
number.
|
71
|
-
star
|
70
|
+
number.times do |star|
|
71
|
+
star += 1
|
72
72
|
name = star_name(star)
|
73
73
|
stars << UiBibz::Ui::Core::Glyph.new(name, glyph_opts).render
|
74
74
|
end
|
data/lib/ui_bibz/ui/core/tag.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core
|
1
|
+
module UiBibz::Ui::Core::Windows::Components
|
2
2
|
|
3
3
|
# Create a modal body
|
4
4
|
#
|
@@ -29,7 +29,7 @@ module UiBibz::Ui::Core
|
|
29
29
|
# 'Exemple'
|
30
30
|
# end.render
|
31
31
|
#
|
32
|
-
class ModalBody < Component
|
32
|
+
class ModalBody < UiBibz::Ui::Core::Component
|
33
33
|
|
34
34
|
# See UiBibz::Ui::Core::Component.initialize
|
35
35
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core
|
1
|
+
module UiBibz::Ui::Core::Windows::Components
|
2
2
|
|
3
3
|
# Create a modal footer
|
4
4
|
#
|
@@ -29,7 +29,7 @@ module UiBibz::Ui::Core
|
|
29
29
|
# 'Exemple'
|
30
30
|
# end.render
|
31
31
|
#
|
32
|
-
class ModalFooter < Component
|
32
|
+
class ModalFooter < UiBibz::Ui::Core::Component
|
33
33
|
|
34
34
|
# See UiBibz::Ui::Core::Component.initialize
|
35
35
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core
|
1
|
+
module UiBibz::Ui::Core::Windows::Components
|
2
2
|
|
3
3
|
# Create a modal header
|
4
4
|
#
|
@@ -29,7 +29,7 @@ module UiBibz::Ui::Core
|
|
29
29
|
# 'Exemple'
|
30
30
|
# end.render
|
31
31
|
#
|
32
|
-
class ModalHeader < Component
|
32
|
+
class ModalHeader < UiBibz::Ui::Core::Component
|
33
33
|
|
34
34
|
# See UiBibz::Ui::Core::Component.initialize
|
35
35
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'ui_bibz/ui/core/
|
2
|
-
require 'ui_bibz/ui/core/
|
3
|
-
require 'ui_bibz/ui/core/
|
4
|
-
module UiBibz::Ui::Core
|
1
|
+
require 'ui_bibz/ui/core/windows/components/modal_header'
|
2
|
+
require 'ui_bibz/ui/core/windows/components/modal_body'
|
3
|
+
require 'ui_bibz/ui/core/windows/components/modal_footer'
|
4
|
+
module UiBibz::Ui::Core::Windows
|
5
5
|
|
6
6
|
# Create an modal
|
7
7
|
#
|
@@ -52,7 +52,7 @@ module UiBibz::Ui::Core
|
|
52
52
|
# end
|
53
53
|
# end
|
54
54
|
#
|
55
|
-
class Modal < Component
|
55
|
+
class Modal < UiBibz::Ui::Core::Component
|
56
56
|
|
57
57
|
# See UiBibz::Ui::Core::Component.initialize
|
58
58
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -73,15 +73,15 @@ module UiBibz::Ui::Core
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def header content = nil, options = nil, html_options = nil, &block
|
76
|
-
@header = ModalHeader.new(content, options, html_options, &block).render
|
76
|
+
@header = UiBibz::Ui::Core::Windows::Components::ModalHeader.new(content, options, html_options, &block).render
|
77
77
|
end
|
78
78
|
|
79
79
|
def footer content = nil, options = nil, html_options = nil, &block
|
80
|
-
@footer = ModalFooter.new(content, options, html_options, &block).render
|
80
|
+
@footer = UiBibz::Ui::Core::Windows::Components::ModalFooter.new(content, options, html_options, &block).render
|
81
81
|
end
|
82
82
|
|
83
83
|
def body content = nil, options = nil, html_options = nil, &block
|
84
|
-
@body = ModalBody.new(content, options, html_options, &block).render
|
84
|
+
@body = UiBibz::Ui::Core::Windows::Components::ModalBody.new(content, options, html_options, &block).render
|
85
85
|
end
|
86
86
|
|
87
87
|
private
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'ui_bibz/ui/core/
|
2
|
-
require 'ui_bibz/ui/core/
|
3
|
-
require 'ui_bibz/ui/core/
|
1
|
+
require 'ui_bibz/ui/core/dropdowns/components/dropdown_header'
|
2
|
+
require 'ui_bibz/ui/core/dropdowns/components/dropdown_divider'
|
3
|
+
require 'ui_bibz/ui/core/dropdowns/components/dropdown_link'
|
4
4
|
module UiBibz::Ui::Ux::Tables
|
5
5
|
class Actions
|
6
6
|
|
@@ -12,15 +12,15 @@ module UiBibz::Ui::Ux::Tables
|
|
12
12
|
|
13
13
|
# Add link action in table
|
14
14
|
def link content = nil, options = nil, html_options = nil, &block
|
15
|
-
@actions << UiBibz::Ui::Core::DropdownLink.new(content, options, html_options, &block).render
|
15
|
+
@actions << UiBibz::Ui::Core::Dropdowns::Components::DropdownLink.new(content, options, html_options, &block).render
|
16
16
|
end
|
17
17
|
|
18
18
|
def divider
|
19
|
-
@actions << UiBibz::Ui::Core::DropdownDivider.new.render
|
19
|
+
@actions << UiBibz::Ui::Core::Dropdowns::Components::DropdownDivider.new.render
|
20
20
|
end
|
21
21
|
|
22
22
|
def header content = nil, options = nil, html_options = nil, &block
|
23
|
-
@actions << UiBibz::Ui::Core::DropdownHeader.new(content, options, html_options, &block).render
|
23
|
+
@actions << UiBibz::Ui::Core::Dropdowns::Components::DropdownHeader.new(content, options, html_options, &block).render
|
24
24
|
end
|
25
25
|
|
26
26
|
def html content
|
@@ -52,9 +52,9 @@ module UiBibz::Ui::Ux::Tables
|
|
52
52
|
|
53
53
|
def defaults_actions
|
54
54
|
[
|
55
|
-
UiBibz::Ui::Core::DropdownLink.new(show_name, url: { controller: @store.controller, action: 'show', id: :id }, glyph: 'eye').render,
|
56
|
-
UiBibz::Ui::Core::DropdownLink.new(edit_name, url:{ controller: @store.controller, action: 'edit', id: :id }, glyph: 'pencil').render,
|
57
|
-
UiBibz::Ui::Core::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.controller, action: 'destroy', id: :id }, link_html_options: { data: { confirm: 'Are you sure?', method: :delete }}}).render
|
55
|
+
UiBibz::Ui::Core::Dropdowns::Components::DropdownLink.new(show_name, url: { controller: @store.controller, action: 'show', id: :id }, glyph: 'eye').render,
|
56
|
+
UiBibz::Ui::Core::Dropdowns::Components::DropdownLink.new(edit_name, url:{ controller: @store.controller, action: 'edit', id: :id }, glyph: 'pencil').render,
|
57
|
+
UiBibz::Ui::Core::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.controller, action: 'destroy', id: :id }, link_html_options: { data: { confirm: 'Are you sure?', method: :delete }}}).render
|
58
58
|
]
|
59
59
|
end
|
60
60
|
|
@@ -31,7 +31,7 @@ module UiBibz::Ui::Ux::Tables
|
|
31
31
|
unless @actions.nil?
|
32
32
|
@actions.format_action.call(record) unless @actions.format_action.nil?
|
33
33
|
unless (default_actions? != true && @actions.raw_list.empty?)
|
34
|
-
UiBibz::Ui::Core::
|
34
|
+
UiBibz::Ui::Core::Dropdowns::Dropdown.new(dropdown_action_name, { position: :right, size: :sm, glyph: actions_glyph }, { class: 'dropdown-action' }).tap do |d|
|
35
35
|
actions_links(record).each do |l|
|
36
36
|
d.html l.to_s.html_safe
|
37
37
|
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
require 'will_paginate'
|
2
|
-
require "will_paginate-
|
1
|
+
#require 'will_paginate'
|
2
|
+
require "will_paginate-bootstrap4"
|
3
3
|
require "ui_bibz/ui/ux/tables/components/store"
|
4
|
-
require 'ui_bibz/helpers/pagination_helper'
|
5
4
|
module UiBibz::Ui::Ux::Tables
|
6
5
|
|
7
6
|
# Create a pagination for table
|
@@ -27,6 +26,8 @@ module UiBibz::Ui::Ux::Tables
|
|
27
26
|
#
|
28
27
|
class TablePagination < UiBibz::Ui::Base
|
29
28
|
include WillPaginate::ActionView
|
29
|
+
include ActionView
|
30
|
+
#include WillPaginate::ActionView::BootstrapLinkRenderer
|
30
31
|
|
31
32
|
# Initialize pagination with component item
|
32
33
|
# pagination require WillPaginate gem
|
@@ -39,7 +40,7 @@ module UiBibz::Ui::Ux::Tables
|
|
39
40
|
paginate_parameters = { controller: store.controller }
|
40
41
|
paginate_parameters = paginate_parameters.merge({ store_id: store.id }) unless store.id.nil?
|
41
42
|
paginate_parameters = paginate_parameters.merge(store.parameters)
|
42
|
-
will_paginate(store.records, params: paginate_parameters,
|
43
|
+
will_paginate(store.records, params: paginate_parameters, renderer: WillPaginate::ActionView::BootstrapLinkRenderer)
|
43
44
|
end
|
44
45
|
|
45
46
|
private
|
data/lib/ui_bibz/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
# Prevent CSRF attacks by raising an exception.
|
3
|
+
# For APIs, you may want to use :null_session instead.
|
4
|
+
def index
|
5
|
+
end
|
6
|
+
def add
|
7
|
+
end
|
8
|
+
def edit
|
9
|
+
end
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
def create
|
13
|
+
end
|
14
|
+
def update
|
15
|
+
end
|
16
|
+
def destroy
|
17
|
+
end
|
18
|
+
end
|
@@ -20,7 +20,7 @@ module Dummy
|
|
20
20
|
# config.i18n.default_locale = :de
|
21
21
|
|
22
22
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
-
config.active_record.raise_in_transactional_callbacks = true
|
23
|
+
#config.active_record.raise_in_transactional_callbacks = true
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
config.error_notification_class = 'alert alert-danger'
|
4
|
+
config.button_class = 'btn btn-default'
|
5
|
+
config.boolean_label_class = nil
|
6
|
+
config.custom_inputs_namespaces << "CustomInputs"
|
7
|
+
|
8
|
+
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
9
|
+
b.use :html5
|
10
|
+
b.use :placeholder
|
11
|
+
b.optional :maxlength
|
12
|
+
b.optional :minlength
|
13
|
+
b.optional :pattern
|
14
|
+
b.optional :min_max
|
15
|
+
b.optional :readonly
|
16
|
+
b.use :label, class: 'control-label'
|
17
|
+
|
18
|
+
b.use :input, class: 'form-control'
|
19
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
20
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
21
|
+
end
|
22
|
+
|
23
|
+
config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
24
|
+
b.use :html5
|
25
|
+
b.use :placeholder
|
26
|
+
b.optional :maxlength
|
27
|
+
b.optional :minlength
|
28
|
+
b.optional :readonly
|
29
|
+
b.use :label, class: 'control-label'
|
30
|
+
|
31
|
+
b.use :input
|
32
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
33
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
34
|
+
end
|
35
|
+
|
36
|
+
config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
37
|
+
b.use :html5
|
38
|
+
b.optional :readonly
|
39
|
+
|
40
|
+
b.wrapper tag: 'div', class: 'checkbox' do |ba|
|
41
|
+
ba.use :label_input
|
42
|
+
end
|
43
|
+
|
44
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
45
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
46
|
+
end
|
47
|
+
|
48
|
+
config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
49
|
+
b.use :html5
|
50
|
+
b.optional :readonly
|
51
|
+
b.use :label, class: 'control-label'
|
52
|
+
b.use :input
|
53
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
54
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
55
|
+
end
|
56
|
+
|
57
|
+
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
58
|
+
b.use :html5
|
59
|
+
b.use :placeholder
|
60
|
+
b.optional :maxlength
|
61
|
+
b.optional :minlength
|
62
|
+
b.optional :pattern
|
63
|
+
b.optional :min_max
|
64
|
+
b.optional :readonly
|
65
|
+
b.use :label, class: 'col-sm-3 control-label'
|
66
|
+
|
67
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
68
|
+
ba.use :input, class: 'form-control'
|
69
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
70
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
75
|
+
b.use :html5
|
76
|
+
b.use :placeholder
|
77
|
+
b.optional :maxlength
|
78
|
+
b.optional :minlength
|
79
|
+
b.optional :readonly
|
80
|
+
b.use :label, class: 'col-sm-3 control-label'
|
81
|
+
|
82
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
83
|
+
ba.use :input
|
84
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
85
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
90
|
+
b.use :html5
|
91
|
+
b.optional :readonly
|
92
|
+
|
93
|
+
b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
|
94
|
+
wr.wrapper tag: 'div', class: 'checkbox' do |ba|
|
95
|
+
ba.use :label_input
|
96
|
+
end
|
97
|
+
|
98
|
+
wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
99
|
+
wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
104
|
+
b.use :html5
|
105
|
+
b.optional :readonly
|
106
|
+
|
107
|
+
b.use :label, class: 'col-sm-3 control-label'
|
108
|
+
|
109
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
110
|
+
ba.use :input
|
111
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
112
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
117
|
+
b.use :html5
|
118
|
+
b.use :placeholder
|
119
|
+
b.optional :maxlength
|
120
|
+
b.optional :minlength
|
121
|
+
b.optional :pattern
|
122
|
+
b.optional :min_max
|
123
|
+
b.optional :readonly
|
124
|
+
b.use :label, class: 'sr-only'
|
125
|
+
|
126
|
+
b.use :input, class: 'form-control'
|
127
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
128
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
129
|
+
end
|
130
|
+
|
131
|
+
config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
132
|
+
b.use :html5
|
133
|
+
b.optional :readonly
|
134
|
+
b.use :label, class: 'control-label'
|
135
|
+
b.wrapper tag: 'div', class: 'form-inline' do |ba|
|
136
|
+
ba.use :input, class: 'form-control'
|
137
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
138
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
139
|
+
end
|
140
|
+
end
|
141
|
+
# Wrappers for forms and inputs using the Bootstrap toolkit.
|
142
|
+
# Check the Bootstrap docs (http://getbootstrap.com)
|
143
|
+
# to learn about the different styles for forms and inputs,
|
144
|
+
# buttons and other elements.
|
145
|
+
config.default_wrapper = :vertical_form
|
146
|
+
config.wrapper_mappings = {
|
147
|
+
check_boxes: :vertical_radio_and_checkboxes,
|
148
|
+
radio_buttons: :vertical_radio_and_checkboxes,
|
149
|
+
file: :vertical_file_input,
|
150
|
+
boolean: :vertical_boolean,
|
151
|
+
datetime: :multi_select,
|
152
|
+
date: :multi_select,
|
153
|
+
time: :multi_select
|
154
|
+
}
|
155
|
+
end
|