diff --git a/cms/djangoapps/contentstore/features/transcripts.feature b/cms/djangoapps/contentstore/features/transcripts.feature index 66bb482ad5..00684ffd67 100644 --- a/cms/djangoapps/contentstore/features/transcripts.feature +++ b/cms/djangoapps/contentstore/features/transcripts.feature @@ -53,7 +53,7 @@ Feature: CMS Transcripts # first part of url will be substituted by mock_youtube_server address # for t__eq_exist id server will respond with transcripts And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" # t__eq_exist subs locally not presented at this moment And I see button "import" @@ -72,18 +72,18 @@ Feature: CMS Transcripts And I remove "t_not_exist" transcripts id from store And I enter a "http://youtu.be/t_not_exist" source to field number 1 Then I see status message "not found" - And I see value "" in the field "Transcript (primary)" + And I see value "" in the field "Default Timed Transcript" # Import: w/o local but with server subs And I remove "t__eq_exist" transcripts id from store And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I click transcript button "import" Then I see status message "found" And I see button "upload_new_timed_transcripts" And I see button "download_to_edit" - And I see value "t__eq_exist" in the field "Transcript (primary)" + And I see value "t__eq_exist" in the field "Default Timed Transcript" #4 Scenario: Youtube id only: check "Found" state @@ -92,7 +92,7 @@ Feature: CMS Transcripts And I enter a "http://youtu.be/t_not_exist" source to field number 1 Then I see status message "found" - And I see value "t_not_exist" in the field "Transcript (primary)" + And I see value "t_not_exist" in the field "Default Timed Transcript" #5 Scenario: Youtube id only: check "Found" state when user sets youtube_id with local and server subs and they are equal @@ -102,7 +102,7 @@ Feature: CMS Transcripts And I enter a "http://youtu.be/t__eq_exist" source to field number 1 And I see status message "found" - And I see value "t__eq_exist" in the field "Transcript (primary)" + And I see value "t__eq_exist" in the field "Default Timed Transcript" #6 Scenario: Youtube id only: check "Found" state when user sets youtube_id with local and server subs and they are not equal @@ -114,7 +114,7 @@ Feature: CMS Transcripts And I see button "replace" And I click transcript button "replace" And I see status message "found" - And I see value "t_neq_exist" in the field "Transcript (primary)" + And I see value "t_neq_exist" in the field "Default Timed Transcript" #7 Scenario: html5 source only: check "Not Found" state @@ -123,7 +123,7 @@ Feature: CMS Transcripts And I enter a "t_not_exist.mp4" source to field number 1 Then I see status message "not found" - And I see value "" in the field "Transcript (primary)" + And I see value "" in the field "Default Timed Transcript" #8 Scenario: html5 source only: check "Found" state @@ -132,7 +132,7 @@ Feature: CMS Transcripts And I enter a "t_not_exist.mp4" source to field number 1 Then I see status message "found" - And I see value "t_not_exist" in the field "Transcript (primary)" + And I see value "t_not_exist" in the field "Default Timed Transcript" #9 Scenario: User sets youtube_id w/o server but with local subs and one html5 link w/o subs @@ -144,7 +144,7 @@ Feature: CMS Transcripts And I enter a "test_video_name.mp4" source to field number 2 Then I see status message "found" - And I see value "t_not_exist" in the field "Transcript (primary)" + And I see value "t_not_exist" in the field "Default Timed Transcript" # Disabled 1/29/14 due to flakiness observed in master #10 @@ -153,14 +153,14 @@ Feature: CMS Transcripts # And I edit the component # # And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - # Then I see status message "not found" + # Then I see status message "not found on edx" # And I see button "import" # And I click transcript button "import" # Then I see status message "found" # # And I enter a "t_not_exist.mp4" source to field number 2 # Then I see status message "found" - # And I see value "t__eq_exist" in the field "Transcript (primary)" + # And I see value "t__eq_exist" in the field "Default Timed Transcript" #11 Scenario: User sets youtube_id w/o local but with server subs and one html5 link w/o transcripts w/o import action, then another one html5 link w/o transcripts @@ -168,17 +168,17 @@ Feature: CMS Transcripts And I edit the component And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" And I enter a "t_not_exist.webm" source to field number 3 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" @@ -205,7 +205,7 @@ Feature: CMS Transcripts And I edit the component And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I click transcript button "import" Then I see status message "found" @@ -247,17 +247,17 @@ Feature: CMS Transcripts And I edit the component And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" And I enter a "t_neq_exist.webm" source to field number 3 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" @@ -267,17 +267,17 @@ Feature: CMS Transcripts And I edit the component And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" And I enter a "t_neq_exist.mp4" source to field number 2 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" And I enter a "t_not_exist.webm" source to field number 3 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I see button "upload_new_timed_transcripts" @@ -287,7 +287,7 @@ Feature: CMS Transcripts And I edit the component And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I click transcript button "import" Then I see status message "found" @@ -309,7 +309,7 @@ Feature: CMS Transcripts And I edit the component And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found" + Then I see status message "not found on edx" And I see button "import" And I click transcript button "import" Then I see status message "found" @@ -338,7 +338,7 @@ Feature: CMS Transcripts Then I see status message "uploaded_successfully" And I see button "download_to_edit" And I see button "upload_new_timed_transcripts" - And I see value "t__eq_exist" in the field "Transcript (primary)" + And I see value "t__eq_exist" in the field "Default Timed Transcript" And I enter a "http://youtu.be/t_not_exist" source to field number 2 Then I see status message "found" @@ -359,7 +359,7 @@ Feature: CMS Transcripts And I see button "upload_new_timed_transcripts" And I upload the transcripts file "uk_transcripts.srt" Then I see status message "uploaded_successfully" - And I see value "uk_transcripts" in the field "Transcript (primary)" + And I see value "uk_transcripts" in the field "Default Timed Transcript" And I enter a "t_not_exist.webm" source to field number 2 Then I see status message "replace" @@ -367,7 +367,7 @@ Feature: CMS Transcripts And I see choose button "uk_transcripts.mp4" number 1 And I see choose button "t_not_exist.webm" number 2 And I click transcript button "choose" number 2 - And I see value "uk_transcripts|t_not_exist" in the field "Transcript (primary)" + And I see value "uk_transcripts|t_not_exist" in the field "Default Timed Transcript" # Flaky test fails occasionally in master. https://edx-wiki.atlassian.net/browse/BLD-927 #21 @@ -379,7 +379,7 @@ Feature: CMS Transcripts # Then I see status message "found" # And I see button "download_to_edit" # And I see button "upload_new_timed_transcripts" - # And I see value "t_not_exist" in the field "Transcript (primary)" + # And I see value "t_not_exist" in the field "Default Timed Transcript" # # And I save changes # And I edit the component @@ -388,13 +388,13 @@ Feature: CMS Transcripts # Then I see status message "use existing" # And I see button "use_existing" # And I click transcript button "use_existing" - # And I see value "video_name_2" in the field "Transcript (primary)" + # And I see value "video_name_2" in the field "Default Timed Transcript" # # And I enter a "video_name_3.mp4" source to field number 1 # Then I see status message "use existing" # And I see button "use_existing" # And I click transcript button "use_existing" - # And I see value "video_name_3" in the field "Transcript (primary)" + # And I see value "video_name_3" in the field "Default Timed Transcript" #22 Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save -> change it to another one HTML5 source w/o transcripts - click on use existing -> change it to another one HTML5 source w/o transcripts - do not click on use existing -> change it to another one HTML5 source w/o transcripts - click on use existing @@ -405,7 +405,7 @@ Feature: CMS Transcripts Then I see status message "found" And I see button "download_to_edit" And I see button "upload_new_timed_transcripts" - And I see value "t_not_exist" in the field "Transcript (primary)" + And I see value "t_not_exist" in the field "Default Timed Transcript" And I save changes And I edit the component @@ -414,7 +414,7 @@ Feature: CMS Transcripts Then I see status message "use existing" And I see button "use_existing" And I click transcript button "use_existing" - And I see value "video_name_2" in the field "Transcript (primary)" + And I see value "video_name_2" in the field "Default Timed Transcript" And I enter a "video_name_3.mp4" source to field number 1 Then I see status message "use existing" @@ -424,7 +424,7 @@ Feature: CMS Transcripts Then I see status message "use existing" And I see button "use_existing" And I click transcript button "use_existing" - And I see value "video_name_4" in the field "Transcript (primary)" + And I see value "video_name_4" in the field "Default Timed Transcript" #23 Scenario: Work with 2 fields: Enter HTML5 source with transcripts - save -> change it to another one HTML5 source w/o transcripts - do not click on use existing -> add another one HTML5 source w/o transcripts - click on use existing @@ -447,7 +447,7 @@ Feature: CMS Transcripts Then I see status message "use existing" And I see button "use_existing" And I click transcript button "use_existing" - And I see value "video_name_2|video_name_3" in the field "Transcript (primary)" + And I see value "video_name_2|video_name_3" in the field "Default Timed Transcript" #24 Uploading subtitles with different file name than file Scenario: File name and name of subs are different @@ -458,7 +458,7 @@ Feature: CMS Transcripts And I see status message "not found" And I upload the transcripts file "uk_transcripts.srt" Then I see status message "uploaded_successfully" - And I see value "video_name_1" in the field "Transcript (primary)" + And I see value "video_name_1" in the field "Default Timed Transcript" And I save changes Then when I view the video it does show the captions @@ -489,11 +489,11 @@ Feature: CMS Transcripts And I see status message "not found" And I upload the transcripts file "uk_transcripts.srt" Then I see status message "uploaded_successfully" - And I see value "video_name_1|video_name_2" in the field "Transcript (primary)" + And I see value "video_name_1|video_name_2" in the field "Default Timed Transcript" And I clear field number 1 Then I see status message "found" - And I see value "video_name_2" in the field "Transcript (primary)" + And I see value "video_name_2" in the field "Default Timed Transcript" #27 Scenario: Upload button for single youtube id @@ -529,7 +529,7 @@ Feature: CMS Transcripts Then I see status message "uploaded_successfully" And I clear field number 1 Then I see status message "found" - And I see value "video_name_1" in the field "Transcript (primary)" + And I see value "video_name_1" in the field "Default Timed Transcript" And I save changes Then when I view the video it does show the captions @@ -545,14 +545,14 @@ Feature: CMS Transcripts Then I see status message "not found" And I open tab "Advanced" - And I set value "t_not_exist" to the field "Transcript (primary)" + And I set value "t_not_exist" to the field "Default Timed Transcript" And I save changes Then when I view the video it does show the captions And I edit the component Then I see status message "found" - And I see value "video_name_1" in the field "Transcript (primary)" + And I see value "video_name_1" in the field "Default Timed Transcript" #30 Scenario: Check non-ascii (chinise) transcripts @@ -577,7 +577,7 @@ Feature: CMS Transcripts Then I see status message "not found" And I open tab "Advanced" - And I set value "t_not_exist" to the field "Transcript (primary)" + And I set value "t_not_exist" to the field "Default Timed Transcript" And I open tab "Basic" Then I see status message "found" @@ -586,7 +586,7 @@ Feature: CMS Transcripts And I edit the component Then I see status message "found" - And I see value "video_name_1" in the field "Transcript (primary)" + And I see value "video_name_1" in the field "Default Timed Transcript" #32 Scenario: After clearing Transcripts field in the Advanced tab "not found" message should be visible w/o saving @@ -599,7 +599,7 @@ Feature: CMS Transcripts Then I see status message "uploaded_successfully" And I open tab "Advanced" - And I set value "" to the field "Transcript (primary)" + And I set value "" to the field "Default Timed Transcript" And I open tab "Basic" Then I see status message "not found" @@ -608,7 +608,7 @@ Feature: CMS Transcripts And I edit the component Then I see status message "not found" - And I see value "" in the field "Transcript (primary)" + And I see value "" in the field "Default Timed Transcript" #33 Scenario: After clearing Transcripts field in the Advanced tab "not found" message should be visible with saving @@ -625,7 +625,7 @@ Feature: CMS Transcripts And I edit the component And I open tab "Advanced" - And I set value "" to the field "Transcript (primary)" + And I set value "" to the field "Default Timed Transcript" And I open tab "Basic" Then I see status message "not found" @@ -634,7 +634,7 @@ Feature: CMS Transcripts And I edit the component Then I see status message "not found" - And I see value "" in the field "Transcript (primary)" + And I see value "" in the field "Default Timed Transcript" #34 Scenario: Video with existing subs - Advanced tab - change to another one subs - Basic tab - Found message - Save - see correct subs @@ -653,7 +653,7 @@ Feature: CMS Transcripts And I edit the component And I open tab "Advanced" - And I set value "t_not_exist" to the field "Transcript (primary)" + And I set value "t_not_exist" to the field "Default Timed Transcript" And I open tab "Basic" Then I see status message "found" @@ -676,7 +676,7 @@ Feature: CMS Transcripts And I edit the component And I open tab "Advanced" - And I revert the transcript field "Transcript (primary)" + And I revert the transcript field "Default Timed Transcript" And I save changes Then when I view the video it does not show the captions @@ -692,7 +692,7 @@ Feature: CMS Transcripts And I see status message "not found" And I upload the transcripts file "uk_transcripts.srt" Then I see status message "uploaded_successfully" - And I see value "video_name_1.1.2" in the field "Transcript (primary)" + And I see value "video_name_1.1.2" in the field "Default Timed Transcript" And I save changes Then when I view the video it does show the captions diff --git a/cms/djangoapps/contentstore/features/transcripts.py b/cms/djangoapps/contentstore/features/transcripts.py index 8ba53a7e6f..4e70912c3d 100644 --- a/cms/djangoapps/contentstore/features/transcripts.py +++ b/cms/djangoapps/contentstore/features/transcripts.py @@ -17,12 +17,13 @@ TEST_ROOT = settings.COMMON_TEST_DATA_ROOT DELAY = 0.5 ERROR_MESSAGES = { - 'url_format': u'Incorrect URL format.', - 'file_type': u'Video file types must be unique.', + 'url_format': u'Incorrect url format.', + 'file_type': u'Link types should be unique.', } STATUSES = { 'found': u'Timed Transcript Found', + 'not found on edx': u'No EdX Timed Transcript', 'not found': u'No Timed Transcript', 'replace': u'Timed Transcript Conflict', 'uploaded_successfully': u'Timed Transcript Uploaded Successfully', @@ -39,13 +40,13 @@ SELECTORS = { # button type , button css selector, button message TRANSCRIPTS_BUTTONS = { - 'import': ('.setting-import', 'Import YouTube Transcript'), + 'import': ('.setting-import', 'Import YouTube Transcript'), 'download_to_edit': ('.setting-download', 'Download Transcript for Editing'), 'disabled_download_to_edit': ('.setting-download.is-disabled', 'Download Transcript for Editing'), - 'upload_new_timed_transcripts': ('.setting-upload', 'Upload New Timed Transcript'), + 'upload_new_timed_transcripts': ('.setting-upload', 'Upload New Transcript'), 'replace': ('.setting-replace', 'Yes, replace the edX transcript with the YouTube transcript'), 'choose': ('.setting-choose', 'Timed Transcript from {}'), - 'use_existing': ('.setting-use-existing', 'Use Existing Timed Transcript'), + 'use_existing': ('.setting-use-existing', 'Use Current Transcript'), } @@ -209,7 +210,8 @@ def check_text_in_the_captions(_step, text): @step('I see value "([^"]*)" in the field "([^"]*)"$') def check_transcripts_field(_step, values, field_name): world.select_editor_tab('Advanced') - field_id = '#' + world.browser.find_by_xpath('//label[text()="%s"]' % field_name.strip())[0]['for'] + tab = world.css_find('#settings-tab').first; + field_id = '#' + tab.find_by_xpath('.//label[text()="%s"]' % field_name.strip())[0]['for'] values_list = [i.strip() == world.css_value(field_id) for i in values.split('|')] assert any(values_list) world.select_editor_tab('Basic') @@ -227,8 +229,9 @@ def open_tab(_step, tab_name): @step('I set value "([^"]*)" to the field "([^"]*)"$') def set_value_transcripts_field(_step, value, field_name): - XPATH = '//label[text()="{name}"]'.format(name=field_name) - SELECTOR = '#' + world.browser.find_by_xpath(XPATH)[0]['for'] + tab = world.css_find('#settings-tab').first; + XPATH = './/label[text()="{name}"]'.format(name=field_name) + SELECTOR = '#' + tab.find_by_xpath(XPATH)[0]['for'] element = world.css_find(SELECTOR).first if element['type'] == 'text': SCRIPT = '$("{selector}").val("{value}").change()'.format( diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index e465dc6b5b..6179a33eb1 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -72,8 +72,8 @@ Feature: CMS Video Component And Make sure captions are closed And I edit the component And I open tab "Advanced" - And I set value "00:00:12" to the field "Start Time" - And I set value "00:00:24" to the field "End Time" + And I set value "00:00:12" to the field "Video Start Time" + And I set value "00:00:24" to the field "Video Stop Time" And I save changes And I click video button "play" Then I see a range on slider @@ -85,8 +85,8 @@ Feature: CMS Video Component # And Make sure captions are closed # And I edit the component # And I open tab "Advanced" - # And I set value "00:00:12" to the field "Start Time" - # And I set value "00:00:24" to the field "End Time" + # And I set value "00:00:12" to the field "Video Start Time" + # And I set value "00:00:24" to the field "Video Stop Time" # And I save changes # And I click video button "play" # Then I see a range on slider @@ -103,8 +103,8 @@ Feature: CMS Video Component # And Make sure captions are closed # And I edit the component # And I open tab "Advanced" -# And I set value "00:00:12" to the field "Start Time" -# And I set value "00:00:24" to the field "End Time" +# And I set value "00:00:12" to the field "Video Start Time" +# And I set value "00:00:24" to the field "Video Stop Time" # And I save changes # And I click video button "play" # Then I see a range on slider @@ -121,8 +121,8 @@ Feature: CMS Video Component # And Make sure captions are closed # And I edit the component # And I open tab "Advanced" -# And I set value "00:00:12" to the field "Start Time" -# And I set value "00:00:24" to the field "End Time" +# And I set value "00:00:12" to the field "Video Start Time" +# And I set value "00:00:24" to the field "Video Stop Time" # And I save changes # And I click video button "play" # Then I see a range on slider diff --git a/cms/djangoapps/contentstore/features/video_editor.feature b/cms/djangoapps/contentstore/features/video_editor.feature index 872ace45e8..e2f419d01a 100644 --- a/cms/djangoapps/contentstore/features/video_editor.feature +++ b/cms/djangoapps/contentstore/features/video_editor.feature @@ -15,7 +15,7 @@ Feature: CMS Video Component Editor Given I have created a Video component And I edit the component And I open tab "Advanced" - Then I can modify the display name + Then I can modify video display name And my video display name change is persisted on save # 3 diff --git a/cms/djangoapps/contentstore/features/video_editor.py b/cms/djangoapps/contentstore/features/video_editor.py index 31f41b6ae8..8e82f974b1 100644 --- a/cms/djangoapps/contentstore/features/video_editor.py +++ b/cms/djangoapps/contentstore/features/video_editor.py @@ -11,6 +11,7 @@ from common import upload_file, attach_file TEST_ROOT = settings.COMMON_TEST_DATA_ROOT +DISPLAY_NAME = "Component Display Name" NATIVE_LANGUAGES = {lang: label for lang, label in settings.LANGUAGES if len(lang) == 2} LANGUAGES = { lang: NATIVE_LANGUAGES.get(lang, display) @@ -76,7 +77,7 @@ def success_upload_file(filename): def get_translations_container(): - return world.browser.find_by_xpath('//label[text()="Transcript Translations"]/following-sibling::div') + return world.browser.find_by_xpath('//label[text()="Transcript Languages"]/following-sibling::div') def get_setting_container(lang_code): @@ -114,7 +115,7 @@ def set_show_captions(step, setting): world.edit_component() world.select_editor_tab('Advanced') - world.browser.select('Transcript Display', setting) + world.browser.select('Show Transcript', setting) world.save_component() @@ -136,25 +137,25 @@ def shows_captions(_step, show_captions): def correct_video_settings(_step): expected_entries = [ # basic - ['Display Name', 'Video', False], - ['Video URL', 'http://youtu.be/OEoXaMPEzfM, , ', False], + [DISPLAY_NAME, 'Video', False], + ['Default Video URL', 'http://youtu.be/OEoXaMPEzfM, , ', False], # advanced - ['Display Name', 'Video', False], - ['Download Transcript', '', False], - ['End Time', '00:00:00', False], - ['Start Time', '00:00:00', False], - ['Transcript (primary)', '', False], - ['Transcript Display', 'True', False], - ['Transcript Download Allowed', 'False', False], - ['Transcript Translations', '', False], + [DISPLAY_NAME, 'Video', False], + ['Default Timed Transcript', '', False], + ['Download Transcript Allowed', 'False', False], + ['Downloadable Transcript URL', '', False], + ['Show Transcript', 'True', False], + ['Transcript Languages', '', False], ['Upload Handout', '', False], ['Video Download Allowed', 'False', False], - ['Video Sources', '', False], - ['Youtube ID', 'OEoXaMPEzfM', False], - ['Youtube ID for .75x speed', '', False], - ['Youtube ID for 1.25x speed', '', False], - ['Youtube ID for 1.5x speed', '', False] + ['Video File URLs', '', False], + ['Video Start Time', '00:00:00', False], + ['Video Stop Time', '00:00:00', False], + ['YouTube ID', 'OEoXaMPEzfM', False], + ['YouTube ID for .75x speed', '', False], + ['YouTube ID for 1.25x speed', '', False], + ['YouTube ID for 1.5x speed', '', False] ] world.verify_all_setting_entries(expected_entries) @@ -167,11 +168,18 @@ def video_name_persisted(step): world.edit_component() world.verify_setting_entry( - world.get_setting_entry('Display Name'), - 'Display Name', '3.4', True + world.get_setting_entry(DISPLAY_NAME), + DISPLAY_NAME, '3.4', True ) +@step('I can modify video display name') +def i_can_modify_video_display_name(_step): + index = world.get_setting_entry_index(DISPLAY_NAME) + world.set_field_value(index, '3.4') + world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, '3.4', True) + + @step('I upload transcript file(?:s)?:$') def upload_transcript(step): input_hidden = '.metadata-video-translations .input' diff --git a/cms/djangoapps/contentstore/views/public.py b/cms/djangoapps/contentstore/views/public.py index bd574f39ad..b2b59768b3 100644 --- a/cms/djangoapps/contentstore/views/public.py +++ b/cms/djangoapps/contentstore/views/public.py @@ -9,7 +9,8 @@ from django.conf import settings from edxmako.shortcuts import render_to_response -from external_auth.views import ssl_login_shortcut, ssl_get_cert_from_request +from external_auth.views import (ssl_login_shortcut, ssl_get_cert_from_request, + redirect_with_get) from microsite_configuration import microsite __all__ = ['signup', 'login_page', 'howitworks'] @@ -26,7 +27,7 @@ def signup(request): if settings.FEATURES.get('AUTH_USE_CERTIFICATES_IMMEDIATE_SIGNUP'): # Redirect to course to login to process their certificate if SSL is enabled # and registration is disabled. - return redirect(reverse('login')) + return redirect_with_get('login', request.GET, False) return render_to_response('register.html', {'csrf': csrf_token}) @@ -43,7 +44,15 @@ def login_page(request): # SSL login doesn't require a login view, so redirect # to course now that the user is authenticated via # the decorator. +<<<<<<< HEAD return redirect('/course/') +======= + next_url = request.GET.get('next') + if next_url: + return redirect(next_url) + else: + return redirect('/course') +>>>>>>> edx/master if settings.FEATURES.get('AUTH_USE_CAS'): # If CAS is enabled, redirect auth handling to there return redirect(reverse('cas-login')) diff --git a/cms/envs/common.py b/cms/envs/common.py index f7195d2c54..76e0f4d50f 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -318,7 +318,7 @@ PIPELINE_CSS = { 'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css', 'css/vendor/jquery.qtip.min.css', 'js/vendor/markitup/skins/simple/style.css', - 'js/vendor/markitup/sets/wiki/style.css' + 'js/vendor/markitup/sets/wiki/style.css', ], 'output_filename': 'css/cms-style-vendor.css', }, diff --git a/cms/static/js/spec/views/paging_spec.js b/cms/static/js/spec/views/paging_spec.js index b742ddef60..5deac8e999 100644 --- a/cms/static/js/spec/views/paging_spec.js +++ b/cms/static/js/spec/views/paging_spec.js @@ -245,7 +245,6 @@ define([ "jquery", "js/spec_helpers/create_sinon", "URI", expect(pagingHeader.$('.next-page-link')).toHaveClass('is-disabled'); }); - it('should be disabled on an empty page', function () { var requests = create_sinon.requests(this); pagingView.setPage(0); @@ -301,6 +300,31 @@ define([ "jquery", "js/spec_helpers/create_sinon", "URI", }); }); + describe("Page metadata section", function() { + it('shows the correct metadata for the current page', function () { + var requests = create_sinon.requests(this), + message; + pagingView.setPage(0); + respondWithMockAssets(requests); + message = pagingHeader.$('.meta').html().trim(); + expect(message).toBe('
Showing 1-3' + + ' out of 4 total, ' + + 'sorted by Date descending
'); + }); + + it('shows the correct metadata when sorted ascending', function () { + var requests = create_sinon.requests(this), + message; + pagingView.setPage(0); + pagingView.toggleSortOrder('name-col'); + respondWithMockAssets(requests); + message = pagingHeader.$('.meta').html().trim(); + expect(message).toBe('Showing 1-3' + + ' out of 4 total, ' + + 'sorted by Name ascending
'); + }); + }); + describe("Asset count label", function () { it('should show correct count on first page', function () { var requests = create_sinon.requests(this); diff --git a/cms/static/js/views/paging.js b/cms/static/js/views/paging.js index 966542ed04..c6c3a491ca 100644 --- a/cms/static/js/views/paging.js +++ b/cms/static/js/views/paging.js @@ -87,12 +87,6 @@ define(["underscore", "js/views/baseview", "js/views/feedback_alert", "gettext"] return sortInfo.displayName; }, - sortDirectionName: function() { - var collection = this.collection, - ascending = collection.sortDirection === 'asc'; - return ascending ? gettext("ascending") : gettext("descending"); - }, - setInitialSortColumn: function(sortColumn) { var collection = this.collection, sortInfo = this.sortableColumns[sortColumn]; diff --git a/cms/static/js/views/paging_header.js b/cms/static/js/views/paging_header.js index c8a4f23352..049ae78263 100644 --- a/cms/static/js/views/paging_header.js +++ b/cms/static/js/views/paging_header.js @@ -31,27 +31,48 @@ define(["underscore", "gettext", "js/views/baseview"], function(_, gettext, Base }, messageHtml: function() { + var message; + if (this.view.collection.sortDirection === 'asc') { + // Translators: sample result: "Showing 0-9 out of 25 total, sorted by Date Added ascending" + message = gettext('Showing %(current_item_range)s out of %(total_items_count)s, sorted by %(sort_name)s ascending'); + } else { + // Translators: sample result: "Showing 0-9 out of 25 total, sorted by Date Added descending" + message = gettext('Showing %(current_item_range)s out of %(total_items_count)s, sorted by %(sort_name)s descending'); + } + return '' + interpolate(message, { + current_item_range: this.currentItemRangeLabel(), + total_items_count: this.totalItemsCountLabel(), + sort_name: this.sortNameLabel() + }, true) + "
"; + }, + + currentItemRangeLabel: function() { var view = this.view, collection = view.collection, start = collection.start, count = collection.size(), - sortName = view.sortDisplayName(), - sortDirectionName = view.sortDirectionName(), - end = start + count, - total = collection.totalCount, - fmts = gettext('Showing %(current_span)s%(start)s-%(end)s%(end_span)s out of %(total_span)s%(total)s total%(end_span)s, sorted by %(order_span)s%(sort_order)s%(end_span)s %(sort_direction)s'); - - return '' + interpolate(fmts, { + end = start + count; + return interpolate('%(start)s-%(end)s', { start: Math.min(start + 1, end), - end: end, - total: total, - sort_order: sortName, - sort_direction: sortDirectionName, - current_span: '', - total_span: '', - order_span: '', - end_span: '' - }, true) + "
"; + end: end + }, true); + }, + + totalItemsCountLabel: function() { + var totalItemsLabel; + // Translators: turns into "25 total" to be used in other sentences, e.g. "Showing 0-9 out of 25 total". + totalItemsLabel = interpolate(gettext('%(total_items)s total'), { + total_items: this.view.collection.totalCount + }, true); + return interpolate('%(total_items_label)s', { + total_items_label: totalItemsLabel + }, true); + }, + + sortNameLabel: function() { + return interpolate('%(sort_name)s', { + sort_name: this.view.sortDisplayName() + }, true); }, nextPage: function() { diff --git a/cms/templates/js/video/transcripts/messages/transcripts-not-found.underscore b/cms/templates/js/video/transcripts/messages/transcripts-not-found.underscore index f60b9a3dc6..760f94b26e 100644 --- a/cms/templates/js/video/transcripts/messages/transcripts-not-found.underscore +++ b/cms/templates/js/video/transcripts/messages/transcripts-not-found.underscore @@ -7,8 +7,8 @@ <%= gettext("Error.") %>