Skip to content
Snippets Groups Projects
Commit 3456dade authored by Martin Burchell's avatar Martin Burchell
Browse files

Removed "Remove Question Type" from rumor/all tabs

Only display the Remove Question Type menu item on pages where the
question type can be set.
parent 7070714a
No related branches found
No related tags found
1 merge request!31Uncategorise
......@@ -157,14 +157,18 @@ class ViewAndEditTableTab(object):
})
# Build the actions drop down
items = [
(NONE_COMMAND, '---------'),
(DELETE_COMMAND, _('Delete Selected')),
]
if len(question_types) > 0:
items.append((REMOVE_QTYPE_COMMAND, _('Remove Question Type')),)
actions = [
self._build_action_dropdown_group(
label=_('Actions'),
items=[
(NONE_COMMAND, '---------'),
(DELETE_COMMAND, _('Delete Selected')),
(REMOVE_QTYPE_COMMAND, _('Remove Question Type'))
]
items=items
)
]
......
......@@ -230,6 +230,21 @@ def test_actions_includes_remove_question_type_option():
assert 'remove-question-type' in actions['items']
@pytest.mark.django_db
def test_actions_excludes_remove_question_type_option_for_no_categories():
page = TabbedPageFactory()
tab_instance = TabInstanceFactory(page=page)
request = Mock(GET={})
tab = ViewAndEditTableTab()
context_data = tab.get_context_data(tab_instance,
request)
actions = context_data['actions'][0]
assert actions['label'] == 'Actions'
assert 'remove-question-type' not in actions['items']
@pytest.mark.django_db
def test_upload_form_source_read_from_settings():
page = TabbedPageFactory()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment