Skip to content

Commit

Permalink
update assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerian committed Jul 20, 2013
1 parent 2780818 commit fbac443
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ task :update do
system("git status")

puts "\n"
puts "bootstrap-datepicker version: #{JSON.parse(File.read('./bootstrap-datepicker-src/component.json'))['version']}"
puts "bootstrap-datepicker version: #{JSON.parse(File.read('./bootstrap-datepicker-src/bower.json'))['version']}"
puts "bootstrap-datepicker-rails version: #{BootstrapDatepickerRails::Rails::VERSION}"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap-datepicker-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module BootstrapDatepickerRails
module Rails
VERSION = "1.1.1.1"
VERSION = "1.1.1.2"
end
end
116 changes: 108 additions & 8 deletions vendor/assets/javascripts/bootstrap-datepicker/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

(function( $ ) {

var $window = $(window);

function UTCDate(){
return new Date(Date.UTC.apply(Date, arguments));
}
Expand All @@ -28,6 +30,7 @@
return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
}


// Picker object

var Datepicker = function(element, options) {
Expand Down Expand Up @@ -137,12 +140,20 @@
o.weekStart %= 7;
o.weekEnd = ((o.weekStart + 6) % 7);

var format = DPGlobal.parseFormat(o.format)
var format = DPGlobal.parseFormat(o.format);
if (o.startDate !== -Infinity) {
o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
if (!!o.startDate) {
o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
} else {
o.startDate = -Infinity;
}
}
if (o.endDate !== Infinity) {
o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
if (!!o.endDate) {
o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
} else {
o.endDate = Infinity;
}
}

o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
Expand All @@ -151,6 +162,38 @@
o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
return parseInt(d, 10);
});

var plc = String(o.orientation).toLowerCase().split(/\s+/g),
_plc = o.orientation.toLowerCase();
plc = $.grep(plc, function(word){
return (/^auto|left|right|top|bottom$/).test(word);
});
o.orientation = {x: 'auto', y: 'auto'};
if (!_plc || _plc === 'auto')
; // no action
else if (plc.length === 1){
switch(plc[0]){
case 'top':
case 'bottom':
o.orientation.y = plc[0];
break;
case 'left':
case 'right':
o.orientation.x = plc[0];
break;
}
}
else {
_plc = $.grep(plc, function(word){
return (/^left|right$/).test(word);
});
o.orientation.x = _plc[0] || 'auto';

_plc = $.grep(plc, function(word){
return (/^top|bottom$/).test(word);
});
o.orientation.y = _plc[0] || 'auto';
}
},
_events: [],
_secondaryEvents: [],
Expand Down Expand Up @@ -350,14 +393,63 @@

place: function(){
if(this.isInline) return;
var calendarWidth = this.picker.outerWidth(),
calendarHeight = this.picker.outerHeight(),
visualPadding = 10,
windowWidth = $window.width(),
windowHeight = $window.height();

var zIndex = parseInt(this.element.parents().filter(function() {
return $(this).css('z-index') != 'auto';
}).first().css('z-index'))+10;
var offset = this.component ? this.component.parent().offset() : this.element.offset();
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(true);
var left = offset.left,
top = offset.top;

this.picker.removeClass(
'datepicker-orient-top datepicker-orient-bottom '+
'datepicker-orient-right datepicker-orient-left'
);

if (this.o.orientation.x !== 'auto') {
this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
if (this.o.orientation.x === 'right')
left -= calendarWidth - width;
}
// auto x orientation is best-placement: if it crosses a window
// edge, fudge it sideways
else {
// Default to left
this.picker.addClass('datepicker-orient-left');
if (offset.left < 0)
left -= offset.left - visualPadding;
else if (offset.left + calendarWidth > windowWidth)
left = windowWidth - calendarWidth - visualPadding;
}

// auto y orientation is best-situation: top or bottom, no fudging,
// decision based on which shows more of the calendar
var yorient = this.o.orientation.y,
top_overflow, bottom_overflow;
if (yorient === 'auto') {
top_overflow = 0 + offset.top - calendarHeight;
bottom_overflow = windowHeight - (offset.top + height + calendarHeight);
if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
yorient = 'top';
else
yorient = 'bottom';
}
this.picker.addClass('datepicker-orient-' + yorient);
if (yorient === 'top')
top += height;
else
top -= calendarHeight + parseInt(this.picker.css('padding'));

this.picker.css({
top: offset.top + height,
left: offset.left,
top: top,
left: left,
zIndex: zIndex
});
},
Expand Down Expand Up @@ -616,10 +708,13 @@
switch(this.viewMode){
case 0:
this.viewDate = this.moveMonth(this.viewDate, dir);
this._trigger('changeMonth', this.viewDate);
break;
case 1:
case 2:
this.viewDate = this.moveYear(this.viewDate, dir);
if (this.viewMode === 1)
this._trigger('changeYear', this.viewDate);
break;
}
this.fill();
Expand Down Expand Up @@ -716,9 +811,9 @@
}
if (element) {
element.change();
if (this.o.autoclose && (!which || which == 'date')) {
this.hide();
}
}
if (this.o.autoclose && (!which || which == 'date')) {
this.hide();
}
},

Expand Down Expand Up @@ -791,9 +886,11 @@
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
this._trigger('changeYear', this.viewDate);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
this._trigger('changeMonth', this.viewDate);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir);
Expand All @@ -816,9 +913,11 @@
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
this._trigger('changeYear', this.viewDate);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
this._trigger('changeMonth', this.viewDate);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
Expand Down Expand Up @@ -1008,6 +1107,7 @@
keyboardNavigation: true,
language: 'en',
minViewMode: 0,
orientation: "auto",
rtl: false,
startDate: -Infinity,
startView: 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Georgian translation for bootstrap-datepicker
* Levan Melikishvili <[email protected]>
*/
;(function($){
$.fn.datepicker.dates['ka'] = {
days: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი", "კვირა"],
daysShort: ["კვი", "ორშ", "სამ", "ოთხ", "ხუთ", "პარ", "შაბ", "კვი"],
daysMin: ["კვ", "ორ", "სა", "ოთ", "ხუ", "პა", "შა", "კვ"],
months: ["იანვარი", "თებერვალი", "მარტი", "აპრილი", "მაისი", "ივნისი", "ივლისი", "აგვისტო", "სექტემბერი", "ოქტომები", "ნოემბერი", "დეკემბერი"],
monthsShort: ["იან", "თებ", "მარ", "აპრ", "მაი", "ივნ", "ივლ", "აგვ", "სექ", "ოქტ", "ნოე", "დეკ"],
today: "დღეს",
clear: "გასუფთავება"
};
}(jQuery));
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Norwegian translation for bootstrap-datepicker
**/
;(function($){
$.fn.datepicker.dates['no'] = {
days: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
daysShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
daysMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
months: ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],
monthsShort: ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Des'],
today: 'I dag',
clear: 'Nullstill',
weekStart: 0
};
}(jQuery));
38 changes: 35 additions & 3 deletions vendor/assets/stylesheets/bootstrap-datepicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,47 @@
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-top: 0;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.datepicker-dropdown:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-top: 0;
position: absolute;
top: -6px;
}
.datepicker-dropdown.datepicker-orient-left:before {
left: 6px;
}
.datepicker-dropdown.datepicker-orient-left:after {
left: 7px;
}
.datepicker-dropdown.datepicker-orient-right:before {
right: 6px;
}
.datepicker-dropdown.datepicker-orient-right:after {
right: 7px;
}
.datepicker-dropdown.datepicker-orient-top:before {
top: -7px;
}
.datepicker-dropdown.datepicker-orient-top:after {
top: -6px;
}
.datepicker-dropdown.datepicker-orient-bottom:before {
bottom: -7px;
border-bottom: 0;
border-top: 7px solid #999;
}
.datepicker-dropdown.datepicker-orient-bottom:after {
bottom: -6px;
border-bottom: 0;
border-top: 6px solid #ffffff;
}
.datepicker > div {
display: none;
}
Expand All @@ -66,6 +92,12 @@
}
.datepicker table {
margin: 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.datepicker td,
.datepicker th {
Expand Down

0 comments on commit fbac443

Please sign in to comment.