1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Make flash messages go away after 2 seconds.

This commit is contained in:
Alexis Metaireau 2011-08-10 23:55:07 +02:00
parent 065fe965a0
commit 402d756bf1
3 changed files with 44 additions and 30 deletions

View file

@ -80,3 +80,10 @@ a {
.negative{ .negative{
color: red; color: red;
} }
.flash{
padding:8px;
background-color: #ffc;
font-weight: bold;
font-size:15px;-moz-border-radius: 6px;-webkit-border-radius: 6px;
}

View file

@ -5,7 +5,17 @@
<title>Account manager</title> <title>Account manager</title>
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='main.css') }}"> <link rel=stylesheet type=text/css href="{{ url_for('static', filename='main.css') }}">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">{% block js %}{% endblock %}</script> <script type="text/javascript" charset="utf-8">
$(document).ready(function(){
setTimeout(function(){
$(".flash").fadeOut("slow", function () {
$(".flash").remove();
});
}, 2000);
{% block js %}{% endblock %}
});
</script>
</head> </head>
<body> <body>
@ -17,7 +27,7 @@
</div> </div>
<hr> <hr>
{% for message in get_flashed_messages() %} {% for message in get_flashed_messages() %}
<div class=info>{{ message }}</div> <div class="flash">{{ message }}</div>
{% endfor %} {% endfor %}
{% block content %} {% block content %}
{% endblock %} {% endblock %}

View file

@ -1,38 +1,35 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block js %} {% block js %}
$(document).ready(function(){ // display the form when clicking on the "add bill" button
$('#add_bill_button').click(function(){
// display the form when clicking on the "add bill" button
$('#add_bill_button').click(function(){
$('#add_bill').show(200); $('#add_bill').show(200);
$(this).hide(); $(this).hide();
$('#hide_bill_form').show(); $('#hide_bill_form').show();
return false; return false;
}); });
// and provide a mechanism to hide it back // and provide a mechanism to hide it back
$('#hide_bill_form').click(function(){ $('#hide_bill_form').click(function(){
$('#add_bill').hide(200); $('#add_bill').hide(200);
$(this).hide(); $(this).hide();
$('#add_bill_button').show(); $('#add_bill_button').show();
return false; return false;
}); });
// ask for confirmation before removing an user // ask for confirmation before removing an user
$('a.remove').each(function(){ $('a.remove').each(function(){
$(this).hide(); $(this).hide();
$(this).click(function(){ $(this).click(function(){
return confirm("are you sure?"); return confirm("are you sure?");
}); });
}); });
// display the remove button on mouse over (and hide them per default) // display the remove button on mouse over (and hide them per default)
$('.members li').hover(function(){ $('.members li').hover(function(){
$(this).children('a.remove').show(); $(this).children('a.remove').show();
}, function(){ }, function(){
$(this).children('a.remove').hide(); $(this).children('a.remove').hide();
});
}); });
{% endblock %} {% endblock %}