ECOM-4904 Move the program editor backbone app to Studio (#12962)

This commit is contained in:
Simon Chen
2016-07-19 19:09:51 -04:00
committed by GitHub
parent 7745e7cdf7
commit 1d768cde7a
65 changed files with 3283 additions and 108 deletions

View File

@@ -1,5 +1,4 @@
"""Models providing Programs support for the LMS and Studio."""
from collections import namedtuple
from urlparse import urljoin
from django.utils.translation import ugettext_lazy as _
@@ -8,9 +7,6 @@ from django.db import models
from config_models.models import ConfigurationModel
AuthoringAppConfig = namedtuple('AuthoringAppConfig', ['js_url', 'css_url'])
class ProgramsApiConfig(ConfigurationModel):
"""
Manages configuration for connecting to the Programs service and using its
@@ -25,6 +21,7 @@ class ProgramsApiConfig(ConfigurationModel):
internal_service_url = models.URLField(verbose_name=_("Internal Service URL"))
public_service_url = models.URLField(verbose_name=_("Public Service URL"))
# TODO: The property below is obsolete. Delete at the earliest safe moment. See ECOM-4995
authoring_app_js_path = models.CharField(
verbose_name=_("Path to authoring app's JS"),
max_length=255,
@@ -33,6 +30,8 @@ class ProgramsApiConfig(ConfigurationModel):
"This value is required in order to enable the Studio authoring interface."
)
)
# TODO: The property below is obsolete. Delete at the earliest safe moment. See ECOM-4995
authoring_app_css_path = models.CharField(
verbose_name=_("Path to authoring app's CSS"),
max_length=255,
@@ -103,17 +102,6 @@ class ProgramsApiConfig(ConfigurationModel):
"""
return urljoin(self.public_service_url, '/api/v{}/'.format(self.api_version_number))
@property
def authoring_app_config(self):
"""
Returns a named tuple containing information required for working with the Programs
authoring app, a Backbone app hosted by the Programs service.
"""
js_url = urljoin(self.public_service_url, self.authoring_app_js_path)
css_url = urljoin(self.public_service_url, self.authoring_app_css_path)
return AuthoringAppConfig(js_url=js_url, css_url=css_url)
@property
def is_cache_enabled(self):
"""Whether responses from the Programs API will be cached."""
@@ -133,12 +121,7 @@ class ProgramsApiConfig(ConfigurationModel):
Indicates whether Studio functionality related to Programs should
be enabled or not.
"""
return (
self.enabled and
self.enable_studio_tab and
bool(self.authoring_app_js_path) and
bool(self.authoring_app_css_path)
)
return self.enabled and self.enable_studio_tab
@property
def is_certification_enabled(self):