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

Add some simple javascript for usability.

* Ask confirmation before deleting an user
* Display the form when clicking on the add bill button
* Only show the delete button (for users) on mouse over.
This commit is contained in:
Alexis Metaireau 2011-08-10 19:23:54 +02:00
parent 822058b251
commit 67350e7acc
2 changed files with 43 additions and 1 deletions

View file

@ -4,6 +4,8 @@
<head> <head>
<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 type="text/javascript" charset="utf-8">{% block js %}{% endblock %}</script>
</head> </head>
<body> <body>

View file

@ -1,5 +1,41 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block js %}
$(document).ready(function(){
// display the form when clicking on the "add bill" button
$('#add_bill_button').click(function(){
$('#add_bill').show(200);
$(this).hide();
$('#hide_bill_form').show();
return false;
});
// and provide a mechanism to hide it back
$('#hide_bill_form').click(function(){
$('#add_bill').hide(200);
$(this).hide();
$('#add_bill_button').show();
return false;
});
// ask for confirmation before removing an user
$('a.remove').each(function(){
$(this).hide();
$(this).click(function(){
return confirm("are you sure?");
});
});
// display the remove button on mouse over (and hide them per default)
$('.members li').hover(function(){
$(this).children('a.remove').show();
}, function(){
$(this).children('a.remove').hide();
});
});
{% endblock %}
{% block top_menu %} {% block top_menu %}
<ul> <ul>
<li><a href="{{ url_for("exit") }}">logout</a></li> <li><a href="{{ url_for("exit") }}">logout</a></li>
@ -22,7 +58,11 @@
</form> </form>
</div> </div>
<div id="content" class="uniForm span-18 last"> <div id="content" class="uniForm span-18 last">
<a class="awesome button fright" href="{{ url_for('add_bill', project_id=project.id) }}">Add a bill</a> <a id="add_bill_button" class="awesome large green button fright" href="{{ url_for('add_bill', project_id=project.id) }}">Add a bill</a>
<a id="hide_bill_form" class="awesome button fright" style="display: none;" href="#">Hide form</a>
<form id="add_bill" action="{{ url_for('add_bill', project_id=project.id) }}" method="post" style="width: 400px; display: none">{{ forms.add_bill(bill_form) }}</form>
{% if bills.count() > 0 %} {% if bills.count() > 0 %}
<table class="list_bills"> <table class="list_bills">