add some help for upload

This commit is contained in:
Sanj 2011-06-01 18:26:18 +05:30
parent 0d8167b709
commit f4435fdfd6
2 changed files with 19 additions and 1 deletions

View File

@ -45,7 +45,7 @@ def add_category(request):
c = Category() c = Category()
c.name = category_name c.name = category_name
c.save() c.save()
return render_to_json_response({'category_id': c.id}) return render_to_json_response({'category_id': c.id, 'category_name': c.name})
class FolderSelect(forms.widgets.Select): class FolderSelect(forms.widgets.Select):
def _get_choices(self): def _get_choices(self):

View File

@ -19,9 +19,11 @@ $(function() {
}; };
$.getJSON("/files/add_category", params, function(response) { $.getJSON("/files/add_category", params, function(response) {
var category_id = response.category_id; var category_id = response.category_id;
var category_name = response.category_name;
$('#files_category').val(category_id); $('#files_category').val(category_id);
$('#categoryWrapper').hide(); $('#categoryWrapper').hide();
$('#addFilesWrapper').show(); $('#addFilesWrapper').show();
$('#uploadStudy').text(category_name);
}); });
}); });
@ -82,6 +84,13 @@ $(function() {
background-color: #005740; background-color: #005740;
} }
#uploadStudy {
font-weight: bold;
}
#uploadingTo {
margin-bottom: 12px;
}
</style> </style>
{% endblock %} {% endblock %}
@ -90,6 +99,9 @@ $(function() {
{% block body %} {% block body %}
<div> <div>
<div id="categoryWrapper"> <div id="categoryWrapper">
<div id="categoryHelp">
First, either pick an existing Study to add your files to, or put in a name of a new study to create to add files to, and click the submit button:
</div>
<form id="categoryForm" action="" method="POST"> <form id="categoryForm" action="" method="POST">
{{ categoryForm.as_p }} {{ categoryForm.as_p }}
<input id="categorySubmit" value="Submit" type="submit" /> <input id="categorySubmit" value="Submit" type="submit" />
@ -97,6 +109,12 @@ $(function() {
</div> </div>
<div id="addFilesWrapper"> <div id="addFilesWrapper">
<div id="uploadingTo">
Uploading To: <span id="uploadStudy"></span>
</div>
<div id="uploadInstructions">
Either select multiple files, or just drag any number of files from your computer to the browser to upload. Enjoy.
</div>
<form id="addFile" action="/files/add" method="POST" enctype="multipart/form-data"> <form id="addFile" action="/files/add" method="POST" enctype="multipart/form-data">
<input id="files_category" name="files_category" type="hidden" /> <input id="files_category" name="files_category" type="hidden" />
<input id="file" name="file" type="file" multiple="multiple" value="Select Files.." /> <input id="file" name="file" type="file" multiple="multiple" value="Select Files.." />