Commit 65e3982f by Lyla Fischer Committed by Calen Pennington

things now upload

parent 6a7fb1d5
......@@ -772,23 +772,52 @@ def remove_user(request, location):
return create_json_response()
@login_required
@ensure_csrf_cookie
def asset_index(request, location):
return render_to_response('asset_index.html',{})
# points to the temporary course landing page with log in and sign up
def landing(request, org, course, coursename):
return render_to_response('temp-course-landing.html', {})
def static_pages(request, org, course, coursename):
return render_to_response('static-pages.html', {})
def edit_static(request, org, course, coursename):
return render_to_response('edit-static-page.html', {})
def not_found(request):
return render_to_response('error.html', {'error': '404'})
def server_error(request):
return render_to_response('error.html', {'error': '500'})
\ No newline at end of file
return render_to_response('error.html', {'error': '500'})
@login_required
@ensure_csrf_cookie
def asset_index(request, org, course, name):
"""
Display an editable asset library
org, course, name: Attributes of the Location for the item to edit
"""
location = ['i4x', org, course, 'course', name]
# check that logged in user has permissions to this item
if not has_access(request.user, location):
raise PermissionDenied()
upload_asset_callback_url = reverse('upload_asset', kwargs = {
'org' : org,
'course' : course,
'coursename' : name
})
course = modulestore().get_item(location)
sections = course.get_children()
return render_to_response('asset_index.html', {
'sections': sections,
'upload_asset_callback_url': upload_asset_callback_url
})
......@@ -233,12 +233,28 @@ function showFileSelectionMenu(e) {
function startUpload(e) {
$('.upload-modal h1').html('Uploading…');
$('.upload-modal .file-name').html($('.file-input').val());
var bar = $('.progress-fill');
var percent = $('.percent');
$('.upload-modal .file-chooser').ajaxSubmit({
beforeSend: function() {
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function(xhr) {
markAsLoaded();
}
});
$('.upload-modal .choose-file-button').hide();
$('.upload-modal .progress-bar').removeClass('loaded').show();
$('.upload-modal .progress-fill').html('').css('width', '0').animate({
'width': '100%'
}, 1500);
setTimeout(markAsLoaded, 1500);
}
function markAsLoaded() {
......
......@@ -9,7 +9,8 @@
<div class="inner-wrapper">
<h1>Asset Library</h1>
<div class="page-actions">
<a href="#" class="upload-button">Upload New File</a><input type="text" class="asset-search-input search wip-box" placeholder="search assets" />
<a href="#" class="upload-button">Upload New File</a>
<input type="text" class="asset-search-input search wip-box" placeholder="search assets" />
</div>
<article class="asset-library">
<table>
......@@ -187,14 +188,17 @@
<div class="progress-bar">
<div class="progress-fill"></div>
</div>
<div class="percent">0%</div>
<div class="status"></div>
<a href="#" class="copy-button">Copy Embed Link</a>
<div class="file-chooser">
<form class="file-chooser" action="${upload_asset_callback_url}" method="post" enctype="multipart/form-data">
<a href="#" class="choose-file-button">Choose File</a>
<input type="file" class="file-input">
</div>
<input type="file" class="file-input" name="file">
</form>
</div>
</div>
<div class="modal-cover"></div>
</%block>
......@@ -33,6 +33,7 @@
<script src="${static.url('js/vendor/jquery.cookie.js')}"></script>
<script src="${static.url('js/vendor/jquery.leanModal.min.js')}"></script>
<script src="${static.url('js/vendor/jquery.tablednd.js')}"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script type="text/javascript">
document.write('\x3Cscript type="text/javascript" src="' +
document.location.protocol + '//www.youtube.com/player_api">\x3C/script>');
......
......@@ -38,8 +38,9 @@ urlpatterns = ('',
url(r'^landing/(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<coursename>[^/]+)$', 'contentstore.views.landing', name='landing'),
url(r'^not_found$', 'contentstore.views.not_found', name='not_found'),
url(r'^server_error$', 'contentstore.views.server_error', name='server_error')
url(r'^server_error$', 'contentstore.views.server_error', name='server_error'),
url(r'^(?P<org>[^/]+)/(?P<course>[^/]+)/assets/(?P<name>[^/]+)$', 'contentstore.views.asset_index', name='asset_index'),
)
# User creation and updating views
......
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 to comment