From 7770d9d427826af0f0a833fdc8a6c5b6cb746247 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Mon, 17 Mar 2014 10:34:28 -0400 Subject: [PATCH 01/25] Implement editing from the Studio container page. STUD-1306 --- CHANGELOG.rst | 2 + .../component_settings_editor_helpers.py | 6 +- cms/djangoapps/contentstore/features/pages.py | 4 +- .../contentstore/features/transcripts.py | 16 +- .../contentstore/features/video-editor.py | 8 +- .../contentstore/views/component.py | 8 +- cms/djangoapps/contentstore/views/item.py | 4 +- cms/djangoapps/contentstore/views/preview.py | 3 +- .../views/tests/test_container.py | 39 ++- cms/static/coffee/spec/main.coffee | 7 +- cms/static/coffee/spec/main_spec.coffee | 2 +- .../coffee/spec/models/section_spec.coffee | 2 +- .../coffee/spec/views/assets_spec.coffee | 2 +- .../coffee/spec/views/course_info_spec.coffee | 2 +- .../coffee/spec/views/module_edit_spec.coffee | 23 +- .../coffee/spec/views/overview_spec.coffee | 2 +- .../coffee/spec/views/section_spec.coffee | 2 +- .../coffee/spec/views/textbook_spec.coffee | 2 +- .../coffee/spec/views/upload_spec.coffee | 2 +- .../coffee/src/views/module_edit.coffee | 121 +------ cms/static/js/models/xblock_info.js | 4 +- .../js/spec/views/modals/base_modal_spec.js | 35 ++ .../js/spec/views/modals/edit_xblock_spec.js | 94 ++++++ cms/static/js/spec/views/paging_spec.js | 2 +- cms/static/js/spec/views/unit_spec.js | 2 +- .../js/spec/views/xblock_container_spec.js | 80 +++++ .../js/spec/views/xblock_editor_spec.js | 76 +++++ cms/static/js/spec/views/xblock_spec.js | 2 +- .../js/{spec => spec_helpers}/create_sinon.js | 0 cms/static/js/spec_helpers/edit_helpers.js | 60 ++++ cms/static/js/views/baseview.js | 6 +- cms/static/js/views/modals/base_modal.js | 25 ++ cms/static/js/views/modals/edit_xblock.js | 160 ++++++++++ cms/static/js/views/overview.js | 4 +- cms/static/js/views/uploads.js | 10 +- .../js/views/video/transcripts/editor.js | 4 +- .../video/transcripts/message_manager.js | 2 +- .../video/transcripts/metadata_videolist.js | 4 +- cms/static/js/views/xblock.js | 48 ++- cms/static/js/views/xblock_container.js | 94 ++++++ cms/static/js/views/xblock_editor.js | 173 ++++++++++ cms/static/sass/_base.scss | 2 +- cms/static/sass/elements/_forms.scss | 14 + cms/static/sass/elements/_modal-window.scss | 297 +++++++++++++++++ cms/static/sass/elements/_uploads.scss | 6 + cms/static/sass/elements/_xblocks.scss | 14 +- cms/static/sass/style-app.scss | 1 + cms/static/sass/views/_container.scss | 58 +++- cms/static/sass/views/_static-pages.scss | 1 + cms/static/sass/views/_unit.scss | 9 +- cms/templates/container.html | 92 ++++-- cms/templates/edit-tabs.html | 10 + cms/templates/js/edit-xblock-modal.underscore | 30 ++ .../js/editor-mode-button.underscore | 3 + .../js/mock/mock-container-view.underscore | 122 +++++++ .../js/mock/mock-container-xblock.underscore | 300 ++++++++++++++++++ cms/templates/js/mock/mock-modal.underscore | 22 ++ .../js/mock/mock-xblock-editor.underscore | 8 + .../js/mock/mock-xmodule-editor.underscore | 170 ++++++++++ cms/templates/js/upload-dialog.underscore | 12 +- cms/templates/overview.html | 10 +- cms/templates/studio_xblock_wrapper.html | 16 +- cms/templates/textbooks.html | 2 +- cms/templates/unit.html | 25 +- cms/templates/ux/reference/container.html | 10 +- cms/templates/widgets/source-edit.html | 18 +- .../lib/xmodule/xmodule/css/problem/edit.scss | 2 +- .../xmodule/xmodule/js/spec/tabs/edit.coffee | 2 +- .../js/src/tabs/tabs-aggregator.coffee | 5 +- common/static/sass/_mixins.scss | 4 + ...odal.underscore => image-modal.underscore} | 0 lms/templates/courseware/courseware.html | 13 +- 72 files changed, 2133 insertions(+), 287 deletions(-) create mode 100644 cms/static/js/spec/views/modals/base_modal_spec.js create mode 100644 cms/static/js/spec/views/modals/edit_xblock_spec.js create mode 100644 cms/static/js/spec/views/xblock_container_spec.js create mode 100644 cms/static/js/spec/views/xblock_editor_spec.js rename cms/static/js/{spec => spec_helpers}/create_sinon.js (100%) create mode 100644 cms/static/js/spec_helpers/edit_helpers.js create mode 100644 cms/static/js/views/modals/base_modal.js create mode 100644 cms/static/js/views/modals/edit_xblock.js create mode 100644 cms/static/js/views/xblock_container.js create mode 100644 cms/static/js/views/xblock_editor.js create mode 100644 cms/static/sass/elements/_modal-window.scss create mode 100644 cms/templates/js/edit-xblock-modal.underscore create mode 100644 cms/templates/js/editor-mode-button.underscore create mode 100644 cms/templates/js/mock/mock-container-view.underscore create mode 100644 cms/templates/js/mock/mock-container-xblock.underscore create mode 100644 cms/templates/js/mock/mock-modal.underscore create mode 100644 cms/templates/js/mock/mock-xblock-editor.underscore create mode 100644 cms/templates/js/mock/mock-xmodule-editor.underscore rename common/templates/js/{imageModal.underscore => image-modal.underscore} (100%) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8ad10f8eca20..7f736932fd8b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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. +Studio: Add edit button to leaf xblocks on the container page. STUD-1306. + Blades: Add LTI context_id parameter. BLD-584. Blades: Update LTI resource_link_id parameter. BLD-768. diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 60632f77a7ac..7431eb3ed968 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -107,7 +107,7 @@ def click_component_from_menu(category, component_type, is_advanced): def edit_component_and_select_settings(): world.wait_for(lambda _driver: world.css_visible('a.edit-button')) world.css_click('a.edit-button') - world.css_click('#settings-mode a') + world.css_click('.settings-button') @world.absorb @@ -174,7 +174,7 @@ def verify_all_setting_entries(expected_entries): @world.absorb def save_component(step): - world.css_click("a.save-button") + world.css_click("a.action-save") world.wait_for_ajax_complete() @@ -189,7 +189,7 @@ def save_component_and_reopen(step): @world.absorb def cancel_component(step): - world.css_click("a.cancel-button") + world.css_click("a.action-cancel") # We have a known issue that modifications are still shown within the edit window after cancel (though) # they are not persisted. Refresh the browser to make sure the changes were not persisted. reload_the_page(step) diff --git a/cms/djangoapps/contentstore/features/pages.py b/cms/djangoapps/contentstore/features/pages.py index e86177282d43..2306dfb76898 100644 --- a/cms/djangoapps/contentstore/features/pages.py +++ b/cms/djangoapps/contentstore/features/pages.py @@ -44,13 +44,13 @@ def click_edit_or_delete(step, edit_or_delete): @step(u'I change the name to "([^"]*)"$') def change_name(step, new_name): - settings_css = '#settings-mode a' + settings_css = '.settings-button' world.css_click(settings_css) input_css = 'input.setting-input' world.css_fill(input_css, new_name) if world.is_firefox(): world.trigger_event(input_css) - save_button = 'a.save-button' + save_button = 'a.action-save' world.css_click(save_button) diff --git a/cms/djangoapps/contentstore/features/transcripts.py b/cms/djangoapps/contentstore/features/transcripts.py index e198ee3f3253..636b5dd83af9 100644 --- a/cms/djangoapps/contentstore/features/transcripts.py +++ b/cms/djangoapps/contentstore/features/transcripts.py @@ -209,23 +209,31 @@ def check_text_in_the_captions(_step, text): @step('I see value "([^"]*)" in the field "([^"]*)"$') def check_transcripts_field(_step, values, field_name): - world.click_link_by_text('Advanced') + editor_tabs = world.browser.find_by_css('.editor-tabs a') + basic_tab = editor_tabs[0] + advanced_tab = editor_tabs[1] + advanced_tab.click() field_id = '#' + world.browser.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.click_link_by_text('Basic') + basic_tab.click() @step('I save changes$') def save_changes(_step): - save_css = 'a.save-button' + save_css = 'a.action-save' world.css_click(save_css) world.wait_for_ajax_complete() @step('I open tab "([^"]*)"$') def open_tab(_step, tab_name): - world.click_link_by_text(tab_name.strip()) + editor_tabs = world.browser.find_by_css('.editor-tabs a') + expected_tab_text = tab_name.strip().upper() + matching_tabs = [tab for tab in editor_tabs if tab.text == expected_tab_text] + assert len(matching_tabs) == 1 + tab = matching_tabs[0] + tab.click() world.wait_for_ajax_complete() diff --git a/cms/djangoapps/contentstore/features/video-editor.py b/cms/djangoapps/contentstore/features/video-editor.py index a7974f020ffb..abff4bd74a16 100644 --- a/cms/djangoapps/contentstore/features/video-editor.py +++ b/cms/djangoapps/contentstore/features/video-editor.py @@ -113,10 +113,10 @@ def set_show_captions(step, setting): world.browser.cookies.delete('hide_captions') world.css_click('a.edit-button') - world.wait_for(lambda _driver: world.css_visible('a.save-button')) - world.click_link_by_text('Advanced') + world.wait_for(lambda _driver: world.css_visible('a.action-save')) + world.click_link_by_text('ADVANCED') world.browser.select('Transcript Display', setting) - world.css_click('a.save-button') + world.css_click('a.action-save') @step('when I view the video it (.*) show the captions$') @@ -161,7 +161,7 @@ def correct_video_settings(_step): @step('my video display name change is persisted on save$') def video_name_persisted(step): - world.css_click('a.save-button') + world.css_click('a.action-save') reload_the_page(step) world.wait_for_xmodule() world.edit_component() diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index e2152d987259..316157530981 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -273,6 +273,7 @@ def unit_handler(request, tag=None, package_id=None, branch=None, version_guid=N 'context_course': course, 'unit': item, 'unit_locator': locator, + 'xblocks': [xblock for xblock in xblocks], 'locators': locators, 'component_templates': component_templates, 'draft_preview_link': preview_lms_link, @@ -317,14 +318,17 @@ def container_handler(request, tag=None, package_id=None, branch=None, version_g while parent and parent.category != 'sequential': ancestor_xblocks.append(parent) parent = get_parent_xblock(parent) - ancestor_xblocks.reverse() + unit = None if not ancestor_xblocks else ancestor_xblocks[0] + unit_publish_state = None if not unit else compute_publish_state(unit) + return render_to_response('container.html', { 'context_course': course, 'xblock': xblock, 'xblock_locator': locator, - 'unit': None if not ancestor_xblocks else ancestor_xblocks[0], + 'unit': unit, + 'unit_publish_state': unit_publish_state, 'ancestor_xblocks': ancestor_xblocks, }) else: diff --git a/cms/djangoapps/contentstore/views/item.py b/cms/djangoapps/contentstore/views/item.py index 344c6d5c5731..f27df9c1b5dd 100644 --- a/cms/djangoapps/contentstore/views/item.py +++ b/cms/djangoapps/contentstore/views/item.py @@ -34,6 +34,7 @@ from .access import has_course_access from .helpers import _xmodule_recurse +from contentstore.utils import compute_publish_state, PublishState from contentstore.views.preview import get_preview_fragment from edxmako.shortcuts import render_to_string from models.settings.course_grading import CourseGradingModel @@ -224,11 +225,12 @@ def xblock_view_handler(request, package_id, view_name, tag=None, branch=None, v }) elif view_name in ('student_view', 'container_preview'): is_container_view = (view_name == 'container_preview') + component_publish_state = compute_publish_state(component) + is_read_only_view = component_publish_state == PublishState.public # Only show the new style HTML for the container view, i.e. for non-verticals # Note: this special case logic can be removed once the unit page is replaced # with the new container view. - is_read_only_view = is_container_view context = { 'runtime_type': 'studio', 'container_view': is_container_view, diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index b3e4f0562ecc..17c1548299a7 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -1,7 +1,6 @@ from __future__ import absolute_import import logging -import hashlib from functools import partial from django.conf import settings @@ -170,7 +169,7 @@ def _studio_wrap_xblock(xblock, view, frag, context, display_name_only=False): """ # Only add the Studio wrapper when on the container page. The unit page will remain as is for now. if context.get('container_view', None) and view == 'student_view': - locator = loc_mapper().translate_location(xblock.course_id, xblock.location) + locator = loc_mapper().translate_location(xblock.course_id, xblock.location, published=False) template_context = { 'xblock_context': context, 'xblock': xblock, diff --git a/cms/djangoapps/contentstore/views/tests/test_container.py b/cms/djangoapps/contentstore/views/tests/test_container.py index 0752ca61410f..fefc19ea2100 100644 --- a/cms/djangoapps/contentstore/views/tests/test_container.py +++ b/cms/djangoapps/contentstore/views/tests/test_container.py @@ -3,6 +3,7 @@ """ from contentstore.tests.utils import CourseTestCase +from contentstore.utils import compute_publish_state, PublishState from contentstore.views.helpers import xblock_studio_url from xmodule.modulestore.tests.factories import ItemFactory @@ -26,13 +27,19 @@ def setUp(self): category="video", display_name="My Video") def test_container_html(self): + branch_name = "MITx.999.Robot_Super_Course/branch/draft/block" self._test_html_content( self.child_vertical, - expected_section_tag='
', + branch_name=branch_name, + expected_section_tag=( + ' + -
- - -
- diff --git a/cms/templates/js/mock/mock-empty-container-xblock.underscore b/cms/templates/js/mock/mock-empty-container-xblock.underscore new file mode 100644 index 000000000000..c952710a3985 --- /dev/null +++ b/cms/templates/js/mock/mock-empty-container-xblock.underscore @@ -0,0 +1,22 @@ +
+
+ + + Expand or Collapse + + Empty Vertical Test +
+
+
    +
  • No Actions
  • +
+
+
+
+
+
+
+
+
+
+
diff --git a/cms/templates/js/mock/mock-modal.underscore b/cms/templates/js/mock/mock-modal.underscore index bd8d2260820f..dc429d8a9c7b 100644 --- a/cms/templates/js/mock/mock-modal.underscore +++ b/cms/templates/js/mock/mock-modal.underscore @@ -1,22 +1 @@ -
- -
+
diff --git a/cms/templates/js/mock/mock-xmodule-editor.underscore b/cms/templates/js/mock/mock-xmodule-editor.underscore index fb4842465696..d2cf3a129268 100644 --- a/cms/templates/js/mock/mock-xmodule-editor.underscore +++ b/cms/templates/js/mock/mock-xmodule-editor.underscore @@ -2,73 +2,6 @@
-
-
    -
  • -

    Sort:

    - -
  • - -
  • -

    Filter:

    - - More -
  • - -
-
- - - - - - - - - - - - - - -
- - diff --git a/cms/templates/js/mock/mock-xmodule-settings-only-editor.underscore b/cms/templates/js/mock/mock-xmodule-settings-only-editor.underscore new file mode 100644 index 000000000000..aa24943c8678 --- /dev/null +++ b/cms/templates/js/mock/mock-xmodule-settings-only-editor.underscore @@ -0,0 +1,27 @@ +
+
+ + + + +
+
diff --git a/cms/templates/js/modal-button.underscore b/cms/templates/js/modal-button.underscore new file mode 100644 index 000000000000..06086cf1a9be --- /dev/null +++ b/cms/templates/js/modal-button.underscore @@ -0,0 +1,3 @@ +
  • + <%= name %> +
  • diff --git a/cms/templates/js/upload-dialog.underscore b/cms/templates/js/upload-dialog.underscore index a0b5c9ca4e2b..8fec35800b66 100644 --- a/cms/templates/js/upload-dialog.underscore +++ b/cms/templates/js/upload-dialog.underscore @@ -1,55 +1,31 @@ - + diff --git a/cms/templates/settings.html b/cms/templates/settings.html index e78ed5415136..0cc770adfaad 100644 --- a/cms/templates/settings.html +++ b/cms/templates/settings.html @@ -8,13 +8,17 @@ from xmodule.modulestore.django import loc_mapper %> +<%block name="header_extras"> +% for template_name in ["basic-modal", "modal-button", "upload-dialog"]: + +% endfor + + <%block name="jsextra"> - - diff --git a/cms/templates/unit.html b/cms/templates/unit.html index 29ab22487770..72b28c0d0501 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -10,7 +10,7 @@ <%block name="bodyclass">is-signedin course unit view-unit feature-upload <%block name="header_extras"> -% for template_name in ["image-modal", "edit-xblock-modal", "editor-mode-button", "upload-dialog"]: +% for template_name in ["image-modal", "basic-modal", "modal-button", "edit-xblock-modal", "editor-mode-button", "upload-dialog"]: diff --git a/common/test/acceptance/pages/studio/unit.py b/common/test/acceptance/pages/studio/unit.py index 9712051b6bd6..94af355980bc 100644 --- a/common/test/acceptance/pages/studio/unit.py +++ b/common/test/acceptance/pages/studio/unit.py @@ -105,18 +105,15 @@ def preview_selector(self): def edit(self): self.q(css=self._bounded_selector('.edit-button')).first.click() EmptyPromise( - lambda: all( - self.q(css=self._bounded_selector('.component-editor')) - .map(lambda el: el.is_displayed()) - .results), - "Verify that the editor for component {} has been expanded".format(self.locator) + lambda: self.q(css='.xblock-studio_view').present, + 'Wait for the Studio editor to be present' ).fulfill() return self @property def editor_selector(self): - return self._bounded_selector('.xblock-studio_view') + return '.xblock-studio_view' def go_to_container(self): """ From a6aae729b7364fe3d7c17110a0418824348dac8e Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Tue, 8 Apr 2014 15:15:35 -0400 Subject: [PATCH 18/25] Address the next round of review comments. --- .../component_settings_editor_helpers.py | 6 + cms/djangoapps/contentstore/views/helpers.py | 3 + cms/envs/common.py | 3 + cms/static/coffee/spec/main.coffee | 3 +- .../coffee/spec/views/textbook_spec.coffee | 6 +- .../js/spec/views/modals/base_modal_spec.js | 4 +- .../js/spec/views/modals/edit_xblock_spec.js | 10 +- .../container_spec.js} | 27 ++-- .../js/spec/views/xblock_editor_spec.js | 5 +- cms/static/js/spec/views/xblock_spec.js | 2 +- cms/static/js/spec_helpers/edit_helpers.js | 11 +- cms/static/js/spec_helpers/modal_helpers.js | 34 +++-- cms/static/js/views/asset.js | 2 +- cms/static/js/views/assets.js | 2 +- cms/static/js/views/baseview.js | 14 +++ cms/static/js/views/checklist.js | 2 +- cms/static/js/views/course_info_handout.js | 2 +- cms/static/js/views/course_info_update.js | 2 +- cms/static/js/views/edit_chapter.js | 4 +- cms/static/js/views/edit_textbook.js | 2 +- cms/static/js/views/feedback.js | 6 +- cms/static/js/views/list_textbooks.js | 2 +- cms/static/js/views/metadata.js | 6 +- cms/static/js/views/modals/base_modal.js | 21 ++-- cms/static/js/views/modals/edit_xblock.js | 4 +- .../container.js} | 0 cms/static/js/views/paging_footer.js | 6 +- cms/static/js/views/paging_header.js | 26 ++-- cms/static/js/views/section_edit.js | 2 +- cms/static/js/views/uploads.js | 4 +- cms/templates/container.html | 10 +- .../js/mock/mock-container-page.underscore | 42 +++++++ .../js/mock/mock-container-view.underscore | 117 ------------------ cms/templates/unit.html | 3 +- 34 files changed, 173 insertions(+), 220 deletions(-) rename cms/static/js/spec/views/{xblock_container_spec.js => pages/container_spec.js} (88%) rename cms/static/js/views/{xblock_container.js => pages/container.js} (100%) create mode 100644 cms/templates/js/mock/mock-container-page.underscore delete mode 100644 cms/templates/js/mock/mock-container-view.underscore diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 84ee81c9d95b..9ed04277300b 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -6,6 +6,7 @@ from terrain.steps import reload_the_page from common import type_in_codemirror from selenium.webdriver.common.keys import Keys +from cms.envs.common import FEATURES @world.absorb @@ -54,6 +55,11 @@ def click_new_component_button(step, component_button_css): world.css_click(component_button_css) + if FEATURES['USE_CONTAINER_PAGE_FOR_TESTING']: + unit_url = world.browser.url + container_url = unit_url.replace('/unit/', '/container/') + world.visit(container_url) + def _click_advanced(): css = 'ul.problem-type-tabs a[href="#tab2"]' diff --git a/cms/djangoapps/contentstore/views/helpers.py b/cms/djangoapps/contentstore/views/helpers.py index 946fa1637d37..2141ecc3c578 100644 --- a/cms/djangoapps/contentstore/views/helpers.py +++ b/cms/djangoapps/contentstore/views/helpers.py @@ -7,6 +7,9 @@ __all__ = ['edge', 'event', 'landing'] +EDITING_TEMPLATES = [ + "basic-modal", "modal-button", "edit-xblock-modal", "editor-mode-button", "upload-dialog", "image-modal" +] # points to the temporary course landing page with log in and sign up def landing(request, org, course, coursename): diff --git a/cms/envs/common.py b/cms/envs/common.py index 022e9dd94b4b..a4b3a9ae62d7 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -99,6 +99,9 @@ # Turn off Advanced Security by default 'ADVANCED_SECURITY': False, + + # Switch acceptance tests to use the container page instead of the unit page + 'USE_CONTAINER_PAGE_FOR_TESTING': False, } ENABLE_JASMINE = False diff --git a/cms/static/coffee/spec/main.coffee b/cms/static/coffee/spec/main.coffee index e13ae0723c2a..d8126c77e8ea 100644 --- a/cms/static/coffee/spec/main.coffee +++ b/cms/static/coffee/spec/main.coffee @@ -218,9 +218,10 @@ define([ "js/spec/views/unit_spec", "js/spec/views/xblock_spec", - "js/spec/views/xblock_container_spec", "js/spec/views/xblock_editor_spec", + "js/spec/views/pages/container_spec", + "js/spec/views/modals/base_modal_spec", "js/spec/views/modals/edit_xblock_spec", diff --git a/cms/static/coffee/spec/views/textbook_spec.coffee b/cms/static/coffee/spec/views/textbook_spec.coffee index b5b710136cd4..7280642c97a9 100644 --- a/cms/static/coffee/spec/views/textbook_spec.coffee +++ b/cms/static/coffee/spec/views/textbook_spec.coffee @@ -1,7 +1,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js/models/course", "js/collections/textbook", "js/views/show_textbook", "js/views/edit_textbook", "js/views/list_textbooks", "js/views/edit_chapter", "js/views/feedback_prompt", "js/views/feedback_notification", - "js/spec_helpers/create_sinon", "jasmine-stealth"], + "js/spec_helpers/create_sinon", "js/spec_helpers/modal_helpers", "jasmine-stealth"], (Textbook, Chapter, ChapterSet, Course, TextbookSet, ShowTextbook, EditTextbook, ListTexbook, EditChapter, Prompt, Notification, create_sinon) -> feedbackTpl = readFixtures('system-feedback.underscore') @@ -272,8 +272,8 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js tpl = readFixtures("edit-chapter.underscore") beforeEach -> - setFixtures($(" @@ -30,14 +30,14 @@ }; %> - - -
    - - -
    -
    -
    -

    edX Studio Help

    -
    - -
    -

    Studio Support

    - -
    -

    Need help with Studio? Creating a course is complex, so we're here to help. Take advantage of our documentation, help center, as well as our edX101 introduction course for course authors.

    -
    - - -
    - - -
    -
    -
    - -
    - \ No newline at end of file diff --git a/cms/templates/unit.html b/cms/templates/unit.html index 72b28c0d0501..4602b28e732b 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -1,6 +1,7 @@ <%inherit file="base.html" /> <%! from django.core.urlresolvers import reverse +from contentstore.views.helpers import EDITING_TEMPLATES from django.utils.translation import ugettext as _ from xmodule.modulestore.django import loc_mapper %> @@ -10,7 +11,7 @@ <%block name="bodyclass">is-signedin course unit view-unit feature-upload <%block name="header_extras"> -% for template_name in ["image-modal", "basic-modal", "modal-button", "edit-xblock-modal", "editor-mode-button", "upload-dialog"]: +% for template_name in EDITING_TEMPLATES: From 9de6f1016c02f1e9626de1640c6ff8ddd26200f9 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Tue, 8 Apr 2014 18:19:46 -0400 Subject: [PATCH 19/25] Fix typo in textbook_spec.js --- cms/static/coffee/spec/views/textbook_spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/static/coffee/spec/views/textbook_spec.coffee b/cms/static/coffee/spec/views/textbook_spec.coffee index 7280642c97a9..68be771edd25 100644 --- a/cms/static/coffee/spec/views/textbook_spec.coffee +++ b/cms/static/coffee/spec/views/textbook_spec.coffee @@ -2,7 +2,7 @@ define ["js/models/textbook", "js/models/chapter", "js/collections/chapter", "js "js/collections/textbook", "js/views/show_textbook", "js/views/edit_textbook", "js/views/list_textbooks", "js/views/edit_chapter", "js/views/feedback_prompt", "js/views/feedback_notification", "js/spec_helpers/create_sinon", "js/spec_helpers/modal_helpers", "jasmine-stealth"], -(Textbook, Chapter, ChapterSet, Course, TextbookSet, ShowTextbook, EditTextbook, ListTexbook, EditChapter, Prompt, Notification, create_sinon) -> +(Textbook, Chapter, ChapterSet, Course, TextbookSet, ShowTextbook, EditTextbook, ListTexbook, EditChapter, Prompt, Notification, create_sinon, modal_helpers) -> feedbackTpl = readFixtures('system-feedback.underscore') beforeEach -> From 2ae28c5db7d2d1bdd51d34d467ce349d9e2aa020 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Tue, 8 Apr 2014 19:35:18 -0400 Subject: [PATCH 20/25] Improve unit testing of xblock editing --- .../js/spec/views/modals/edit_xblock_spec.js | 6 +- .../js/spec/views/pages/container_spec.js | 77 +++++++++--------- .../js/spec/views/xblock_editor_spec.js | 78 ++++++++++++------- cms/static/js/spec_helpers/edit_helpers.js | 52 +++++++++++++ cms/static/js/views/xblock_editor.js | 17 ++-- cms/templates/container.html | 4 +- .../js/mock/mock-updated-xblock.underscore | 17 ++++ .../js/mock/mock-xblock-editor.underscore | 8 +- .../js/mock/mock-xmodule-editor.underscore | 3 +- 9 files changed, 178 insertions(+), 84 deletions(-) create mode 100644 cms/templates/js/mock/mock-updated-xblock.underscore diff --git a/cms/static/js/spec/views/modals/edit_xblock_spec.js b/cms/static/js/spec/views/modals/edit_xblock_spec.js index ac33fa59d29b..0605b269a43f 100644 --- a/cms/static/js/spec/views/modals/edit_xblock_spec.js +++ b/cms/static/js/spec/views/modals/edit_xblock_spec.js @@ -30,13 +30,11 @@ define(["jquery", "underscore", "js/spec_helpers/create_sinon", "js/spec_helpers mockXBlockEditorHtml = readFixtures('mock/mock-xblock-editor.underscore'); beforeEach(function () { - window.MockXBlock = function(runtime, element) { - return { }; - }; + edit_helpers.installMockXBlock(); }); afterEach(function() { - window.MockXBlock = null; + edit_helpers.uninstallMockXBlock(); }); it('can show itself', function() { diff --git a/cms/static/js/spec/views/pages/container_spec.js b/cms/static/js/spec/views/pages/container_spec.js index 015befe2fbe3..a969d7199737 100644 --- a/cms/static/js/spec/views/pages/container_spec.js +++ b/cms/static/js/spec/views/pages/container_spec.js @@ -1,9 +1,9 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers", "js/views/pages/container", "js/models/xblock_info"], - function ($, create_sinon, edit_helpers, XBlockContainerPage, XBlockInfo) { + function ($, create_sinon, edit_helpers, ContainerPage, XBlockInfo) { - describe("XBlockContainerView", function() { - var model, containerView, respondWithMockXBlockEditorFragment, mockContainerPage; + describe("ContainerPage", function() { + var model, containerPage, respondWithMockXBlockEditorFragment, mockContainerPage; mockContainerPage = readFixtures('mock/mock-container-page.underscore'); @@ -16,7 +16,7 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" display_name: 'Test Unit', category: 'vertical' }); - containerView = new XBlockContainerPage({ + containerPage = new ContainerPage({ model: model, el: $('#content') }); @@ -32,26 +32,26 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" it('can render itself', function() { var requests = create_sinon.requests(this); - containerView.render(); + containerPage.render(); respondWithMockXBlockEditorFragment(requests, { html: mockContainerXBlockHtml, "resources": [] }); - expect(containerView.$el.select('.xblock-header')).toBeTruthy(); - expect(containerView.$('.wrapper-xblock')).not.toHaveClass('is-hidden'); - expect(containerView.$('.no-container-content')).toHaveClass('is-hidden'); + expect(containerPage.$el.select('.xblock-header')).toBeTruthy(); + expect(containerPage.$('.wrapper-xblock')).not.toHaveClass('is-hidden'); + expect(containerPage.$('.no-container-content')).toHaveClass('is-hidden'); }); it('shows a loading indicator', function() { var requests = create_sinon.requests(this); - containerView.render(); - expect(containerView.$('.ui-loading')).not.toHaveClass('is-hidden'); + containerPage.render(); + expect(containerPage.$('.ui-loading')).not.toHaveClass('is-hidden'); respondWithMockXBlockEditorFragment(requests, { html: mockContainerXBlockHtml, "resources": [] }); - expect(containerView.$('.ui-loading')).toHaveClass('is-hidden'); + expect(containerPage.$('.ui-loading')).toHaveClass('is-hidden'); }); }); @@ -59,28 +59,19 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" describe("Editing an xblock", function() { var mockContainerXBlockHtml, mockXBlockEditorHtml, - saved, newDisplayName = 'New Display Name'; beforeEach(function () { - saved = false; - window.MockXBlock = function(runtime, element) { - return { - save: function() { - saved = true; - return { - data: "

    Some HTML

    ", - metadata: { - display_name: newDisplayName - } - }; - } - }; - }; + edit_helpers.installMockXBlock({ + data: "

    Some HTML

    ", + metadata: { + display_name: newDisplayName + } + }); }); afterEach(function() { - window.MockXBlock = null; + edit_helpers.uninstallMockXBlock(); edit_helpers.cancelModalIfShowing(); }); @@ -90,12 +81,12 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" it('can show an edit modal for a child xblock', function() { var requests = create_sinon.requests(this), editButtons; - containerView.render(); + containerPage.render(); respondWithMockXBlockEditorFragment(requests, { html: mockContainerXBlockHtml, "resources": [] }); - editButtons = containerView.$('.edit-button'); + editButtons = containerPage.$('.edit-button'); // The container renders four mock xblocks, so there should be four edit buttons expect(editButtons.length).toBe(4); editButtons.first().click(); @@ -111,14 +102,15 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" }); it('can save changes to settings', function() { - var requests, editButtons, modal; + var requests, editButtons, modal, mockUpdatedXBlockHtml; + mockUpdatedXBlockHtml = readFixtures('mock/mock-updated-xblock.underscore'); requests = create_sinon.requests(this); - containerView.render(); + containerPage.render(); respondWithMockXBlockEditorFragment(requests, { html: mockContainerXBlockHtml, "resources": [] }); - editButtons = containerView.$('.edit-button'); + editButtons = containerPage.$('.edit-button'); // The container renders four mock xblocks, so there should be four edit buttons expect(editButtons.length).toBe(4); editButtons.first().click(); @@ -131,10 +123,21 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" // Click on the settings tab modal.find('.settings-button').click(); // Change the display name's text - modal.find('.setting-input').text("New display name"); + modal.find('.setting-input').text("Mock Update"); // Press the save button modal.find('.action-save').click(); - expect(saved).toBe(true); + // Respond to the save + create_sinon.respondWithJson(requests, { + id: model.id + }); + // Respond to the request to refresh + respondWithMockXBlockEditorFragment(requests, { + html: mockUpdatedXBlockHtml, + "resources": [] + }); + // Verify that the xblock was updated + expect(containerPage.$('.mock-updated-content').text()).toBe('Mock Update'); + expect(edit_helpers.hasSavedMockXBlock()).toBe(true); }); }); @@ -143,14 +146,14 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers" it('shows the "no children" message', function() { var requests = create_sinon.requests(this); - containerView.render(); + containerPage.render(); respondWithMockXBlockEditorFragment(requests, { html: mockContainerXBlockHtml, "resources": [] }); - expect(containerView.$('.no-container-content')).not.toHaveClass('is-hidden'); - expect(containerView.$('.wrapper-xblock')).toHaveClass('is-hidden'); + expect(containerPage.$('.no-container-content')).not.toHaveClass('is-hidden'); + expect(containerPage.$('.wrapper-xblock')).toHaveClass('is-hidden'); }); }); }); diff --git a/cms/static/js/spec/views/xblock_editor_spec.js b/cms/static/js/spec/views/xblock_editor_spec.js index 7d2b9b47d73e..ac313342c3ad 100644 --- a/cms/static/js/spec/views/xblock_editor_spec.js +++ b/cms/static/js/spec/views/xblock_editor_spec.js @@ -1,9 +1,17 @@ -define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers", - "js/views/xblock_editor", "js/models/xblock_info"], - function ($, create_sinon, edit_helpers, XBlockEditorView, XBlockInfo) { +define([ "jquery", "underscore", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers", + "js/views/xblock_editor", "js/models/xblock_info"], + function ($, _, create_sinon, edit_helpers, XBlockEditorView, XBlockInfo) { describe("XBlockEditorView", function() { - var model, editor; + var model, editor, testDisplayName, mockSaveResponse; + + testDisplayName = 'Test Display Name'; + mockSaveResponse = { + data: "

    Some HTML

    ", + metadata: { + display_name: testDisplayName + } + }; beforeEach(function () { edit_helpers.installEditTemplates(); @@ -21,13 +29,11 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers var mockXBlockEditorHtml; beforeEach(function () { - window.MockXBlock = function(runtime, element) { - return { }; - }; + edit_helpers.installMockXBlock(mockSaveResponse); }); afterEach(function() { - window.MockXBlock = null; + edit_helpers.uninstallMockXBlock(); }); mockXBlockEditorHtml = readFixtures('mock/mock-xblock-editor.underscore'); @@ -41,7 +47,22 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers }); expect(editor.$el.select('.xblock-header')).toBeTruthy(); - expect(editor.getMode()).toEqual('editor'); + expect(editor.getMode()).toEqual('settings'); + }); + + it('saves any custom metadata', function() { + var requests = create_sinon.requests(this), request, response; + editor.render(); + create_sinon.respondWithJson(requests, { + html: mockXBlockEditorHtml, + "resources": [] + }); + editor.save(); + request = requests[requests.length - 1]; + response = JSON.parse(request.requestBody); + expect(edit_helpers.hasSavedMockXBlock()).toBeTruthy(); + expect(response.metadata.display_name).toBe(testDisplayName); + expect(response.metadata.custom_field).toBe('Custom Value'); }); }); @@ -51,12 +72,11 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers mockXModuleEditorHtml = readFixtures('mock/mock-xmodule-editor.underscore'); beforeEach(function() { - // Mock the VerticalDescriptor so that the module can be rendered - window.VerticalDescriptor = XModule.Descriptor; + edit_helpers.installMockXModule(mockSaveResponse); }); afterEach(function () { - window.VerticalDescriptor = null; + edit_helpers.uninstallMockXModule(); }); it('can render itself', function() { @@ -70,26 +90,28 @@ define([ "jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/edit_helpers expect(editor.$el.select('.xblock-header')).toBeTruthy(); expect(editor.getMode()).toEqual('editor'); }); - }); - - describe("Editing an xmodule (settings only)", function() { - var mockXModuleEditorHtml; - mockXModuleEditorHtml = readFixtures('mock/mock-xmodule-settings-only-editor.underscore'); - - beforeEach(function() { - edit_helpers.installEditTemplates(); - - // Mock the VerticalDescriptor so that the module can be rendered - window.VerticalDescriptor = XModule.Descriptor; + it('saves any custom metadata', function() { + var requests = create_sinon.requests(this), request, response; + editor.render(); + create_sinon.respondWithJson(requests, { + html: mockXModuleEditorHtml, + "resources": [] + }); + // Give the mock xblock a save method... + editor.xblock.save = window.MockDescriptor.save; + editor.save(); + request = requests[requests.length - 1]; + response = JSON.parse(request.requestBody); + expect(edit_helpers.hasSavedMockXModule()).toBeTruthy(); + expect(response.metadata.display_name).toBe(testDisplayName); + expect(response.metadata.custom_field).toBe('Custom Value'); }); - afterEach(function () { - window.VerticalDescriptor = null; - }); + it('can render a module with only settings', function() { + var requests = create_sinon.requests(this), mockXModuleEditorHtml; + mockXModuleEditorHtml = readFixtures('mock/mock-xmodule-settings-only-editor.underscore'); - it('can render itself', function() { - var requests = create_sinon.requests(this); editor.render(); create_sinon.respondWithJson(requests, { html: mockXModuleEditorHtml, diff --git a/cms/static/js/spec_helpers/edit_helpers.js b/cms/static/js/spec_helpers/edit_helpers.js index 0c291cde281e..ba81532f1934 100644 --- a/cms/static/js/spec_helpers/edit_helpers.js +++ b/cms/static/js/spec_helpers/edit_helpers.js @@ -10,9 +10,55 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/modal_helpers stringEntryTemplate = readFixtures('metadata-string-entry.underscore'), editXBlockModalTemplate = readFixtures('edit-xblock-modal.underscore'), editorModeButtonTemplate = readFixtures('editor-mode-button.underscore'), + xblockSaved, + installMockXBlock, + uninstallMockXBlock, + hasSavedMockXBlock, + xmoduleSaved, + installMockXModule, + uninstallMockXModule, + hasSavedMockXModule, installEditTemplates, showEditModal; + installMockXBlock = function(mockResult) { + xblockSaved = false; + window.MockXBlock = function(runtime, element) { + return { + save: function() { + xblockSaved = true; + return mockResult; + } + }; + }; + }; + + uninstallMockXBlock = function() { + window.MockXBlock = null; + }; + + hasSavedMockXBlock = function() { + return xblockSaved; + }; + + installMockXModule = function(mockResult) { + xmoduleSaved = false; + window.MockDescriptor = _.extend(XModule.Descriptor, { + save: function() { + xmoduleSaved = true; + return mockResult; + } + }); + }; + + uninstallMockXModule = function() { + window.MockDescriptor = null; + }; + + hasSavedMockXModule = function() { + return xmoduleSaved; + }; + installEditTemplates = function(append) { modal_helpers.installModalTemplates(append); @@ -37,6 +83,12 @@ define(["jquery", "js/spec_helpers/create_sinon", "js/spec_helpers/modal_helpers }; return $.extend(modal_helpers, { + 'installMockXBlock': installMockXBlock, + 'hasSavedMockXBlock': hasSavedMockXBlock, + 'uninstallMockXBlock': uninstallMockXBlock, + 'installMockXModule': installMockXModule, + 'hasSavedMockXModule': hasSavedMockXModule, + 'uninstallMockXModule': uninstallMockXModule, 'installEditTemplates': installEditTemplates, 'showEditModal': showEditModal }); diff --git a/cms/static/js/views/xblock_editor.js b/cms/static/js/views/xblock_editor.js index 38f8df1371bf..336d2fef1e91 100644 --- a/cms/static/js/views/xblock_editor.js +++ b/cms/static/js/views/xblock_editor.js @@ -85,8 +85,7 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification", "js }, save: function(options) { - var xblock = this.xblock, - xblockInfo = this.model, + var xblockInfo = this.model, data, saving; data = this.getXBlockData(); @@ -131,14 +130,14 @@ define(["jquery", "underscore", "gettext", "js/views/feedback_notification", "js // Walk through the set of elements which have the 'data-metadata_name' attribute and // build up an object to pass back to the server on the subsequent POST. // Note that these values will always be sent back on POST, even if they did not actually change. - var metadata = {}, - metadataNameElements; + var metadata, metadataNameElements, i, element, metadataName; + metadata = {}; metadataNameElements = this.$('[data-metadata-name]'); - metadataNameElements.each(function (element) { - var key = $(element).data("metadata-name"), - value = element.value; - metadata[key] = value; - }); + for (i = 0; i < metadataNameElements.length; i++) { + element = metadataNameElements[i]; + metadataName = $(element).data("metadata-name"); + metadata[metadataName] = element.value; + } return metadata; }, diff --git a/cms/templates/container.html b/cms/templates/container.html index 77917aa343f4..f3f7f292c58e 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -32,12 +32,12 @@
    From d55ad61801cde33fa9490c92b57b353c3979286e Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Wed, 9 Apr 2014 10:59:51 -0400 Subject: [PATCH 21/25] Make the LaText source compiler link visible --- cms/static/sass/elements/_modal-window.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/static/sass/elements/_modal-window.scss b/cms/static/sass/elements/_modal-window.scss index 7efff97f7abe..f07042270947 100644 --- a/cms/static/sass/elements/_modal-window.scss +++ b/cms/static/sass/elements/_modal-window.scss @@ -173,7 +173,7 @@ .modal-window { .CodeMirror { - height: 100%; + height: 390px; } .wrapper-comp-settings { From a3e26e682436fbcc37fd751f8c3b078d8da66a79 Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Wed, 9 Apr 2014 12:15:38 -0400 Subject: [PATCH 22/25] Implement next round of code reviews --- .../contentstore/views/component.py | 1 - .../views/tests/test_container.py | 31 +- .../js/spec/views/pages/container_spec.js | 29 +- .../js/spec/views/xblock_editor_spec.js | 12 +- cms/static/js/spec/views/xblock_spec.js | 2 +- cms/static/js/spec_helpers/edit_helpers.js | 16 - cms/static/js/views/course_info_handout.js | 4 +- cms/static/js/views/course_info_update.js | 4 +- cms/static/js/views/list_textbooks.js | 4 +- cms/static/js/views/modals/edit_xblock.js | 12 +- cms/static/js/views/paging_footer.js | 2 +- cms/static/js/views/paging_header.js | 2 +- cms/static/sass/elements/_modal-window.scss | 2 +- .../js/mock/mock-container-xblock.underscore | 385 +++++------------- cms/templates/unit.html | 4 +- 15 files changed, 169 insertions(+), 341 deletions(-) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 82039520095b..425b33035326 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -273,7 +273,6 @@ def unit_handler(request, tag=None, package_id=None, branch=None, version_guid=N 'context_course': course, 'unit': item, 'unit_locator': locator, - 'xblocks': xblocks, 'locators': locators, 'component_templates': component_templates, 'draft_preview_link': preview_lms_link, diff --git a/cms/djangoapps/contentstore/views/tests/test_container.py b/cms/djangoapps/contentstore/views/tests/test_container.py index fefc19ea2100..3c19efc896f8 100644 --- a/cms/djangoapps/contentstore/views/tests/test_container.py +++ b/cms/djangoapps/contentstore/views/tests/test_container.py @@ -5,6 +5,7 @@ from contentstore.tests.utils import CourseTestCase from contentstore.utils import compute_publish_state, PublishState from contentstore.views.helpers import xblock_studio_url +from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.factories import ItemFactory @@ -47,13 +48,33 @@ def test_container_on_container_html(self): Create the scenario of an xblock with children (non-vertical) on the container page. This should create a container page that is a child of another container page. """ - xblock_with_child = ItemFactory.create(parent_location=self.child_vertical.location, - category="wrapper", display_name="Wrapper") - ItemFactory.create(parent_location=xblock_with_child.location, - category="html", display_name="Child HTML") + published_xblock_with_child = ItemFactory.create( + parent_location=self.child_vertical.location, + category="wrapper", display_name="Wrapper" + ) + ItemFactory.create( + parent_location=published_xblock_with_child.location, + category="html", display_name="Child HTML" + ) + draft_xblock_with_child = modulestore('draft').convert_to_draft(published_xblock_with_child.location) branch_name = "MITx.999.Robot_Super_Course/branch/draft/block" self._test_html_content( - xblock_with_child, + published_xblock_with_child, + branch_name=branch_name, + expected_section_tag=( + ' - - - - - - + + - \ No newline at end of file diff --git a/cms/templates/unit.html b/cms/templates/unit.html index 4602b28e732b..bc92ffced4f4 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -60,8 +60,8 @@

      - % for (locator, xblock) in zip(locators, xblocks): -
    1. + % for locator in locators: +
    2. % endfor
    3. From b78508a1f90a0c7ff37666fb14ff83393fffb78c Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Wed, 9 Apr 2014 13:33:01 -0400 Subject: [PATCH 23/25] Indicate LaTex problems with a specific class on the editor --- cms/templates/widgets/problem-edit.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cms/templates/widgets/problem-edit.html b/cms/templates/widgets/problem-edit.html index 6611a04ebf9a..5c3190d0e00b 100644 --- a/cms/templates/widgets/problem-edit.html +++ b/cms/templates/widgets/problem-edit.html @@ -1,7 +1,13 @@ <%! from django.utils.translation import ugettext as _ %> <%namespace name='static' file='../static_content.html'/> +<% isLaTexProblem='source_code' in editable_metadata_fields and editable_metadata_fields['source_code']['explicitly_set'] and enable_latex_compiler %> + +% if isLaTexProblem: +
      +% else:
      +% endif
      %if enable_markdown: From 2bf64d76d79e5ce5bac0933fd56aae64a501ca8b Mon Sep 17 00:00:00 2001 From: Andy Armstrong Date: Wed, 9 Apr 2014 13:52:21 -0400 Subject: [PATCH 24/25] Remove feature flag for testing on container pages --- .../features/component_settings_editor_helpers.py | 5 ----- cms/envs/common.py | 3 --- 2 files changed, 8 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 9ed04277300b..85bffed9d968 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -55,11 +55,6 @@ def click_new_component_button(step, component_button_css): world.css_click(component_button_css) - if FEATURES['USE_CONTAINER_PAGE_FOR_TESTING']: - unit_url = world.browser.url - container_url = unit_url.replace('/unit/', '/container/') - world.visit(container_url) - def _click_advanced(): css = 'ul.problem-type-tabs a[href="#tab2"]' diff --git a/cms/envs/common.py b/cms/envs/common.py index a4b3a9ae62d7..022e9dd94b4b 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -99,9 +99,6 @@ # Turn off Advanced Security by default 'ADVANCED_SECURITY': False, - - # Switch acceptance tests to use the container page instead of the unit page - 'USE_CONTAINER_PAGE_FOR_TESTING': False, } ENABLE_JASMINE = False From df0973e7710ee261e184947d07bc5804b3494019 Mon Sep 17 00:00:00 2001 From: Frances Botsford Date: Wed, 9 Apr 2014 16:26:29 -0400 Subject: [PATCH 25/25] addressing review feedback --- .../js/views/video/translations_editor.js | 2 +- cms/static/sass/elements/_modal-window.scss | 29 ++++++++++++------- cms/static/sass/elements/_xblocks.scss | 4 +++ cms/static/sass/views/_container.scss | 2 ++ cms/static/sass/views/_unit.scss | 15 +++++----- cms/templates/overview.html | 2 +- cms/templates/widgets/source-edit.html | 2 +- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/cms/static/js/views/video/translations_editor.js b/cms/static/js/views/video/translations_editor.js index d2fc79c6e79e..75e2a01c3941 100644 --- a/cms/static/js/views/video/translations_editor.js +++ b/cms/static/js/views/video/translations_editor.js @@ -145,7 +145,7 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) { target = $(event.currentTarget), lang = target.data('lang'), model = new FileUpload({ - title: gettext('Upload translation.'), + title: gettext('Upload translation'), fileFormats: ['srt'] }), view = new VideoUploadDialog({ diff --git a/cms/static/sass/elements/_modal-window.scss b/cms/static/sass/elements/_modal-window.scss index 7efff97f7abe..9c0645fa9547 100644 --- a/cms/static/sass/elements/_modal-window.scss +++ b/cms/static/sass/elements/_modal-window.scss @@ -17,6 +17,7 @@ text-align: left; .modal-content { + position: relative; box-shadow: 0 0 3px $shadow-d1; background-color: $white; padding: 5%; @@ -106,6 +107,7 @@ // large modals - component editors and interactives .modal-lg { width: 75%; + min-width: ($baseline*27.5); height: auto; &.modal-editor { @@ -114,12 +116,12 @@ margin: ($baseline/4) ($baseline/2); .title { - width: 48%; + width: 47%; display: inline-block; } .editor-modes { - width: 49%; + width: 48%; display: inline-block; text-align: right; @@ -173,7 +175,7 @@ .modal-window { .CodeMirror { - height: 100%; + height: 365px; } .wrapper-comp-settings { @@ -205,29 +207,34 @@ left: 10% !important; } - .modal-content { - padding: 2%; + .modal-header { + margin: ($baseline/2) 2%; .title { width: auto; + margin: 0 0 ($baseline/4) 0; } .editor-modes { display: none; } + } - input[type="file"] { - margin: $baseline 0; - } + .modal-content { + padding: 2%; .message { - margin: 0 0 $baseline 0; + margin: 0 ($baseline/4) ($baseline/4) ($baseline/4); } - .modal-actions { - padding: ($baseline/2) 0; + input[type="file"] { + margin: 0; } } + + .modal-actions { + padding: ($baseline/2) 0; + } } } diff --git a/cms/static/sass/elements/_xblocks.scss b/cms/static/sass/elements/_xblocks.scss index 5306e3e92865..38157c8aa0b7 100644 --- a/cms/static/sass/elements/_xblocks.scss +++ b/cms/static/sass/elements/_xblocks.scss @@ -61,6 +61,10 @@ margin: 0 ($baseline/4); height: ($baseline*1.25); width: $baseline; + + &:focus { + outline: 0; + } } .action-view { diff --git a/cms/static/sass/views/_container.scss b/cms/static/sass/views/_container.scss index 1275bcac0e68..a6a9147b8781 100644 --- a/cms/static/sass/views/_container.scss +++ b/cms/static/sass/views/_container.scss @@ -30,6 +30,8 @@ body.view-container { .content-primary { margin-right: flex-gutter(); width: flex-grid(9,12); + box-shadow: none; + border: 0; .no-container-content { @extend %ui-well; diff --git a/cms/static/sass/views/_unit.scss b/cms/static/sass/views/_unit.scss index 6a3a7582ef72..e2ff0a5b6237 100644 --- a/cms/static/sass/views/_unit.scss +++ b/cms/static/sass/views/_unit.scss @@ -1313,17 +1313,18 @@ body.unit { // ==================== // Latex Compiler + +.wrapper-comp-editor.latex-problem { + margin-top: ($baseline*2.5); +} + .launch-latex-compiler { + position: absolute; + width: 100%; + top: 0; background-color: $white; padding: $baseline/2 0 $baseline/2 $baseline; border-bottom: 1px solid $gray-l2; - opacity: 0.8; - - - &:hover { - @include transition(opacity $tmg-f2 ease-in-out 0s); - opacity: 1.0s; - } } // hides latex compiler button if settings mode is-active diff --git a/cms/templates/overview.html b/cms/templates/overview.html index 68dd966a1461..7e9fa5f8c504 100644 --- a/cms/templates/overview.html +++ b/cms/templates/overview.html @@ -293,7 +293,7 @@

      ${_("Section Release Date")}<

    4. - +
    5. diff --git a/cms/templates/widgets/source-edit.html b/cms/templates/widgets/source-edit.html index fda097063bcf..30d0aaee2f07 100644 --- a/cms/templates/widgets/source-edit.html +++ b/cms/templates/widgets/source-edit.html @@ -48,7 +48,7 @@

      High Level Source Editing

      ## cannot do this with css or it gets overwritten var editorH = $( window ).height() - 100; var editorW = $( window ).innerWidth() - 70; - hlsmodal.attr('style', function(i,s) { return s + 'margin: 2% 0 0 10% !important; left:0; height:' + editorH + 'px;'}); + hlsmodal.attr('style', function(i,s) { return s + 'margin: 2% 0 0 10% !important; left:10%; height:' + editorH + 'px;'}); ## setup file input ## need to insert this only after hls triggered, because otherwise it