Skip to content

Commit

Permalink
Merge pull request #1983 from regulusweb/enhancement/dashboard-datepi…
Browse files Browse the repository at this point in the history
…ckers

Use a datepicker widget in some more forms in the dashboard.
  • Loading branch information
mvantellingen committed Jul 13, 2016
2 parents 89a4f5c + 95e071d commit 97c5055
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/oscar/apps/dashboard/orders/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

class OrderStatsForm(forms.Form):
date_from = forms.DateField(
required=False, label=pgettext_lazy(u"start date", u"From"))
required=False, label=pgettext_lazy(u"start date", u"From"),
widget=DatePickerInput)
date_to = forms.DateField(
required=False, label=pgettext_lazy(u"end date", u"To"))
required=False, label=pgettext_lazy(u"end date", u"To"),
widget=DatePickerInput)

_filters = _description = None

Expand Down
8 changes: 6 additions & 2 deletions src/oscar/apps/dashboard/reports/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from django.utils.translation import ugettext_lazy as _

from oscar.core.loading import get_class
from oscar.forms.widgets import DatePickerInput


GeneratorRepository = get_class('dashboard.reports.utils',
'GeneratorRepository')
Expand All @@ -20,11 +22,13 @@ class ReportForm(forms.Form):
" reports use the selected"
" date range"))

date_from = forms.DateField(label=_("Date from"), required=False)
date_from = forms.DateField(label=_("Date from"), required=False,
widget=DatePickerInput)
date_to = forms.DateField(label=_("Date to"),
help_text=_("The report is inclusive of this"
" date"),
required=False)
required=False,
widget=DatePickerInput)
download = forms.BooleanField(label=_("Download"), required=False)

def clean(self):
Expand Down
3 changes: 3 additions & 0 deletions src/oscar/static/oscar/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -5641,6 +5641,9 @@ form.flat {
.form-inline .select2-container.form-control {
display: inline-block;
}
.form-inline .form-group .form-inline {
display: inline-block;
}
.form-inline {
margin-bottom: 0;
}
Expand Down
4 changes: 3 additions & 1 deletion src/oscar/static/oscar/less/dashboard/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ form.flat {
.select2-container.form-control {
display: inline-block;
}
.form-group .form-inline {
display: inline-block;
}
}

.form-inline {
Expand Down Expand Up @@ -168,4 +171,3 @@ textarea {
width: 140px;
}
}

0 comments on commit 97c5055

Please sign in to comment.