From 7ab2632085440d3e792b4ccca3c527d26f10cad2 Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@gmx.de>
Date: Wed, 19 Mar 2014 12:11:14 +0100
Subject: [PATCH] Use tipsy to display error when selecting a date in the past

---
 core/js/share.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/core/js/share.js b/core/js/share.js
index 0b65e15309..02d16cbd89 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -718,13 +718,21 @@ $(document).ready(function() {
 	$(document).on('change', '#dropdown #expirationDate', function() {
 		var itemType = $('#dropdown').data('item-type');
 		var itemSource = $('#dropdown').data('item-source');
+
+		$(this).tipsy('hide');
+		$(this).removeClass('error');
+
 		$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'setExpirationDate', itemType: itemType, itemSource: itemSource, date: $(this).val() }, function(result) {
 			if (!result || result.status !== 'success') {
+				var expirationDateField = $('#dropdown #expirationDate');
 				if (!result.data.message) {
-					OC.dialogs.alert(t('core', 'Error setting expiration date'), t('core', 'Error'));
+					expirationDateField.attr('original-title', t('core', 'Error setting expiration date'));
 				} else {
-					OC.dialogs.alert(result.data.message, t('core', 'Error'));
+					expirationDateField.attr('original-title', result.data.message);
 				}
+				expirationDateField.tipsy({gravity: 'n', fade: true});
+				expirationDateField.tipsy('show');
+				expirationDateField.addClass('error');
 			}
 		});
 	});
-- 
GitLab