Internal/External Studio file URLs
- Changed link URL of file name to use public/LMS url - Added toggle link to display all public URLs for instructor convenience
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -36,15 +36,21 @@ class AssetsTestCase(CourseTestCase):
|
||||
|
||||
|
||||
class BasicAssetsTestCase(AssetsTestCase):
|
||||
location = Location(['i4x', 'foo', 'bar', 'asset', 'my_file_name.jpg'])
|
||||
TEST_LMS_BASE = 'localhost:8000'
|
||||
|
||||
def test_basic(self):
|
||||
resp = self.client.get(self.url, HTTP_ACCEPT='text/html')
|
||||
self.assertEquals(resp.status_code, 200)
|
||||
|
||||
def test_static_url_generation(self):
|
||||
location = Location(['i4x', 'foo', 'bar', 'asset', 'my_file_name.jpg'])
|
||||
path = StaticContent.get_static_path_from_location(location)
|
||||
path = StaticContent.get_static_path_from_location(self.location)
|
||||
self.assertEquals(path, '/static/my_file_name.jpg')
|
||||
|
||||
def test_lms_url_generation(self):
|
||||
url = self.TEST_LMS_BASE + StaticContent.get_url_path_from_location(self.location)
|
||||
self.assertEquals(url, 'localhost:8000/i4x/foo/bar/asset/my_file_name.jpg')
|
||||
|
||||
def test_pdf_asset(self):
|
||||
module_store = modulestore('direct')
|
||||
_, course_items = import_from_xml(
|
||||
|
||||
@@ -8,6 +8,7 @@ define(["backbone"], function(Backbone) {
|
||||
thumbnail: "",
|
||||
date_added: "",
|
||||
url: "",
|
||||
external_url: "",
|
||||
portable_url: "",
|
||||
locked: false
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
<th class="thumb-col"><%= gettext("Preview") %></th>
|
||||
<th class="name-col sortable-column"><span class="column-sort-link" id="js-asset-name-col"><%= gettext("Name") %></span></th>
|
||||
<th class="date-col sortable-column"><span class="column-sort-link" id="js-asset-date-col"><%= gettext("Date Added") %></span></th>
|
||||
<th class="embed-col"><%= gettext("URL") %></th>
|
||||
<th class="embed-col"><%= gettext("Embed URL") %></th>
|
||||
<th class="embed-col"><%= gettext("External URL") %></th>
|
||||
<th class="actions-col"><span class="sr"><%= gettext("Actions") %></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<td class="embed-col">
|
||||
<input type="text" class="embeddable-xml-input" value="<%= portable_url %>" readonly>
|
||||
</td>
|
||||
<td class="embed-col">
|
||||
<input type="text" class="embeddable-xml-input" value="<%= external_url %>" readonly>
|
||||
</td>
|
||||
<td class="actions-col">
|
||||
<ul class="actions-list">
|
||||
<li class="action-item action-delete">
|
||||
@@ -27,4 +30,4 @@
|
||||
<div class="action-button"><i class="icon-lock"></i><i class="icon-unlock-alt"></i></div>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</td>
|
||||
Reference in New Issue
Block a user