Profile sorting
This commit is contained in:
1 parent
85c3b16e69
commit
6940477e48
5 files changed
+162
-15
No files matched your search
@@ -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')
|
||||
|
||||
Reference in new issue
Block a user