From 4c81468126e6c655b6d4c7ab45a7af2ecce8ab25 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 28 Feb 2019 17:37:17 +0100 Subject: [PATCH 01/26] modals --- src/webapp/admin/views/AdminViews.py | 7 ++- src/webapp/static/admin/js/categories.js | 47 ++++++++++++++++++- src/webapp/static/admin/js/users.js | 2 +- src/webapp/templates/admin/pages/users.html | 1 + .../templates/admin/pages/users_modals.html | 44 ++++++++++++++++- 5 files changed, 97 insertions(+), 4 deletions(-) diff --git a/src/webapp/admin/views/AdminViews.py b/src/webapp/admin/views/AdminViews.py index c44054f09..5e2f4fcf1 100644 --- a/src/webapp/admin/views/AdminViews.py +++ b/src/webapp/admin/views/AdminViews.py @@ -69,9 +69,14 @@ def admin_table_post(table): data=request.get_json(force=True) if 'pluck' not in data.keys(): data['pluck']=False + if 'kind' not in data.keys(): + data['kind']=False + # ~ else: + # ~ if data['kind']='not_desktops': + # ~ result=app.adminapi.get_admin_table_term(table,'name',data['term'],pluck=data['pluck'],kind=) #~ if 'order' not in data.keys(): #~ data['order']=False - result=app.adminapi.get_admin_table_term(table,'name',data['term'],pluck=data['pluck']) + result=app.adminapi.get_admin_table_term(table,'name',data['term'],pluck=data['pluck'],kind=data['kind']) return json.dumps(result), 200, {'ContentType':'application/json'} return json.dumps('Could not delete.'), 500, {'ContentType':'application/json'} diff --git a/src/webapp/static/admin/js/categories.js b/src/webapp/static/admin/js/categories.js index 2b721687b..1263e046d 100644 --- a/src/webapp/static/admin/js/categories.js +++ b/src/webapp/static/admin/js/categories.js @@ -24,7 +24,14 @@ $(document).ready(function() { "defaultContent": '' }, { "data": "name", className: "xe-name" }, - { "data": "description", className: "xe-description"} + { "data": "description", className: "xe-description"}, + { + "className": 'details-control', + "orderable": false, + "data": null, + "width": "10px", + "defaultContent": '' + } ] } ); @@ -53,6 +60,44 @@ $(document).ready(function() { }).modal('show'); $('#modalAddCategoryForm')[0].reset(); //~ setModalAddUser(); + + $('#modalAddCategoryForm #desktops').select2({ + minimumInputLength: 2, + multiple: true, + ajax: { + type: "POST", + url: '/admin/table/domains/post', + dataType: 'json', + contentType: "application/json", + delay: 250, + data: function (params) { + return JSON.stringify({ + term: params.term, + pluck: ['id','name'] + }); + }, + processResults: function (data) { + return { + results: $.map(data, function (item, i) { + return { + text: item.name, + id: item.id + } + }) + }; + } + }, + }); + + $("#modalAddCategoryForm #ephimeral-minutes").ionRangeSlider({ + type: "single", + min: 0, + max: 3600, + step:5, + grid: true, + disable: false + }).data("ionRangeSlider").update(); + }); $("#modalAddCategory #send").on('click', function(e){ diff --git a/src/webapp/static/admin/js/users.js b/src/webapp/static/admin/js/users.js index d5bfaf769..60350fff3 100644 --- a/src/webapp/static/admin/js/users.js +++ b/src/webapp/static/admin/js/users.js @@ -530,7 +530,7 @@ function renderUsersDetailPannel ( d ) { $("."+key+' option[value="local"]').prop("selected",true); }); - }); + }); } function populate_users_table(){ diff --git a/src/webapp/templates/admin/pages/users.html b/src/webapp/templates/admin/pages/users.html index 22b6d2c1a..bba4ee611 100644 --- a/src/webapp/templates/admin/pages/users.html +++ b/src/webapp/templates/admin/pages/users.html @@ -125,6 +125,7 @@

Categories

name description + diff --git a/src/webapp/templates/admin/pages/users_modals.html b/src/webapp/templates/admin/pages/users_modals.html index 19ca139cb..c6a06d92a 100644 --- a/src/webapp/templates/admin/pages/users_modals.html +++ b/src/webapp/templates/admin/pages/users_modals.html @@ -82,7 +82,7 @@