Commit ff6b5c36 by Dányi Bence

store: upload gui

parent e561056e
......@@ -30,5 +30,6 @@ urlpatterns = patterns('',
url(r'^ajax/templateWizard$', 'one.views.ajax_template_wizard', name='ajax_template_wizard'),
url(r'^ajax/store/list$', 'store.views.ajax_listfolder', name='store_ajax_listfolder'),
url(r'^ajax/store/download$', 'store.views.ajax_download', name='store_ajax_download'),
url(r'^ajax/store/upload$', 'store.views.ajax_upload', name='store_ajax_upload'),
url(r'^ajax/store/delete$', 'store.views.ajax_delete', name='store_ajax_delete'),
)
......@@ -193,6 +193,20 @@ $(function() {
}
})
}
self.uploadURL=ko.observable('/');
self.getUploadURL=function(){
console.log('sad')
$.ajax({
type: 'POST',
data: 'ul='+self.currentPath(),
url: '/ajax/store/upload',
dataType: 'json',
success: function(data){
console.log('asdasd', data);
self.uploadURL(data.url);
}
}).error(function(){ console.log('asd', arguments)})
}
loadFolder(self.currentPath());
}
var model = new Model();
......@@ -213,6 +227,8 @@ $(function() {
console.log(e);
e.stopPropagation();
e.preventDefault();
console.log(e.dataTransfer.files)
return false;
});
})
......@@ -106,6 +106,17 @@ def ajax_download(request):
return HttpResponse('File not found!', status_code=404)
@login_required
def ajax_upload(request):
user = request.user.username
try:
ul = request.POST['ul']
url = StoreApi.requestupload(user,ul)
return HttpResponse(json.dumps({'url':url}))
except:
pass
return HttpResponse('Error!', status_code=404)
@login_required
def ajax_delete(request):
user = request.user.username
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment