aboutsummaryrefslogtreecommitdiff
path: root/budget
diff options
context:
space:
mode:
Diffstat (limited to 'budget')
-rw-r--r--budget/api.py7
-rw-r--r--budget/static/delete.pngbin4355 -> 274 bytes
-rw-r--r--budget/static/deleter.pngbin0 -> 226 bytes
-rw-r--r--budget/static/edit.pngbin0 -> 258 bytes
-rw-r--r--budget/static/main.css53
-rw-r--r--budget/static/pen.pngbin3912 -> 0 bytes
-rw-r--r--budget/static/reactivate.pngbin0 -> 259 bytes
-rw-r--r--budget/static/refresh.pngbin3846 -> 0 bytes
-rw-r--r--budget/static/scissors.pngbin4312 -> 0 bytes
-rw-r--r--budget/templates/list_bills.html89
-rw-r--r--budget/web.py2
11 files changed, 57 insertions, 94 deletions
diff --git a/budget/api.py b/budget/api.py
index 9d41b3c..4ca04f2 100644
--- a/budget/api.py
+++ b/budget/api.py
@@ -2,7 +2,7 @@
from flask import *
from models import db, Project, Person, Bill
-from forms import (ProjectForm, EditProjectForm, MemberForm, BillForm,
+from forms import (ProjectForm, EditProjectForm, MemberForm, BillForm,
get_billform_for)
from utils import for_all_methods
@@ -12,6 +12,7 @@ from werkzeug import Response
api = Blueprint("api", __name__, url_prefix="/api")
+
def check_project(*args, **kwargs):
"""Check the request for basic authentication for a given project.
@@ -134,8 +135,8 @@ class BillHandler(object):
project_resource = RESTResource(
name="project",
- route="/projects",
- app=api,
+ route="/projects",
+ app=api,
actions=["add", "update", "delete", "get"],
handler=ProjectHandler())
diff --git a/budget/static/delete.png b/budget/static/delete.png
index a910d5a..aa786a3 100644
--- a/budget/static/delete.png
+++ b/budget/static/delete.png
Binary files differ
diff --git a/budget/static/deleter.png b/budget/static/deleter.png
new file mode 100644
index 0000000..04a23f3
--- /dev/null
+++ b/budget/static/deleter.png
Binary files differ
diff --git a/budget/static/edit.png b/budget/static/edit.png
new file mode 100644
index 0000000..02662fc
--- /dev/null
+++ b/budget/static/edit.png
Binary files differ
diff --git a/budget/static/main.css b/budget/static/main.css
index c14e0b7..830ef98 100644
--- a/budget/static/main.css
+++ b/budget/static/main.css
@@ -1,4 +1,4 @@
- @import "bootstrap-1.0.0.min.css";
+@import "bootstrap-1.0.0.min.css";
@import url(http://fonts.googleapis.com/css?family=Lobster|Comfortaa);
@import "jquery/jquery-ui.css";
@@ -130,31 +130,12 @@ div.topbar ul.secondary-nav { padding-right: 75px; }
.bill-actions {
padding-top: 2px;
padding-bottom: 2px;
-}
-
-.edit img {
- height: 24px;
-}
-
-.delete img {
- height: 24px;
-}
-
-#overlay {
- position:absolute;
- background-color:#000000;
- opacity:0.7;
- display:none;
text-align: center;
}
-#overlay-delete, #overlay-reactivate {
- width: 28px;
- height: 28px;
- margin-top: 2px;
- position:absolute;
- cursor:pointer;
- display:none;
+.edit img, .delete img{
+ height: 16px;
+ margin-right: 5px;
}
.balance-value{
@@ -177,3 +158,29 @@ tr.payer_line .balance-name{
text-indent:5px;
}
+.action {
+ position: absolute;
+ left: 10px;
+ width: 220px;
+ background: #000 ;
+ opacity: 0.6;
+ text-align: center;
+}
+.action a, .action a:hover {
+ height: 16px;
+ padding-left: 20px;
+}
+
+.delete a, .delete a:hover {
+ background: url('deleter.png') left no-repeat;
+ color: red;
+}
+
+.reactivate a, .reactivate a:hover {
+ background: url('reactivate.png') left no-repeat;
+ color: white;
+}
+
+#bill-form > fieldset {
+ margin-top: 10px;
+}
diff --git a/budget/static/pen.png b/budget/static/pen.png
deleted file mode 100644
index f486e40..0000000
--- a/budget/static/pen.png
+++ /dev/null
Binary files differ
diff --git a/budget/static/reactivate.png b/budget/static/reactivate.png
new file mode 100644
index 0000000..54c60c0
--- /dev/null
+++ b/budget/static/reactivate.png
Binary files differ
diff --git a/budget/static/refresh.png b/budget/static/refresh.png
deleted file mode 100644
index 3b815bf..0000000
--- a/budget/static/refresh.png
+++ /dev/null
Binary files differ
diff --git a/budget/static/scissors.png b/budget/static/scissors.png
deleted file mode 100644
index 2a40f0b..0000000
--- a/budget/static/scissors.png
+++ /dev/null
Binary files differ
diff --git a/budget/templates/list_bills.html b/budget/templates/list_bills.html
index 3b33fb8..e62a3bc 100644
--- a/budget/templates/list_bills.html
+++ b/budget/templates/list_bills.html
@@ -39,70 +39,25 @@
$('#hide-bill-form').click(hide_form);
$('#cancel-form').click(hide_form);
-
- var tr_id;
- var id;
-
- // display the remove button on mouse over (and hide them per default)
- $('.balance tr').hover(function()
- {
- tr_id = $(this).attr('id');
- var index = tr_id.lastIndexOf("-");
- id = tr_id.substring(index+1);
- var action = $(this).attr('action');
-
- var x = $(this).offset().left;
- var y = $(this).offset().top;
- var width = $(this).width();
- var height = $(this).height();
-
- $('#overlay').css({ "left":x+"px", "top":y+"px", "width":width+"px", "height":height+"px", "line-height":height+"px" }).show();
-
- if(!$(this).hasClass("confirm"))
- {
- $('#overlay').html("");
- if (action == 'delete')
- {
- $('#overlay-delete').css({ "left":(x+width/2-16)+"px", "top":(y+height/2-16)+"px" }).show();
- }
- else if (action == 'reactivate')
- {
- $('#overlay-reactivate').css({ "left":(x+width/2-16)+"px", "top":(y+height/2-16)+"px" }).show();
- }
- }
- else
- {
- var url = "{{ url_for('.remove_member', member_id=id) }}";
- url = url.substring(0, url.lastIndexOf('/'))+id+url.substring(url.lastIndexOf('/'));
- $('#overlay').html("<a href='"+url+"' >{{_("you sure?")}}</a>");
- }
- });
-
- // show confirm message before actually removing the member
- $('#overlay-delete').click(function ()
- {
- $('#'+tr_id).addClass("confirm");
- var url = "{{ url_for('.remove_member', member_id=id) }}";
- url = url.substring(0, url.lastIndexOf('/'))+id+url.substring(url.lastIndexOf('/'));
- $('#overlay').html("<a href='"+url+"' >{{_("you sure?")}}</a>");
+ // ask for confirmation before removing an user
+ $('.action').each(function(){
$(this).hide();
+ var link = $(this).find('a');
+ link.click(function(){
+ if ($(this).hasClass("confirm")){
+ return true;
+ }
+ $(this).html("{{_("you sure?")}}");
+ $(this).addClass("confirm");
+ return false;
+ });
});
- // re-create reactivation url from hover-ed item and call it
- $('#overlay-reactivate').click(function ()
- {
- var url = "{{ url_for('.reactivate', member_id=id) }}";
- url = url.substring(0, url.lastIndexOf('/'))+id+url.substring(url.lastIndexOf('/'));
- $(location).attr('href', url);
- });
-
- $('#overlay').hover(function()
- {
- }, function()
- {
- $('#overlay').hide();
- $('#overlay-delete').hide();
- $('#overlay-reactivate').hide();
+ // display the remove button on mouse over (and hide them per default)
+ $('.balance tr').hover(function(){
+ $(this).find('.action').show();
+ }, function(){
+ $(this).find('.action').hide();
});
$.datepicker.setDefaults({'dateFormat': 'yy-mm-dd'});
@@ -143,15 +98,17 @@
<td class="balance-value {% if balance[member.id] > 0 %}positive{% elif balance[member.id] < 0 %}negative{% endif %}">
{% if balance[member.id] > 0 %}+{% endif %}{{ balance[member.id] }}
</td>
+ {% if member.activated %}
+ <td class="action delete"> <a href="{{ url_for(".remove_member", member_id=member.id) }}">{{ _("delete") }}</a></td>
+ {% else %}
+ <td class="action reactivate"> <a href="{{ url_for(".reactivate", member_id=member.id) }}">{{ _("reactivate") }}</a></td>
+ {% endif %}
</tr>
{% endfor %}
</table>
</div>
</div>
- <div id="overlay"></div>
- <img id="overlay-delete" title="{{ _("delete") }}" src="{{ url_for("static", filename="delete.png") }}">
- <img id="overlay-reactivate" title="{{ _("reactivate") }}" src="{{ url_for("static", filename="refresh.png") }}">
{% endblock %}
{% block content %}
@@ -176,7 +133,7 @@
<td>{{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each()) }} {{ _("each") }})</td>
<td class="bill-actions">
<a class="edit" href="{{ url_for(".edit_bill", bill_id=bill.id) }}" title="{{ _("edit") }}">
- <img src="{{ url_for("static", filename="pen.png") }}" />
+ <img src="{{ url_for("static", filename="edit.png") }}" />
</a>
<a class="delete" href="{{ url_for(".delete_bill", bill_id=bill.id) }}" title="{{ _("delete") }}">
<img src="{{ url_for("static", filename="delete.png") }}" />
@@ -190,8 +147,6 @@
{% else %}
<p>{{ _("Nothing to list yet. You probably want to") }} <a id="empty-new-bill" href="{{ url_for(".add_bill") }}">{{ _("add a bill") }}</a> ?</p>
{% endif %}
-
-
</div>
<script>
$("#sidebar").height( window.innerHeight-40 );
diff --git a/budget/web.py b/budget/web.py
index 715a223..31c2ced 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -18,7 +18,7 @@ are directly handled in the forms module.
Basically, this blueprint takes care of the authentication and provides
some shortcuts to make your life better when coding (see `pull_project`
-and `add_project_id` for a quick overview
+and `add_project_id` for a quick overview)
"""
main = Blueprint("main", __name__)