Skip to content

Commit

Permalink
Merge branch 'development' (small improvements)
Browse files Browse the repository at this point in the history
  • Loading branch information
zpaulovics committed Mar 21, 2015
2 parents 5e70495 + 106ffbf commit c5405f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
28 changes: 6 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,31 +170,13 @@ Options can be passed from SimpleForm (from version 4.6.10 or later)

The scripts below will be included when you use the "require pickers" (for version v4.0.0+) or "require bootstrap-datetimepicker/pickers" (for version v1.0.0). If you need different activation scripts, ignore the //= require pickers (for version v4.0.0+) or //= require bootstrap-datetimepicker/pickers (for version v1.0.0) line in app/assets/javascripts/application.js.

Version 4.3.5+:
Version 4.7.15+:

```javascript
var default_picker_options = {
// put here your default options that should be applied for all pickers

// icons will be inserted if you run the generator with Font-Awesome parameter
icons: {
date: 'fa fa-calendar',
time: 'fa fa-clock-o',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-crosshairs',
clear: 'fa fa-trash-o'
}
}

$(document).on('ready page:change', function() {
$('.datetimepicker').datetimepicker(default_picker_options);

$('.timepicker').datetimepicker(default_picker_options);

$('.datepicker').datetimepicker(default_picker_options);
$('.datetimepicker').datetimepicker({
// put here your custom picker options, that should be applied for all pickers
});

$('.datetimerange').each(function(){
var $this = $(this)
Expand Down Expand Up @@ -267,8 +249,10 @@ The default values of the options:
widgetParent: null,
ignoreReadonly: false,
keepOpen: false,
focusOnShow: true,
inline: false,
keepInvalid: false,
datepickerInput: '.datepickerinput'
```
For more details, please refer to Bootstrap 3 Datepicker v4 Docs site:
- [for public API documentation](http://eonasdan.github.io/bootstrap-datetimepicker/#bootstrap-3-datepicker-v4-docs)
Expand Down
15 changes: 5 additions & 10 deletions lib/generators/datetimepicker_rails/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,11 @@ def create_pickers_js
icons = icon_family == 'Glyphicon' ? '' : get_icons

vendor 'assets/javascripts/pickers.js' do <<-FILE
var default_picker_options = {
#{icons}
}
$(document).on('ready page:change', function() {
$('.datetimepicker').datetimepicker(default_picker_options);
$('.timepicker').datetimepicker(default_picker_options);
$('.datepicker').datetimepicker(default_picker_options);
$('.datetimepicker').datetimepicker({
// put here your custom picker options, that should be applied for all pickers
#{icons}
});
$('.datetimerange').each(function(){
var $this = $(this)
Expand Down Expand Up @@ -143,7 +138,7 @@ def get_icons
icons += " today: \'#{options[:custom_icons][:today]}\',\n"
icons += " clear: \'#{options[:custom_icons][:clear]}\',\n"
icons += " close: \'#{options[:custom_icons][:close]}\'\n"
icons += " }\n"
icons += " }"
end

end
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/templates/inputs/date_picker_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def input(wrapper_options)
set_html_options
set_value_html_option

template.content_tag :div, class: 'input-group date datepicker' do
template.content_tag :div, class: 'input-group date datetimepicker' do
input = super(wrapper_options) # leave StringInput do the real rendering
input + input_button
end
Expand Down

0 comments on commit c5405f3

Please sign in to comment.