Skip to content

Commit 6849481

Browse files
author
Randy Bertram
committed
Switch to xstatic-bootstrap-datepicker
This points to datepicker 1.3.1 in xstatic. Also fixes a couple of minor bugs in forms with the new datepicker. The datepicker patch is: https://review.openstack.org/#/c/116866/ Change-Id: I0a8cb7a16e50addbbdb10df8bdd4be427937bd81 Closes-Bug: 1361666
1 parent 5526d42 commit 6849481

File tree

10 files changed

+15
-666
lines changed

10 files changed

+15
-666
lines changed

horizon/static/bootstrap/js/bootstrap-datepicker.js

-474
This file was deleted.

horizon/static/horizon/js/horizon.forms.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,19 @@ horizon.forms = {
8888
datepicker: function() {
8989
var startDate = $('input#id_start').datepicker()
9090
.on('changeDate', function(ev) {
91-
if (ev.date.valueOf() > endDate.date.valueOf()) {
92-
var newDate = new Date(ev.date);
91+
if (ev.dates[0].valueOf() > endDate.dates[0].valueOf()) {
92+
var newDate = new Date(ev.dates[0]);
9393
newDate.setDate(newDate.getDate() + 1);
94-
endDate.setValue(newDate);
94+
endDate.setDate(newDate);
9595
$('input#id_end')[0].focus();
9696
}
9797
startDate.hide();
98+
endDate.setStartDate(ev.dates[0]);
9899
endDate.update();
99100
}).data('datepicker');
100101

101102
var endDate = $('input#id_end').datepicker({
102-
onRender: function(date) {
103-
return date.valueOf() < startDate.date.valueOf() ? 'disabled' : '';
104-
}
103+
startDate: startDate ? startDate.dates[0] : null
105104
}).on('changeDate', function(ev) {
106105
endDate.hide();
107106
}).data('datepicker');

horizon/templates/horizon/_scripts.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<script src="{{ STATIC_URL }}horizon/lib/d3.js" type="text/javascript" charset="utf-8"></script>
2828

2929
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
30-
<script src='{{ STATIC_URL }}bootstrap/js/bootstrap-datepicker.js' type='text/javascript' charset='utf-8'></script>
30+
<script src='{{ STATIC_URL }}horizon/lib/bootstrap_datepicker/bootstrap-datepicker.js' type='text/javascript' charset='utf-8'></script>
3131

3232
<script src="{{ STATIC_URL }}horizon/lib/hogan.js" type="text/javascript" charset='utf-8'></script>
3333

horizon/test/settings.py

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import xstatic.pkg.angular
2727
import xstatic.pkg.angular_cookies
2828
import xstatic.pkg.angular_mock
29+
import xstatic.pkg.bootstrap_datepicker
2930
import xstatic.pkg.d3
3031
import xstatic.pkg.font_awesome
3132
import xstatic.pkg.hogan
@@ -159,6 +160,8 @@
159160
xstatic.main.XStatic(xstatic.pkg.angular_cookies).base_dir),
160161
('horizon/lib/angular',
161162
xstatic.main.XStatic(xstatic.pkg.angular_mock).base_dir),
163+
('horizon/lib/bootstrap_datepicker',
164+
xstatic.main.XStatic(xstatic.pkg.bootstrap_datepicker).base_dir),
162165
('horizon/lib',
163166
xstatic.main.XStatic(xstatic.pkg.d3).base_dir),
164167
('horizon/lib',

openstack_dashboard/settings.py

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import xstatic.pkg.angular
2727
import xstatic.pkg.angular_cookies
2828
import xstatic.pkg.angular_mock
29+
import xstatic.pkg.bootstrap_datepicker
2930
import xstatic.pkg.d3
3031
import xstatic.pkg.font_awesome
3132
import xstatic.pkg.hogan
@@ -156,6 +157,8 @@
156157
xstatic.main.XStatic(xstatic.pkg.angular_cookies).base_dir),
157158
('horizon/lib/angular',
158159
xstatic.main.XStatic(xstatic.pkg.angular_mock).base_dir),
160+
('horizon/lib/bootstrap_datepicker',
161+
xstatic.main.XStatic(xstatic.pkg.bootstrap_datepicker).base_dir),
159162
('horizon/lib',
160163
xstatic.main.XStatic(xstatic.pkg.d3).base_dir),
161164
('horizon/lib',

openstack_dashboard/static/bootstrap/scss/_datepicker.scss

-183
This file was deleted.

openstack_dashboard/static/dashboard/scss/horizon.scss

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ $font-size-base: 13px;
44
$modal-md: 732px;
55

66
@import "/bootstrap/scss/bootstrap";
7-
@import "/bootstrap/scss/_datepicker";
87
@import "_variables";
98
@import "_accordion_nav";
109

openstack_dashboard/templates/_stylesheets.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{% compress css %}
44
<link href='{{ STATIC_URL }}dashboard/scss/horizon.scss' type='text/scss' media='screen' rel='stylesheet' />
55
<link href='{{ STATIC_URL }}dashboard/css/rickshaw.css' type='text/css' media='screen' rel='stylesheet' />
6+
<link href='{{ STATIC_URL }}horizon/lib/bootstrap_datepicker/datepicker3.css' type='text/css' media='screen' rel='stylesheet' />
67
<link href='{{ STATIC_URL }}dashboard/scss/horizon_charts.scss' type='text/scss' media='screen' rel='stylesheet' />
78
<link href='{{ STATIC_URL }}dashboard/scss/horizon_workflow.scss' type='text/scss' media='screen' rel='stylesheet' />
89
<link href="{{ STATIC_URL }}horizon/lib/font-awesome/scss/font-awesome.scss" type="text/scss" media="screen" rel="stylesheet" />

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ xstatic>=1.0.0 # MIT License
3535
xstatic-angular>=1.2.1.1 # MIT License
3636
xstatic-angular-cookies>=1.2.1.1 # MIT License
3737
xstatic-angular-mock>=1.2.1.1 # MIT License
38+
xstatic-bootstrap-datepicker>=1.3.1.0 # Apache 2.0 License
3839
xstatic-d3>=3.1.6.2 # BSD License (3 clause)
3940
xstatic-hogan>=2.0.0.2 # Apache 2.0 License
4041
xstatic-font-awesome>=4.1.0 # SIL OFL 1.1 License, MIT License

run_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -o errexit
66
# Increment me any time the environment should be rebuilt.
77
# This includes dependency changes, directory renames, etc.
88
# Simple integer sequence: 1, 2, 3...
9-
environment_version=45
9+
environment_version=46
1010
#--------------------------------------------------------#
1111

1212
function usage {

0 commit comments

Comments
 (0)