BLD-933: Add table of contents.
This commit is contained in:
@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
|
||||
in roughly chronological order, most recent first. Add your entries at or near
|
||||
the top. Include a label indicating the component affected.
|
||||
|
||||
Blades: Add context-aware video index. BLD-933
|
||||
|
||||
Blades: Fix bug with incorrect link format and redirection. BLD-1049
|
||||
|
||||
Blades: Fix bug with incorrect RelativeTime value after XML serialization. BLD-1060
|
||||
|
||||
@@ -224,3 +224,18 @@ Feature: CMS Video Component Editor
|
||||
And I click button "Add"
|
||||
Then I cannot choose "zh" language code
|
||||
|
||||
# 18
|
||||
Scenario: User can see table of content at the first position
|
||||
Given I have created a Video component
|
||||
And I edit the component
|
||||
And I open tab "Advanced"
|
||||
And I upload transcript files:
|
||||
|lang_code|filename |
|
||||
|uk |uk_transcripts.srt |
|
||||
|table |chinese_transcripts.srt|
|
||||
And I save changes
|
||||
Then when I view the video it does show the captions
|
||||
And I see "好 各位同学" text in the captions
|
||||
And video language menu has "table, uk" translations
|
||||
And I see video language with code "table" at position "0"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import requests
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_true, assert_equal, assert_in, assert_not_equal # pylint: disable=E0611
|
||||
from nose.tools import assert_true, assert_equal, assert_in, assert_not_equal # pylint: disable=E0611
|
||||
from terrain.steps import reload_the_page
|
||||
from django.conf import settings
|
||||
from common import upload_file, attach_file
|
||||
@@ -18,6 +18,10 @@ LANGUAGES = {
|
||||
for lang, display in settings.ALL_LANGUAGES
|
||||
}
|
||||
|
||||
LANGUAGES.update({
|
||||
'table': 'Table of Contents'
|
||||
})
|
||||
|
||||
TRANSLATION_BUTTONS = {
|
||||
'add': '.metadata-video-translations .create-action',
|
||||
'upload': '.metadata-video-translations .upload-action',
|
||||
@@ -306,3 +310,11 @@ def i_see_correct_langs(_step, langs):
|
||||
for lang_code, label in translations.items():
|
||||
assert_true(any([i.text == label for i in items]))
|
||||
assert_true(any([i['data-lang-code'] == lang_code for i in items]))
|
||||
|
||||
|
||||
@step('video language with code "([^"]*)" at position "(\d+)"$')
|
||||
def i_see_lang_at_position(_step, code, position):
|
||||
menu_name = 'language'
|
||||
open_menu(menu_name)
|
||||
item = world.css_find(VIDEO_MENUS[menu_name] + ' li')[int(position)]
|
||||
assert_equal(item['data-lang-code'], code)
|
||||
|
||||
@@ -129,7 +129,11 @@ class VideoModule(VideoFields, VideoStudentViewHandlers, XModule):
|
||||
languages['en'] = 'English'
|
||||
|
||||
# OrderedDict for easy testing of rendered context in tests
|
||||
sorted_languages = OrderedDict(sorted(languages.items(), key=itemgetter(1)))
|
||||
sorted_languages = sorted(languages.items(), key=itemgetter(1))
|
||||
if 'table' in self.transcripts:
|
||||
sorted_languages.insert(0, ('table', 'Table of Contents'))
|
||||
|
||||
sorted_languages = OrderedDict(sorted_languages)
|
||||
|
||||
return self.system.render_template('video.html', {
|
||||
'ajax_url': self.system.ajax_url + '/save_user_state',
|
||||
@@ -254,6 +258,7 @@ class VideoDescriptor(VideoFields, VideoStudioViewHandlers, TabsEditingDescripto
|
||||
|
||||
languages = [{'label': label, 'code': lang} for lang, label in settings.ALL_LANGUAGES if lang != u'en']
|
||||
languages.sort(key=lambda l: l['label'])
|
||||
languages.insert(0, {'label': 'Table of Contents', 'code': 'table'})
|
||||
editable_fields['transcripts']['languages'] = languages
|
||||
editable_fields['transcripts']['type'] = 'VideoTranslations'
|
||||
editable_fields['transcripts']['urlRoot'] = self.runtime.handler_url(self, 'studio_transcript', 'translation').rstrip('/?')
|
||||
|
||||
Reference in New Issue
Block a user