o2webappizer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +4 -9
- data/bin/o2webappizer +1 -1
- data/lib/o2webappizer.rb +1 -0
- data/lib/o2webappizer/app_builder.rb +167 -0
- data/lib/o2webappizer/generators/app_generator.rb +29 -0
- data/lib/o2webappizer/version.rb +1 -1
- data/templates/{dot_gitignore → .gitignore.tt} +4 -5
- data/templates/.ruby-version.tt +1 -0
- data/templates/Gemfile.tt +101 -0
- data/templates/README.md.tt +33 -0
- data/templates/app/assets/javascripts/app.js.coffee +7 -0
- data/templates/app/assets/javascripts/application.js.coffee +27 -0
- data/templates/app/assets/stylesheets/application.sass +20 -0
- data/templates/app/controllers/application_controller.rb +9 -0
- data/templates/app/controllers/cms/authenticate.rb.tt +38 -0
- data/templates/app/helpers/application_helper.rb +2 -0
- data/templates/app/helpers/spree/frontend_helper_decorator.rb +12 -0
- data/templates/app/mailers/application_mailer.rb +3 -0
- data/templates/app/views/layouts/application.html.erb.tt +27 -0
- data/templates/app/views/layouts/mailer.html.erb +1 -0
- data/templates/app/views/layouts/mailer.text.erb +1 -0
- data/templates/app/views/spree/layouts/spree_application.html.erb +37 -0
- data/templates/app/views/spree/shared/_head.html.erb +14 -0
- data/templates/app/views/spree/shared/_main_nav_bar.html.erb +18 -0
- data/templates/config/database.yml.tt +99 -0
- data/templates/config/initializers/assets.rb.tt +19 -0
- data/templates/config/initializers/devise.rb.tt +1 -0
- data/templates/config/initializers/lazyload.rb +3 -0
- data/templates/config/initializers/rails_admin.rb +101 -0
- data/templates/config/initializers/rails_admin_cms.rb +17 -0
- data/templates/config/initializers/rich.rb +142 -0
- data/templates/config/initializers/simple_form.rb +165 -0
- data/templates/config/initializers/simple_form_bootstrap.rb +149 -0
- data/templates/config/initializers/spree.rb +55 -0
- data/templates/config/locales/en.yml +7 -0
- data/templates/config/locales/routes.en.yml +3 -0
- data/templates/config/locales/simple_form.en.yml +31 -0
- data/templates/config/routes.rb.tt +68 -0
- data/templates/config/secrets.yml.tt +28 -0
- data/templates/public/404.html +67 -0
- data/templates/public/422.html +67 -0
- data/templates/public/500.html +66 -0
- data/templates/public/favicon.ico +0 -0
- data/templates/public/images/full/missing.png +0 -0
- data/templates/public/images/huge/missing.png +0 -0
- data/templates/public/images/large/missing.png +0 -0
- data/templates/public/images/loading.gif +0 -0
- data/templates/public/images/medium/missing.png +0 -0
- data/templates/public/images/mini/missing.png +0 -0
- data/templates/public/images/original/missing.png +0 -0
- data/templates/public/images/rich_thumb/missing.png +0 -0
- data/templates/public/images/small/missing.png +0 -0
- data/templates/public/images/thumb/missing.png +0 -0
- data/templates/public/robots.txt.tt +15 -0
- data/templates/vendor/assets/javascripts/jquery.lazyload.js +242 -0
- data/templates/vendor/assets/javascripts/modernizr.js +3 -0
- data/templates/vendor/assets/javascripts/spree/backend/all.js +11 -0
- data/templates/vendor/assets/javascripts/spree/frontend/all.js +13 -0
- data/templates/vendor/assets/stylesheets/nprogress-variables.sass +3 -0
- data/templates/vendor/assets/stylesheets/spree/backend/all.css +10 -0
- data/templates/vendor/assets/stylesheets/spree/frontend/all.css +12 -0
- metadata +58 -3
@@ -0,0 +1,17 @@
|
|
1
|
+
RailsAdminCMS.config do |config|
|
2
|
+
# Defines the base controller inherited from
|
3
|
+
# config.parent_controller = ::ApplicationController
|
4
|
+
|
5
|
+
# Defines the base mailer inherited from
|
6
|
+
# config.parent_mailer = ::ApplicationMailer
|
7
|
+
|
8
|
+
# Defines if PaperTrail support is used
|
9
|
+
# config.with_paper_trail = false
|
10
|
+
|
11
|
+
# Defines the maximum number of fields a Form defined admin side has
|
12
|
+
# * it is important to note that rake cms:adjust_max_size needs to be run if that number changes
|
13
|
+
# config.custom_form_max_size = 20
|
14
|
+
|
15
|
+
# Defines if Forms defined admin side need their body to be editable
|
16
|
+
# config.with_email_body = false
|
17
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
require "rich"
|
2
|
+
|
3
|
+
if Object.const_defined?("Rich")
|
4
|
+
Rich.setup do |config|
|
5
|
+
# == Backend configuration
|
6
|
+
# Rich uses Paperclip (https://github.com/thoughtbot/paperclip) by default.
|
7
|
+
# You will need to add it to your Gemfile, however.
|
8
|
+
# config.backend = :paperclip
|
9
|
+
#
|
10
|
+
# Optionally, you can use CarrierWave (https://github.com/carrierwaveuploader/carrierwave).
|
11
|
+
# You will need to add it to your Gemfile.
|
12
|
+
# config.backend = :carrierwave
|
13
|
+
|
14
|
+
# == CKEditor configuration
|
15
|
+
#
|
16
|
+
# Rich ships with what I hope are sensible defaults.
|
17
|
+
# You may want to override these.
|
18
|
+
#
|
19
|
+
# For example, the elements available in the formats
|
20
|
+
# dropdown are defined like this:
|
21
|
+
config.editor[:format_tags] = "h1;h2;h3;h4;h5;h6;p;pre"
|
22
|
+
#
|
23
|
+
# By default, Rich visualizes what type of element
|
24
|
+
# you are editing. To disable this:
|
25
|
+
# config.editor[:startupOutlineBlocks] = false
|
26
|
+
|
27
|
+
|
28
|
+
# == Image styles
|
29
|
+
#
|
30
|
+
# Rich uses paperclip for image processing. You can
|
31
|
+
# define the styles you would like to use here. You
|
32
|
+
# can use the standard syntax allowed by paperclip.
|
33
|
+
# See: https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation
|
34
|
+
#
|
35
|
+
# When you change these after uploading some files,
|
36
|
+
# remember to re-generate your styles by running:
|
37
|
+
# rake rich:refresh_assets
|
38
|
+
config.image_styles = {
|
39
|
+
mini: '60x60>',
|
40
|
+
thumb: '120x120>',
|
41
|
+
small: '240x240>',
|
42
|
+
medium: '480x480>',
|
43
|
+
large: '960x960>',
|
44
|
+
full: '1480x1480>',
|
45
|
+
huge: '1920x1920>',
|
46
|
+
}
|
47
|
+
|
48
|
+
# == Convert options
|
49
|
+
#
|
50
|
+
# You can pass additional commands to ImageMagick to set image quality,
|
51
|
+
# apply a blur, and other fancy tricks.
|
52
|
+
config.convert_options = {
|
53
|
+
all: %{
|
54
|
+
-unsharp 3x1+0.5
|
55
|
+
-quality 85
|
56
|
+
-strip
|
57
|
+
-auto-orient
|
58
|
+
-colorspace sRGB
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
# == Allowed styles (in file manager)
|
63
|
+
#
|
64
|
+
# Of the styles specified above, which should be user
|
65
|
+
# selectable in the file manager?
|
66
|
+
#
|
67
|
+
# Example:
|
68
|
+
# config.allowed_styles = [ :large, :thumb ]
|
69
|
+
#
|
70
|
+
# Default:
|
71
|
+
# config.allowed_styles = :all
|
72
|
+
|
73
|
+
# == Default Style
|
74
|
+
#
|
75
|
+
# The style to insert by default. In addition to the
|
76
|
+
# styles defined above you can also use :original to get
|
77
|
+
# the unprocessed file. Make sure this style exists.
|
78
|
+
config.default_style = :medium
|
79
|
+
|
80
|
+
# == Upload non-image files
|
81
|
+
#
|
82
|
+
# Setting this option to true will add a second Rich filebrowser icon to
|
83
|
+
# the editor toolbar. In this filebrowser you can upload non-image files.
|
84
|
+
# Inserting these files into your editor will result in a direct (A) link.
|
85
|
+
#
|
86
|
+
# Default:
|
87
|
+
config.allow_document_uploads = true
|
88
|
+
|
89
|
+
# == Set allowed filetypes for non-image files
|
90
|
+
#
|
91
|
+
# If you want, you can restrict the types of documents that users can upload.
|
92
|
+
# Default behavior is to allow any kind of file to be uploaded. You can set
|
93
|
+
# the accepted types by providing an array of mimetypes to check against.
|
94
|
+
# Note that for this to have any effect, you first need to enable document
|
95
|
+
# uploads using the setting above.
|
96
|
+
#
|
97
|
+
# Default, allow any file to be uploaded:
|
98
|
+
# config.allowed_document_types = :all
|
99
|
+
#
|
100
|
+
# Example, only allow PDF uploads:
|
101
|
+
config.allowed_document_types = %w[
|
102
|
+
text/plain
|
103
|
+
application/pdf
|
104
|
+
application/msword
|
105
|
+
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
106
|
+
image/jpeg
|
107
|
+
image/png
|
108
|
+
image/gif
|
109
|
+
]
|
110
|
+
|
111
|
+
# == Asset insertion
|
112
|
+
#
|
113
|
+
# Set this to true to keep the filebrowser open after inserting an asset.
|
114
|
+
# Also configurable per-use from within the filebrowser.
|
115
|
+
#
|
116
|
+
# Default:
|
117
|
+
# config.insert_many = false
|
118
|
+
|
119
|
+
# == User Authentication
|
120
|
+
#
|
121
|
+
# When defined, Rich will automatically call this method
|
122
|
+
# in a before filter to ensure that the user is logged in.
|
123
|
+
#
|
124
|
+
# If you do not change this value from the default, anyone
|
125
|
+
# will be able to see your images, and upload files.
|
126
|
+
#
|
127
|
+
# Example for Devise with an AdminUser model:
|
128
|
+
config.authentication_method = :authenticate_admin_user!
|
129
|
+
#
|
130
|
+
# Default (NOT recommended in production environments):
|
131
|
+
# config.authentication_method = :none
|
132
|
+
|
133
|
+
# == Pagination
|
134
|
+
#
|
135
|
+
# By default, file picker loads up assets in blocks of 34.
|
136
|
+
#
|
137
|
+
# Default:
|
138
|
+
# config.paginates_per = 34
|
139
|
+
end
|
140
|
+
|
141
|
+
Rich.insert
|
142
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
# Wrappers are used by the form builder to generate a
|
4
|
+
# complete input. You can remove any component from the
|
5
|
+
# wrapper, change the order or even add your own to the
|
6
|
+
# stack. The options given below are used to wrap the
|
7
|
+
# whole input.
|
8
|
+
config.wrappers :default, class: :input,
|
9
|
+
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
10
|
+
## Extensions enabled by default
|
11
|
+
# Any of these extensions can be disabled for a
|
12
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
13
|
+
# You can make any of these extensions optional by
|
14
|
+
# renaming `b.use` to `b.optional`.
|
15
|
+
|
16
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
17
|
+
# and required attributes
|
18
|
+
b.use :html5
|
19
|
+
|
20
|
+
# Calculates placeholders automatically from I18n
|
21
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
22
|
+
b.use :placeholder
|
23
|
+
|
24
|
+
## Optional extensions
|
25
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
26
|
+
# to the input. If so, they will retrieve the values from the model
|
27
|
+
# if any exists. If you want to enable any of those
|
28
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
29
|
+
|
30
|
+
# Calculates maxlength from length validations for string inputs
|
31
|
+
b.optional :maxlength
|
32
|
+
|
33
|
+
# Calculates pattern from format validations for string inputs
|
34
|
+
b.optional :pattern
|
35
|
+
|
36
|
+
# Calculates min and max from length validations for numeric inputs
|
37
|
+
b.optional :min_max
|
38
|
+
|
39
|
+
# Calculates readonly automatically from readonly attributes
|
40
|
+
b.optional :readonly
|
41
|
+
|
42
|
+
## Inputs
|
43
|
+
b.use :label_input
|
44
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
45
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
46
|
+
|
47
|
+
## full_messages_for
|
48
|
+
# If you want to display the full error message for the attribute, you can
|
49
|
+
# use the component :full_error, like:
|
50
|
+
#
|
51
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
52
|
+
end
|
53
|
+
|
54
|
+
# The default wrapper to be used by the FormBuilder.
|
55
|
+
config.default_wrapper = :default
|
56
|
+
|
57
|
+
# Define the way to render check boxes / radio buttons with labels.
|
58
|
+
# Defaults to :nested for bootstrap config.
|
59
|
+
# inline: input + label
|
60
|
+
# nested: label > input
|
61
|
+
config.boolean_style = :nested
|
62
|
+
|
63
|
+
# Default class for buttons
|
64
|
+
config.button_class = 'btn'
|
65
|
+
|
66
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
67
|
+
# :first lists the first message for each field.
|
68
|
+
# Use :to_sentence to list all errors for each field.
|
69
|
+
# config.error_method = :first
|
70
|
+
|
71
|
+
# Default tag used for error notification helper.
|
72
|
+
config.error_notification_tag = :div
|
73
|
+
|
74
|
+
# CSS class to add for error notification helper.
|
75
|
+
config.error_notification_class = 'error_notification'
|
76
|
+
|
77
|
+
# ID to add for error notification helper.
|
78
|
+
# config.error_notification_id = nil
|
79
|
+
|
80
|
+
# Series of attempts to detect a default label method for collection.
|
81
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
82
|
+
|
83
|
+
# Series of attempts to detect a default value method for collection.
|
84
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
85
|
+
|
86
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
87
|
+
# config.collection_wrapper_tag = nil
|
88
|
+
|
89
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
90
|
+
# config.collection_wrapper_class = nil
|
91
|
+
|
92
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
93
|
+
# defaulting to :span.
|
94
|
+
# config.item_wrapper_tag = :span
|
95
|
+
|
96
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
97
|
+
# config.item_wrapper_class = nil
|
98
|
+
|
99
|
+
# How the label text should be generated altogether with the required text.
|
100
|
+
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
101
|
+
|
102
|
+
# You can define the class to use on all labels. Default is nil.
|
103
|
+
# config.label_class = nil
|
104
|
+
|
105
|
+
# You can define the default class to be used on forms. Can be overriden
|
106
|
+
# with `html: { :class }`. Defaulting to none.
|
107
|
+
# config.default_form_class = nil
|
108
|
+
|
109
|
+
# You can define which elements should obtain additional classes
|
110
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
111
|
+
|
112
|
+
# Whether attributes are required by default (or not). Default is true.
|
113
|
+
# config.required_by_default = true
|
114
|
+
|
115
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
116
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
117
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
118
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
119
|
+
# change this configuration to true.
|
120
|
+
config.browser_validations = false
|
121
|
+
|
122
|
+
# Collection of methods to detect if a file type was given.
|
123
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
124
|
+
|
125
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
126
|
+
# to match as key, and the input type that will be used when the field name
|
127
|
+
# matches the regexp as value.
|
128
|
+
# config.input_mappings = { /count/ => :integer }
|
129
|
+
|
130
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
131
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
132
|
+
# config.wrapper_mappings = { string: :prepend }
|
133
|
+
|
134
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
135
|
+
# override default inputs.
|
136
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
137
|
+
|
138
|
+
# Default priority for time_zone inputs.
|
139
|
+
# config.time_zone_priority = nil
|
140
|
+
|
141
|
+
# Default priority for country inputs.
|
142
|
+
# config.country_priority = nil
|
143
|
+
|
144
|
+
# When false, do not use translations for labels.
|
145
|
+
# config.translate_labels = true
|
146
|
+
|
147
|
+
# Automatically discover new inputs in Rails' autoload path.
|
148
|
+
# config.inputs_discovery = true
|
149
|
+
|
150
|
+
# Cache SimpleForm inputs discovery
|
151
|
+
# config.cache_discovery = !Rails.env.development?
|
152
|
+
|
153
|
+
# Default class for inputs
|
154
|
+
# config.input_class = nil
|
155
|
+
|
156
|
+
# Define the default class of the input wrapper of the boolean input.
|
157
|
+
config.boolean_label_class = 'checkbox'
|
158
|
+
|
159
|
+
# Defines if the default input wrapper class should be included in radio
|
160
|
+
# collection wrappers.
|
161
|
+
# config.include_default_input_wrapper_class = true
|
162
|
+
|
163
|
+
# Defines which i18n scope will be used in Simple Form.
|
164
|
+
# config.i18n_scope = 'simple_form'
|
165
|
+
end
|
@@ -0,0 +1,149 @@
|
|
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
|
+
|
7
|
+
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
8
|
+
b.use :html5
|
9
|
+
b.use :placeholder
|
10
|
+
b.optional :maxlength
|
11
|
+
b.optional :pattern
|
12
|
+
b.optional :min_max
|
13
|
+
b.optional :readonly
|
14
|
+
b.use :label, class: 'control-label'
|
15
|
+
|
16
|
+
b.use :input, class: 'form-control'
|
17
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
18
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
19
|
+
end
|
20
|
+
|
21
|
+
config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
22
|
+
b.use :html5
|
23
|
+
b.use :placeholder
|
24
|
+
b.optional :maxlength
|
25
|
+
b.optional :readonly
|
26
|
+
b.use :label, class: 'control-label'
|
27
|
+
|
28
|
+
b.use :input
|
29
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
30
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
31
|
+
end
|
32
|
+
|
33
|
+
config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
34
|
+
b.use :html5
|
35
|
+
b.optional :readonly
|
36
|
+
|
37
|
+
b.wrapper tag: 'div', class: 'checkbox' do |ba|
|
38
|
+
ba.use :label_input
|
39
|
+
end
|
40
|
+
|
41
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
42
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
43
|
+
end
|
44
|
+
|
45
|
+
config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
46
|
+
b.use :html5
|
47
|
+
b.optional :readonly
|
48
|
+
b.use :label, class: 'control-label'
|
49
|
+
b.use :input
|
50
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
51
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
52
|
+
end
|
53
|
+
|
54
|
+
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
55
|
+
b.use :html5
|
56
|
+
b.use :placeholder
|
57
|
+
b.optional :maxlength
|
58
|
+
b.optional :pattern
|
59
|
+
b.optional :min_max
|
60
|
+
b.optional :readonly
|
61
|
+
b.use :label, class: 'col-sm-3 control-label'
|
62
|
+
|
63
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
64
|
+
ba.use :input, class: 'form-control'
|
65
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
66
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
71
|
+
b.use :html5
|
72
|
+
b.use :placeholder
|
73
|
+
b.optional :maxlength
|
74
|
+
b.optional :readonly
|
75
|
+
b.use :label, class: 'col-sm-3 control-label'
|
76
|
+
|
77
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
78
|
+
ba.use :input
|
79
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
80
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
85
|
+
b.use :html5
|
86
|
+
b.optional :readonly
|
87
|
+
|
88
|
+
b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
|
89
|
+
wr.wrapper tag: 'div', class: 'checkbox' do |ba|
|
90
|
+
ba.use :label_input
|
91
|
+
end
|
92
|
+
|
93
|
+
wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
94
|
+
wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
99
|
+
b.use :html5
|
100
|
+
b.optional :readonly
|
101
|
+
|
102
|
+
b.use :label, class: 'col-sm-3 control-label'
|
103
|
+
|
104
|
+
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
105
|
+
ba.use :input
|
106
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
107
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
112
|
+
b.use :html5
|
113
|
+
b.use :placeholder
|
114
|
+
b.optional :maxlength
|
115
|
+
b.optional :pattern
|
116
|
+
b.optional :min_max
|
117
|
+
b.optional :readonly
|
118
|
+
b.use :label, class: 'sr-only'
|
119
|
+
|
120
|
+
b.use :input, class: 'form-control'
|
121
|
+
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
122
|
+
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
123
|
+
end
|
124
|
+
|
125
|
+
config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
126
|
+
b.use :html5
|
127
|
+
b.optional :readonly
|
128
|
+
b.use :label, class: 'control-label'
|
129
|
+
b.wrapper tag: 'div', class: 'form-inline' do |ba|
|
130
|
+
ba.use :input, class: 'form-control'
|
131
|
+
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
132
|
+
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
133
|
+
end
|
134
|
+
end
|
135
|
+
# Wrappers for forms and inputs using the Bootstrap toolkit.
|
136
|
+
# Check the Bootstrap docs (http://getbootstrap.com)
|
137
|
+
# to learn about the different styles for forms and inputs,
|
138
|
+
# buttons and other elements.
|
139
|
+
config.default_wrapper = :vertical_form
|
140
|
+
config.wrapper_mappings = {
|
141
|
+
check_boxes: :vertical_radio_and_checkboxes,
|
142
|
+
radio_buttons: :vertical_radio_and_checkboxes,
|
143
|
+
file: :vertical_file_input,
|
144
|
+
boolean: :vertical_boolean,
|
145
|
+
datetime: :multi_select,
|
146
|
+
date: :multi_select,
|
147
|
+
time: :multi_select
|
148
|
+
}
|
149
|
+
end
|