mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
added transition to show/hide of feedback messages
This commit is contained in:
@@ -1128,6 +1128,9 @@ textarea:-moz-placeholder {/* for FF */
|
||||
-moz-box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
||||
-webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
||||
z-index:999; /* for repo.html: to show on top of fixed-hd */
|
||||
-webkit-transition: top 0.5s ease;
|
||||
-moz-transition: top 0.5s ease;
|
||||
transition: top 0.5s ease;
|
||||
}
|
||||
.messages .info {
|
||||
padding:5px;
|
||||
|
@@ -5,12 +5,6 @@ $('#title-panel, #left-panel, #right-panel').each(function() { // for ie 7
|
||||
});
|
||||
$('#tabs').tabs({cookie:{expires:1}});
|
||||
|
||||
// handle messages
|
||||
if ($('.messages')[0]) {
|
||||
$('#main').append($('.messages'));
|
||||
$('.messages').css({'left':($(window).width() - $('.messages').width())/2, 'top':10}).removeClass('hide');
|
||||
setTimeout(function() { $('.messages').addClass('hide'); }, 10000);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
@@ -410,15 +404,43 @@ function apply_form_error(formid, error_msg) {
|
||||
// show feedback
|
||||
function feedback(con, type, time) {
|
||||
var time = time || 5000;
|
||||
if ($('.messages')[0]) {
|
||||
$('.messages').html('<li class="' + type + '">' + con + '</li>');
|
||||
var $el;
|
||||
var hide_pos_top,
|
||||
show_pos_top = '15px';
|
||||
if ($('.messages').length > 0) {
|
||||
$el = $('.messages').html('<li class="' + type + '">' + this.HTMLescape(con) + '</li>');
|
||||
} else {
|
||||
var html = '<ul class="messages"><li class="' + type + '">' + con + '</li></ul>';
|
||||
$('#main').append(html);
|
||||
$el = $('<ul class="messages"><li class="' + type + '">' + this.HTMLescape(con) + '</li></ul>');
|
||||
$('#main').append($el);
|
||||
}
|
||||
$('.messages').css({'left':($(window).width() - $('.messages').width())/2, 'top':10}).removeClass('hide');
|
||||
setTimeout(function() { $('.messages').addClass('hide'); }, time);
|
||||
|
||||
hide_pos_top = '-' + ($el.outerHeight() + parseInt(show_pos_top)) + 'px';
|
||||
|
||||
// add transition: from 'hide' to 'show'. the transition effect is offered by CSS.
|
||||
$el.css({'left':($(window).width() - $el.width())/2, 'top': hide_pos_top});
|
||||
setTimeout(function() { $el.css({'top': show_pos_top}); }, 10);
|
||||
|
||||
setTimeout(function() { $el.css({'top': hide_pos_top}); }, time);
|
||||
}
|
||||
|
||||
// handle existing messages (in base.html)
|
||||
(function() {
|
||||
var $el;
|
||||
var hide_pos_top,
|
||||
show_pos_top = '15px';
|
||||
if ($('.messages').length > 0) {
|
||||
$el = $('.messages');
|
||||
|
||||
hide_pos_top = '-' + ($el.outerHeight() + parseInt(show_pos_top)) + 'px';
|
||||
|
||||
// add transition: from 'hide' to 'show'. the transition effect is offered by CSS.
|
||||
$el.css({'left':($(window).width() - $el.width())/2, 'top': hide_pos_top});
|
||||
setTimeout(function() { $el.css({'top': show_pos_top}); }, 10);
|
||||
|
||||
setTimeout(function() { $el.css({'top': hide_pos_top}); }, 5000);
|
||||
}
|
||||
})();
|
||||
|
||||
function disable(btn) {
|
||||
btn.attr('disabled', 'disabled').addClass('btn-disabled');
|
||||
}
|
||||
|
@@ -113,7 +113,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% if messages %}
|
||||
<ul class="messages hide">
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li class="{{ message.tags }}">
|
||||
{% if 'safe' in message.tags %}
|
||||
|
@@ -375,14 +375,23 @@ define([
|
||||
|
||||
feedback: function(con, type, time) {
|
||||
var time = time || 5000;
|
||||
var $el;
|
||||
var hide_pos_top,
|
||||
show_pos_top = '15px';
|
||||
if ($('.messages').length > 0) {
|
||||
$('.messages').html('<li class="' + type + '">' + this.HTMLescape(con) + '</li>');
|
||||
$el = $('.messages').html('<li class="' + type + '">' + this.HTMLescape(con) + '</li>');
|
||||
} else {
|
||||
var html = '<ul class="messages"><li class="' + type + '">' + this.HTMLescape(con) + '</li></ul>';
|
||||
$('#main').append(html);
|
||||
$el = $('<ul class="messages"><li class="' + type + '">' + this.HTMLescape(con) + '</li></ul>');
|
||||
$('#main').append($el);
|
||||
}
|
||||
$('.messages').css({'left':($(window).width() - $('.messages').width())/2, 'top':10}).removeClass('hide');
|
||||
setTimeout(function() { $('.messages').addClass('hide'); }, time);
|
||||
|
||||
hide_pos_top = '-' + ($el.outerHeight() + parseInt(show_pos_top)) + 'px';
|
||||
|
||||
// add transition: from 'hide' to 'show'. the transition effect is offered by CSS.
|
||||
$el.css({'left':($(window).width() - $el.width())/2, 'top': hide_pos_top});
|
||||
setTimeout(function() { $el.css({'top': show_pos_top}); }, 10);
|
||||
|
||||
setTimeout(function() { $el.css({'top': hide_pos_top}); }, time);
|
||||
},
|
||||
|
||||
showFormError: function(formid, error_msg) {
|
||||
|
Reference in New Issue
Block a user