added embeddable links
This commit is contained in:
committed by
Calen Pennington
parent
0bd5446f80
commit
f06c67ef08
@@ -698,8 +698,9 @@ def upload_asset(request, org, course, coursename):
|
||||
# timestamp populated, but we might as well wait for the first real request to come in
|
||||
# to re-populate the cache.
|
||||
del_cached_content(content.location)
|
||||
|
||||
return HttpResponse('Upload completed')
|
||||
response = HttpResponse('Upload completed')
|
||||
response['asset_url'] = StaticContent.get_url_path_from_location(file_location)
|
||||
return response
|
||||
|
||||
'''
|
||||
This view will return all CMS users who are editors for the specified course
|
||||
|
||||
@@ -23,6 +23,10 @@ $(document).ready(function() {
|
||||
$modalCover.bind('click', hideHistoryModal);
|
||||
$('.assets .upload-button').bind('click', showUploadModal);
|
||||
$('.upload-modal .close-button').bind('click', hideModal);
|
||||
|
||||
$('a.show-xml').toggle(showEmbeddableXML, hideEmbeddableXML);
|
||||
|
||||
$('a.copy-button').toggle(showEmbeddableXML, hideEmbeddableXML);
|
||||
$('.unit .item-actions .delete-button').bind('click', deleteUnit);
|
||||
$('.new-unit-item').bind('click', createNewUnit);
|
||||
$('.save-subsection').bind('click', saveSubsection);
|
||||
@@ -72,6 +76,17 @@ function removePolicyMetadata(e) {
|
||||
_parent_el.remove();
|
||||
else
|
||||
_parent_el.appendTo("#policy-to-delete");
|
||||
|
||||
function showEmbeddableXML(e) {
|
||||
$ceiling = $(this).parents('tr');
|
||||
if ($ceiling.length === 0) $ceiling = $(this).parents('.upload-modal');
|
||||
$ceiling.find('.embeddable-xml').html('<img src="'+$(this).attr('href')+'"/>');
|
||||
}
|
||||
function hideEmbeddableXML(e) {
|
||||
$ceiling = $(this).parents('tr');
|
||||
console.log($ceiling.length)
|
||||
if ($ceiling.length === 0) $ceiling = $(this).parents('.upload-modal');
|
||||
$ceiling.find('.embeddable-xml').html("");
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +273,7 @@ function displayFinishedUpload(xhr) {
|
||||
if(xhr.status = 200){
|
||||
markAsLoaded();
|
||||
}
|
||||
$('.upload-modal .copy-button').attr('href', xhr.getResponseHeader('asset_url'));
|
||||
$('.upload-modal .progress-fill').html(xhr.responseText);
|
||||
$('.upload-modal .choose-file-button').html('Load Another File').show();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.show-xml {
|
||||
@include blue-button;
|
||||
}
|
||||
}
|
||||
|
||||
.upload-modal {
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
</td>
|
||||
<td class="name-col">
|
||||
<a href="${asset['url']}" class="filename">${asset['displayname']}</a>
|
||||
<div class="embeddable-xml"></div>
|
||||
</td>
|
||||
<td class="date-col">
|
||||
${asset['uploadDate']}
|
||||
</td>
|
||||
<td class="embed-col">
|
||||
<a href="${asset['url']}">copy</a>
|
||||
<a class="show-xml" href="${asset['url']}">XML</a>
|
||||
</td>
|
||||
</tr>
|
||||
% endfor
|
||||
@@ -64,8 +65,10 @@
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill"></div>
|
||||
</div>
|
||||
<a href="#" class="copy-button">Copy Embed Link</a>
|
||||
<form class="file-chooser" action="${upload_asset_callback_url}" method="post" enctype="multipart/form-data">
|
||||
<div class="embeddable-xml"></div>
|
||||
<a href="#" class="copy-button">Show Embeddable XML</a>
|
||||
<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" name="file">
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user