diff --git a/tailbone/static/js/tailbone.buefy.datepicker.js b/tailbone/static/js/tailbone.buefy.datepicker.js new file mode 100644 index 00000000..d327f50e --- /dev/null +++ b/tailbone/static/js/tailbone.buefy.datepicker.js @@ -0,0 +1,47 @@ + +const TailboneDatepicker = { + + template: [ + '', + '' + ].join(' '), + + props: { + name: String, + id: String, + rawValue: String + }, + + methods: { + + formatDate(date) { + // just need to convert to simple ISO date format here, seems + // like there should be a more obvious way to do that? + var year = date.getFullYear() + var month = date.getMonth() + 1 + var day = date.getDate() + month = month < 10 ? '0' + month : month + day = day < 10 ? '0' + day : day + return year + '-' + month + '-' + day + }, + + parseDate(date) { + // note, this assumes classic YYYY-MM-DD (i.e. ISO?) format + var parts = date.split('-') + return new Date(parts[0], parseInt(parts[1]) - 1, parts[2]) + } + } + +} + +Vue.component('tailbone-datepicker', TailboneDatepicker) diff --git a/tailbone/static/themes/falafel/css/layout.css b/tailbone/static/themes/falafel/css/layout.css index 5134141a..b964d476 100644 --- a/tailbone/static/themes/falafel/css/layout.css +++ b/tailbone/static/themes/falafel/css/layout.css @@ -89,6 +89,21 @@ header .level .theme-picker { margin-top: 1em; } +/****************************** + * fix datepicker within modals + * TODO: someday this may not be necessary? cf. + * https://github.com/buefy/buefy/issues/292#issuecomment-347365637 + ******************************/ + +.modal .animation-content .modal-card { + overflow: visible !important; +} + +.modal-card-body { + overflow: visible !important; +} + + /****************************** * feedback ******************************/ diff --git a/tailbone/templates/deform/date_jquery.pt b/tailbone/templates/deform/date_jquery.pt index 47dba14a..90de0f86 100644 --- a/tailbone/templates/deform/date_jquery.pt +++ b/tailbone/templates/deform/date_jquery.pt @@ -37,16 +37,10 @@
${field.start_mapping()} - - + + ${field.end_mapping()}
diff --git a/tailbone/templates/forms/deform_buefy.mako b/tailbone/templates/forms/deform_buefy.mako index 2c80b42c..7557743f 100644 --- a/tailbone/templates/forms/deform_buefy.mako +++ b/tailbone/templates/forms/deform_buefy.mako @@ -57,25 +57,6 @@ const BuefyForm = { template: '#buefy-form-template', - methods: { - - formatDate(date) { - // just need to convert to simple ISO date format here, seems - // like there should be a more obvious way to do that? - var year = date.getFullYear() - var month = date.getMonth() + 1 - var day = date.getDate() - month = month < 10 ? '0' + month : month - day = day < 10 ? '0' + day : day - return year + '-' + month + '-' + day - }, - - parseDate(date) { - // note, this assumes classic YYYY-MM-DD (i.e. ISO?) format - var parts = date.split('-') - return new Date(parts[0], parseInt(parts[1]) - 1, parts[2]) - } - } } Vue.component('buefy-form', BuefyForm) diff --git a/tailbone/templates/themes/falafel/base.mako b/tailbone/templates/themes/falafel/base.mako index fea80462..9ba2cd7d 100644 --- a/tailbone/templates/themes/falafel/base.mako +++ b/tailbone/templates/themes/falafel/base.mako @@ -297,6 +297,9 @@ ## FontAwesome 5.3.1 + ## Tailbone / Buefy stuff + ${h.javascript_link(request.static_url('tailbone:static/js/tailbone.buefy.datepicker.js') + '?ver={}'.format(tailbone.__version__))} +