Profile sorting

This commit is contained in:
Ruud
2011-09-07 17:21:49 +02:00
parent 85c3b16e69
commit 6940477e48
5 changed files with 162 additions and 15 deletions
+20
View File
@@ -16,6 +16,7 @@ class ProfilePlugin(Plugin):
addEvent('profile.all', self.all)
addApiView('profile.save', self.save)
addApiView('profile.save_order', self.saveOrder)
addApiView('profile.delete', self.delete)
addEvent('app.initialize', self.fill)
@@ -70,6 +71,25 @@ class ProfilePlugin(Plugin):
'profile': profile_dict
})
def saveOrder(self):
params = getParams()
db = get_session()
order = 0
for profile in params.get('ids', []):
p = db.query(Profile).filter_by(id = profile).first()
p.hide = params.get('hidden')[order]
p.order = order
order += 1
db.commit()
return jsonified({
'success': True
})
def delete(self):
id = getParam('id')
@@ -45,6 +45,7 @@
.profile .types li {
padding: 3px 5px;
border-bottom: 1px solid rgba(255,255,255,0.2);
list-style: none;
}
.profile .types li:last-child { border: 0; }
@@ -85,4 +86,51 @@
.profile .types .type:hover:not(.is_empty) .delete {
visibility: visible;
}
}
#profile_ordering {
}
#profile_ordering .head {
float: left;
}
#profile_ordering .head span {
margin: 0 10px 0 -5px;
}
#profile_ordering ul {
clear: both;
float: left;
margin-left: 20%;
width: 275px;
}
#profile_ordering li {
clear: both;
overflow: hidden;
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
border-bottom: 1px solid rgba(255,255,255,0.2);
padding: 0 5px;
}
#profile_ordering li .check {
margin: 2px 10px 0 0;
vertical-align: top;
}
#profile_ordering li > span {
display: inline-block;
height: 20px;
vertical-align: top;
line-height: 20px;
}
#profile_ordering li .handle {
background: url('./handle.png') center;
width: 20px;
float: right;
}