summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-04-05 16:36:07 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2017-04-07 15:44:00 +0200
commitc7b1a48da7df6c1f38df48caf2f2771d14956b30 (patch)
treee19611529a0c6fbdc769738e14591a255fd5d3f2 /core/js
parent3bce6a7a6feb06ad811f8ca255da5a18b5917f11 (diff)
downloadnextcloud-server-c7b1a48da7df6c1f38df48caf2f2771d14956b30.tar.gz
nextcloud-server-c7b1a48da7df6c1f38df48caf2f2771d14956b30.zip
add datepicker to the popover
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/sharedialogshareelistview.js36
1 files changed, 26 insertions, 10 deletions
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index b77e825f3fb..0ec14b30152 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -367,6 +367,19 @@
this.$('.popovermenu').on('afterHide', function() {
_this._menuOpen = false;
});
+ this.$('.popovermenu').on('beforeHide', function() {
+ var shareId = parseInt(_this._menuOpen, 10);
+ if(!_.isNaN(shareId)) {
+ var datePickerClass = '.expirationDateContainer-' + _this.cid + '-' + shareId;
+ var datePickerInput = '#expirationDatePicker-' + _this.cid + '-' + shareId;
+ var expireDateCheckbox = '#expireDate-' + _this.cid + '-' + shareId;
+ if ($(expireDateCheckbox).prop('checked')) {
+ $(datePickerInput).removeClass('hidden-visually');
+ $(datePickerClass).removeClass('hasDatepicker');
+ $(datePickerClass + ' .ui-datepicker').hide();
+ }
+ }
+ });
if (this._menuOpen != false) {
// Open menu again if it was opened before
var shareId = parseInt(this._menuOpen, 10);
@@ -476,17 +489,20 @@
var li = element.closest('li[data-share-id]');
var shareId = li.data('share-id');
var expirationDatePicker = '#expirationDatePicker-' + this.cid + '-' + shareId;
- $(expirationDatePicker).datepicker({dateFormat : 'dd-mm-yy'});
- $(expirationDatePicker).focus();
- },
+ var view = this;
+ $(expirationDatePicker).closest('div').datepicker({
+ dateFormat : 'dd-mm-yy',
+ onSelect:
+ function (expireDate) {
+ view.setExpirationDate(shareId, expireDate);
+ },
+ onClose:
+ function () {
+ $(expirationDatePicker).removeClass('hidden-visually');
+ }
+ });
- onChangeExpirationDate: function(event) {
- var datePicker = $(event.target);
- var expireDate = datePicker.val();
- var element = $(event.target);
- var li = element.closest('li[data-share-id]');
- var shareId = li.data('share-id');
- this.setExpirationDate(shareId, expireDate);
+ $(expirationDatePicker).addClass('hidden-visually');
},
setExpirationDate: function(shareId, expireDate) {