From 3c69ca53251a8622c18eb820cfef4126621b1624 Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 1 Jul 2011 22:40:00 +0530 Subject: [PATCH] edit file title / description on upload page --- edgware/files/views.py | 13 +++++++++---- edgware/static/js/files/browse.js | 2 +- edgware/static/js/upload/edgeUpload.js | 18 +++++++++++++----- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/edgware/files/views.py b/edgware/files/views.py index 221b708..12f00f8 100644 --- a/edgware/files/views.py +++ b/edgware/files/views.py @@ -148,14 +148,15 @@ def chunk(request, id): canEdit = True if form.is_valid() and canEdit: f = form.cleaned_data['chunk'] - response = { - 'resultUrl': '/files/' + str(item.id), - 'fileId': item.id - } if item.title: name = item.title else: name = f.name + response = { + 'resultUrl': '/files/' + str(item.id), + 'fileId': item.id, + 'title': name + } if not item.save_chunk(f.read(), name): response['result'] = 'failed' elif form.cleaned_data['done']: @@ -274,12 +275,16 @@ def fileList(request): paginator = Paginator(qset, RESULTS_PER_PAGE) try: results = paginator.page(page) + current_page = page except (EmptyPage, InvalidPage): results = paginator.page(paginator.num_pages) + current_page = paginator.num_pages + files = results.object_list d = {} d['noOfResults'] = qset.count() d['noOfPages'] = paginator.num_pages + d['currentPage'] = current_page # d['hasPrev'] = paginator.has_previous() # d['hasNext'] = paginator.has_next() d['files'] = [] diff --git a/edgware/static/js/files/browse.js b/edgware/static/js/files/browse.js index 6225e2b..6406bf1 100644 --- a/edgware/static/js/files/browse.js +++ b/edgware/static/js/files/browse.js @@ -18,7 +18,7 @@ $(function() { $('#fileList').empty(); $('#noOfPages').text(data.noOfPages); $('#noOfResults').text(data.noOfResults); - $('#currentPageNo').text($('#page_no').val()); + $('#currentPageNo').text(data.currentPage); for (var i=0; i').addClass("fileError").text(data.errors[0]).appendTo(jq); } else { var $formContainer = $('
').addClass("fileForm"); - var $titleInput = $('').attr("type", "text").addClass("fileTitle").appendTo($formContainer); +// console.log(data); + var $titleInput = $('').attr("type", "text").addClass("fileTitle").val(d.title); +// console.log($titleInput); + $titleInput.appendTo($formContainer); var $descInput = $('