diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 2a2c38668f..26ed3c53d2 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -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 diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 36253b8691..c73eaead44 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -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(); } diff --git a/cms/static/sass/_assets.scss b/cms/static/sass/_assets.scss index 82df497c9b..136b03280d 100644 --- a/cms/static/sass/_assets.scss +++ b/cms/static/sass/_assets.scss @@ -86,6 +86,9 @@ } } } + .show-xml { + @include blue-button; + } } .upload-modal { diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index ae2958ecac..5940767c86 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -30,12 +30,13 @@