Commit a78dad77 by David Baumgold

Pass component display name to Mako template

STUD-1241
parent 830ad942
...@@ -112,3 +112,10 @@ Feature: CMS.Component Adding ...@@ -112,3 +112,10 @@ Feature: CMS.Component Adding
Then I see a Problem component with display name "Blank Common Problem" in position "0" Then I see a Problem component with display name "Blank Common Problem" in position "0"
And I see a Problem component with display name "Duplicate of 'Blank Common Problem'" in position "1" And I see a Problem component with display name "Duplicate of 'Blank Common Problem'" in position "1"
And I see a Problem component with display name "Multiple Choice" in position "2" And I see a Problem component with display name "Multiple Choice" in position "2"
Scenario: I can set the display name of a component
Given I am in Studio editing a new unit
When I add a "Text" "HTML" component
Then I see the display name is "Text"
When I change the display name to "I'm the Cuddliest!"
Then I see the display name is "I'm the Cuddliest!"
...@@ -154,3 +154,16 @@ def see_component_in_position(step, display_name, index): ...@@ -154,3 +154,16 @@ def see_component_in_position(step, display_name, index):
return world.css_text(component_css, int(index)).startswith(display_name.upper()) return world.css_text(component_css, int(index)).startswith(display_name.upper())
world.wait_for(find_problem, timeout_msg='Did not find the duplicated problem') world.wait_for(find_problem, timeout_msg='Did not find the duplicated problem')
@step(u'I see the display name is "([^"]*)"')
def check_component_display_name(step, display_name):
label = world.css_text(".component-header")
assert display_name == label
@step(u'I change the display name to "([^"]*)"')
def change_display_name(step, display_name):
world.edit_component_and_select_settings()
world.css_fill("ul.settings-list li:first-child input", display_name)
world.save_component(step)
...@@ -113,7 +113,8 @@ def xblock_handler(request, tag=None, package_id=None, branch=None, version_guid ...@@ -113,7 +113,8 @@ def xblock_handler(request, tag=None, package_id=None, branch=None, version_guid
return render_to_response('component.html', { return render_to_response('component.html', {
'preview': get_preview_html(request, component), 'preview': get_preview_html(request, component),
'editor': content 'editor': content,
'display_name': component.display_name,
}) })
elif request.method == 'DELETE': elif request.method == 'DELETE':
delete_children = str_to_bool(request.REQUEST.get('recurse', 'False')) delete_children = str_to_bool(request.REQUEST.get('recurse', 'False'))
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
</div> </div>
<div class="wrapper wrapper-component-action-header"> <div class="wrapper wrapper-component-action-header">
<div class="component-header"> <div class="component-header">
${display_name}
</div> </div>
<ul class="component-actions"> <ul class="component-actions">
<li class="action-item action-edit"> <li class="action-item action-edit">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment