-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eonasdan' version 4.7.15
- Loading branch information
Showing
8 changed files
with
102 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule bootstrap-datetimepicker
updated
from d072d9 to 6b255a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Datetimepicker | ||
module Rails | ||
VERSION = "4.3.5" | ||
VERSION = "4.7.15" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,64 @@ | ||
class DatePickerInput < SimpleForm::Inputs::StringInput | ||
def input(wrapper_options) | ||
value = object.send(attribute_name) if object.respond_to? attribute_name | ||
display_pattern = I18n.t('datepicker.dformat', :default => '%d/%m/%Y') | ||
input_html_options[:value] ||= I18n.localize(value, :format => display_pattern) if value.present? | ||
|
||
input_html_options[:type] = 'text' | ||
picker_pattern = I18n.t('datepicker.pformat', :default => 'DD/MM/YYYY') | ||
dayViewHeaderFormat = I18n.t('dayViewHeaderFormat', :default => 'MMMM YYYY') | ||
date_options = { | ||
locale: I18n.locale.to_s, | ||
dayViewHeaderFormat: dayViewHeaderFormat, | ||
format: picker_pattern | ||
} | ||
input_html_options[:data] ||= {} | ||
input_html_options[:data].merge!({date_options: date_options }) | ||
set_html_options | ||
set_value_html_option | ||
|
||
template.content_tag :div, class: 'input-group date datepicker' do | ||
input = super(wrapper_options) # leave StringInput do the real rendering | ||
input += template.content_tag :span, class: 'input-group-btn' do | ||
template.content_tag :button, class: 'btn btn-default', type: 'button' do | ||
template.content_tag :span, '', class: 'glyphicon glyphicon-calendar' | ||
end | ||
end | ||
input | ||
input + input_button | ||
end | ||
end | ||
|
||
def input_html_classes | ||
super.push '' # 'form-control' | ||
end | ||
|
||
private | ||
|
||
def input_button | ||
template.content_tag :span, class: 'input-group-btn' do | ||
template.content_tag :button, class: 'btn btn-default', type: 'button' do | ||
template.content_tag :span, '', class: 'glyphicon glyphicon-calendar' | ||
end | ||
end | ||
end | ||
|
||
def set_html_options | ||
input_html_options[:type] = 'text' | ||
input_html_options[:data] ||= {} | ||
input_html_options[:data].merge!(date_options: date_options) | ||
end | ||
|
||
def set_value_html_option | ||
return unless value.present? | ||
input_html_options[:value] ||= I18n.localize(value, format: display_pattern) | ||
end | ||
|
||
def value | ||
object.send(attribute_name) if object.respond_to? attribute_name | ||
end | ||
|
||
def display_pattern | ||
I18n.t('datepicker.dformat', default: '%d/%m/%Y') | ||
end | ||
|
||
def picker_pattern | ||
I18n.t('datepicker.pformat', default: 'DD/MM/YYYY') | ||
end | ||
|
||
def date_view_header_format | ||
I18n.t('dayViewHeaderFormat', default: 'MMMM YYYY') | ||
end | ||
|
||
def date_options_base | ||
{ | ||
locale: I18n.locale.to_s, | ||
format: picker_pattern | ||
} | ||
end | ||
|
||
def date_options | ||
date_options_base.merge!({dayViewHeaderFormat: date_view_header_format}) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,13 @@ | ||
class DatetimePickerInput < SimpleForm::Inputs::StringInput | ||
def input(wrapper_options) | ||
value = object.send(attribute_name) if object.respond_to? attribute_name | ||
display_pattern = I18n.t('datepicker.dformat', :default => '%d/%m/%Y') + ' ' + I18n.t('timepicker.dformat', :default => '%R') | ||
input_html_options[:value] ||= I18n.localize(value, :format => display_pattern) if value.present? | ||
class DatetimePickerInput < DatePickerInput | ||
private | ||
|
||
input_html_options[:type] = 'text' | ||
picker_pattern = I18n.t('datepicker.pformat', :default => 'DD/MM/YYYY') + ' ' + I18n.t('timepicker.pformat', :default => 'HH:mm') | ||
dayViewHeaderFormat = I18n.t('dayViewHeaderFormat', :default => 'MMMM YYYY') | ||
date_options = { | ||
locale: I18n.locale.to_s, | ||
dayViewHeaderFormat: dayViewHeaderFormat, | ||
format: picker_pattern | ||
} | ||
input_html_options[:data] ||= {} | ||
input_html_options[:data].merge!({date_options: date_options }) | ||
|
||
template.content_tag :div, class: 'input-group date datetimepicker' do | ||
input = super(wrapper_options) # leave StringInput do the real rendering | ||
input += template.content_tag :span, class: 'input-group-btn' do | ||
template.content_tag :button, class: 'btn btn-default', type: 'button' do | ||
template.content_tag :span, '', class: 'glyphicon glyphicon-calendar' | ||
end | ||
end | ||
input | ||
end | ||
def display_pattern | ||
I18n.t('datepicker.dformat', default: '%d/%m/%Y') + ' ' + | ||
I18n.t('timepicker.dformat', default: '%R') | ||
end | ||
|
||
def input_html_classes | ||
super.push '' # 'form-control' | ||
def picker_pattern | ||
I18n.t('datepicker.pformat', default: 'DD/MM/YYYY') + ' ' + | ||
I18n.t('timepicker.pformat', default: 'HH:mm') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,15 @@ | ||
class TimePickerInput < SimpleForm::Inputs::StringInput | ||
def input(wrapper_options) | ||
value = object.send(attribute_name) if object.respond_to? attribute_name | ||
display_pattern = I18n.t('timepicker.dformat', :default => '%R') | ||
input_html_options[:value] ||= I18n.localize(value, :format => display_pattern) if value.present? | ||
class TimePickerInput < DatePickerInput | ||
private | ||
|
||
input_html_options[:type] = 'text' | ||
picker_pattern = I18n.t('timepicker.pformat', :default => 'HH:mm') | ||
date_options = { | ||
locale: I18n.locale.to_s, | ||
format: picker_pattern | ||
} | ||
input_html_options[:data] ||= {} | ||
input_html_options[:data].merge!({date_options: date_options }) | ||
def display_pattern | ||
I18n.t('timepicker.dformat', default: '%R') | ||
end | ||
|
||
template.content_tag :div, class: 'input-group date timepicker' do | ||
input = super(wrapper_options) # leave StringInput do the real rendering | ||
input += template.content_tag :span, class: 'input-group-btn' do | ||
template.content_tag :button, class: 'btn btn-default', type: 'button' do | ||
template.content_tag :span, '', class: 'glyphicon glyphicon-time' | ||
end | ||
end | ||
input | ||
end | ||
def picker_pattern | ||
I18n.t('timepicker.pformat', default: 'HH:mm') | ||
end | ||
|
||
def input_html_classes | ||
super.push '' # 'form-control' | ||
def date_options | ||
date_options_base | ||
end | ||
end |