diff --git a/cms/djangoapps/contentstore/views/assets.py b/cms/djangoapps/contentstore/views/assets.py index dd96cd213a..a1a8d93468 100644 --- a/cms/djangoapps/contentstore/views/assets.py +++ b/cms/djangoapps/contentstore/views/assets.py @@ -8,6 +8,7 @@ from django.contrib.auth.decorators import login_required from django.views.decorators.http import require_http_methods from django_future.csrf import ensure_csrf_cookie from django.views.decorators.http import require_POST +from django.conf import settings from edxmako.shortcuts import render_to_response from cache_toolbox.core import del_cached_content @@ -290,10 +291,12 @@ def _get_asset_json(display_name, date, location, thumbnail_location, locked): Helper method for formatting the asset information to send to client. """ asset_url = StaticContent.get_url_path_from_location(location) + external_url = settings.LMS_BASE + asset_url return { 'display_name': display_name, 'date_added': get_default_time_display(date), 'url': asset_url, + 'external_url': external_url, 'portable_url': StaticContent.get_static_path_from_location(location), 'thumbnail': StaticContent.get_url_path_from_location(thumbnail_location) if thumbnail_location is not None else None, 'locked': locked, diff --git a/cms/djangoapps/contentstore/views/tests/test_assets.py b/cms/djangoapps/contentstore/views/tests/test_assets.py index b4af6f9fb4..8d7b2a9008 100644 --- a/cms/djangoapps/contentstore/views/tests/test_assets.py +++ b/cms/djangoapps/contentstore/views/tests/test_assets.py @@ -18,6 +18,7 @@ from xmodule.contentstore.django import contentstore from xmodule.modulestore.django import modulestore from xmodule.modulestore.xml_importer import import_from_xml from xmodule.modulestore.django import loc_mapper +from django.test.utils import override_settings class AssetsTestCase(CourseTestCase): @@ -138,6 +139,7 @@ class AssetToJsonTestCase(AssetsTestCase): Unit test for transforming asset information into something we can send out to the client via JSON. """ + @override_settings(LMS_BASE="lms_base_url") def test_basic(self): upload_date = datetime(2013, 6, 1, 10, 30, tzinfo=UTC) @@ -149,6 +151,7 @@ class AssetToJsonTestCase(AssetsTestCase): self.assertEquals(output["display_name"], "my_file") self.assertEquals(output["date_added"], "Jun 01, 2013 at 10:30 UTC") self.assertEquals(output["url"], "/i4x/foo/bar/asset/my_file_name.jpg") + self.assertEquals(output["external_url"], "lms_base_url/i4x/foo/bar/asset/my_file_name.jpg") self.assertEquals(output["portable_url"], "/static/my_file_name.jpg") self.assertEquals(output["thumbnail"], "/i4x/foo/bar/asset/my_file_name_thumb.jpg") self.assertEquals(output["id"], output["url"]) diff --git a/cms/static/js/models/asset.js b/cms/static/js/models/asset.js index 91055fb09b..bcf2589a4d 100644 --- a/cms/static/js/models/asset.js +++ b/cms/static/js/models/asset.js @@ -8,6 +8,7 @@ define(["backbone"], function(Backbone) { thumbnail: "", date_added: "", url: "", + external_url: "", portable_url: "", locked: false } diff --git a/cms/static/js/views/asset.js b/cms/static/js/views/asset.js index b6fd8fc8a6..df577816d7 100644 --- a/cms/static/js/views/asset.js +++ b/cms/static/js/views/asset.js @@ -18,6 +18,7 @@ var AssetView = BaseView.extend({ thumbnail: this.model.get('thumbnail'), date_added: this.model.get('date_added'), url: this.model.get('url'), + external_url: this.model.get('external_url'), portable_url: this.model.get('portable_url'), uniqueId: uniqueId })); diff --git a/cms/static/sass/views/_assets.scss b/cms/static/sass/views/_assets.scss index 830254d02c..8b59634a33 100644 --- a/cms/static/sass/views/_assets.scss +++ b/cms/static/sass/views/_assets.scss @@ -304,7 +304,7 @@ @include transition(all $tmg-f2 ease-in-out 0s); @extend %t-copy-sub2; box-shadow: none; - border: none; + border: 1px solid transparent; background: none; width: 100%; color: $gray-l2; diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index 8b96881f70..96bbd31632 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -156,11 +156,19 @@ require(["domReady", "jquery", "js/models/asset", "js/collections/asset",
${_("In addition to the files you upload on this page, any files that you add to the course appear in this list. These files include your course image, textbook chapters, and files that appear on your Course Handouts sidebar.")}