simple_form-bootstrap 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/simple_form-bootstrap.js +5 -1
- data/app/assets/javascripts/simple_form-bootstrap/select_input.js +12 -0
- data/lib/simple_form/bootstrap/form_builders/button.rb +25 -0
- data/lib/simple_form/bootstrap/setup.rb +1 -1
- data/lib/simple_form/bootstrap/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 082783c879caed348075aecb058899a107a06adf
|
4
|
+
data.tar.gz: 194227835e71f4be5627a1ed5ab624cb7090885d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c760ed407a6188f2d6d28c94f9611252cfda09bc462733625097583a0b10dc497b393cc5ba8afd1333ec6ea1b86980c535daffb3713181f6ab73cc7eb5429e65
|
7
|
+
data.tar.gz: d435e851205f2862ac558fa1bf6a1086d16c92cc50523ab803c6c5ea054bbb84888b74d68b514533d58aebce5556c5b29839ad2c9159d49162b4904c46472203
|
@@ -6,11 +6,15 @@
|
|
6
6
|
// Enable our date/time pickers
|
7
7
|
var datePickers = $('input.bootstrap-datepicker', node);
|
8
8
|
datePickers.datetimepicker();
|
9
|
+
|
10
|
+
// Enable our styled Bootstrap select controls, except Twitter Typeahead controls.
|
11
|
+
var selects = $('select.form-control:not(.typeahead)', node);
|
12
|
+
selects.selectpicker();
|
9
13
|
}
|
10
14
|
|
11
15
|
$(document).on('ready', function(e) {
|
12
16
|
initializeComponents(document);
|
13
|
-
})
|
17
|
+
});
|
14
18
|
$(document).on('DOMNodeInserted', function(e) {
|
15
19
|
initializeComponents(e.target);
|
16
20
|
});
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// Hijacks the default Bootstrap date-time picker to always format dates in the specified format
|
2
|
+
// through the use of a hidden field.
|
3
|
+
(function($) {
|
4
|
+
'use strict';
|
5
|
+
if ($.fn.selectpicker) {
|
6
|
+
return;
|
7
|
+
}
|
8
|
+
|
9
|
+
$.fn.selectpicker = function(arg) {
|
10
|
+
return methods.initialise.call(this, arg);
|
11
|
+
};
|
12
|
+
}(jQuery));
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SimpleForm::Bootstrap::FormBuilders::Button
|
2
|
+
# Adds the btn-default class selectively to buttons which do not have an explicit button type.
|
3
|
+
def button_with_bootstrap(type, *args, &proc)
|
4
|
+
options = args.extract_options!.dup
|
5
|
+
options[:class] = [*options[:class]]
|
6
|
+
|
7
|
+
# Add the specified class type.
|
8
|
+
if options[:class].select { |cls| cls.length < 4 || cls[0, 4] == 'btn-' }.empty?
|
9
|
+
if type.to_s == :submit.to_s.freeze
|
10
|
+
options[:class] << 'btn-primary'
|
11
|
+
else
|
12
|
+
options[:class] << 'btn-default'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
args << options
|
16
|
+
|
17
|
+
button_without_bootstrap(type, *args, &proc)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
SimpleForm::FormBuilder.class_eval do
|
22
|
+
include SimpleForm::Bootstrap::FormBuilders::Button
|
23
|
+
|
24
|
+
alias_method_chain :button, :bootstrap
|
25
|
+
end
|
@@ -10,7 +10,7 @@ module SimpleForm::Bootstrap::Setup
|
|
10
10
|
def configure_simple_form
|
11
11
|
SimpleForm.setup do |config|
|
12
12
|
config.error_notification_class = 'alert alert-danger'
|
13
|
-
config.button_class = 'btn
|
13
|
+
config.button_class = 'btn'
|
14
14
|
config.boolean_label_class = nil
|
15
15
|
|
16
16
|
config.wrappers :vertical_form, tag: 'div', class: 'form-group',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form-bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Low
|
@@ -76,9 +76,11 @@ files:
|
|
76
76
|
- Rakefile
|
77
77
|
- app/assets/javascripts/simple_form-bootstrap.js
|
78
78
|
- app/assets/javascripts/simple_form-bootstrap/date_time_input.js
|
79
|
+
- app/assets/javascripts/simple_form-bootstrap/select_input.js
|
79
80
|
- lib/simple_form/bootstrap.rb
|
80
81
|
- lib/simple_form/bootstrap/engine.rb
|
81
82
|
- lib/simple_form/bootstrap/form_builders.rb
|
83
|
+
- lib/simple_form/bootstrap/form_builders/button.rb
|
82
84
|
- lib/simple_form/bootstrap/form_builders/date_time.rb
|
83
85
|
- lib/simple_form/bootstrap/inputs.rb
|
84
86
|
- lib/simple_form/bootstrap/inputs/date_time_input.rb
|