Skip to content

Commit

Permalink
Merge pull request #83 from 4teamwork/merge_dont_autohide_messages
Browse files Browse the repository at this point in the history
Don't autohide messages but replace old ones.
  • Loading branch information
Denis Krienbühl committed Nov 12, 2013
2 parents a9101ac + a536a44 commit 4563479
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Changelog
1.1 (unreleased)
----------------

- Don't autohide messages from a closing lightbox but replace existing portal
messages in the main column.
[deiferni]

- Be a bit more tolerant with time user-input for allocations and reservations.
Auto-Correct "24:00" to "00:00" and strip additional text like "13:00 Uhr".
Don't validate start/end time of an allocation when "Whole Day" has been
Expand Down
29 changes: 18 additions & 11 deletions seantis/reservation/js/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,36 @@ var reservation_overlay_init = null;
// Shows portalMessages swallowed by the prepOverlay mechanism
// on the parent page
var get_popup_messages = function(soup) {

// all portal messages are in the same DOM (no iframe), so get the first
var target = $('dl.portalMessage:first');
var messages = soup.find('dl.portalMessage');
// the currently displayed messages, we can overwrite them with
// the new messages
var current_messages = $('dl.portalMessage');
// the new messages from the overlay
var new_messages = soup.find('dl.portalMessage');

// filter out the ones without any text
messages = _.filter(messages, function(m) {
new_messages = _.filter(new_messages, function(m) {
return !_.isEmpty($.trim($(m).find('dd').text()));
});

if (!messages.length) {
return {};
if (!new_messages.length) {
var show = function() {
current_messages.hide();
};
return {show: show};
}

messages = $(messages);
new_messages = $(new_messages);

var show = function() {
messages.hide();
target.after(messages);
messages.fadeIn('slow');
current_messages.hide();
new_messages.hide();
target.after(new_messages);
new_messages.fadeIn('slow');
};
var hide = function() {
messages.fadeOut('slow');
popups = null;
};

Expand All @@ -62,7 +70,6 @@ var reservation_overlay_init = null;
}

setTimeout(get_result.show, 0);
setTimeout(get_result.hide, 4000);
};

var disable_readonly_calendars = function() {
Expand Down Expand Up @@ -227,4 +234,4 @@ var reservation_overlay_init = null;
});
});

})(jQuery);
})(jQuery);

0 comments on commit 4563479

Please sign in to comment.