Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/header/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ const messages = defineMessages({
defaultMessage: 'Import',
description: 'Link to Studio Import page',
},
'header.links.export': {
id: 'header.links.export',
defaultMessage: 'Export',
'header.links.exportCourse': {
id: 'header.links.exportCourse',
defaultMessage: 'Export Course',
description: 'Link to Studio Export page',
},
'header.links.exportTags': {
id: 'header.links.exportTags',
defaultMessage: 'Export Tags',
description: 'Download course content tags as CSV',
},
'header.links.checklists': {
id: 'header.links.checklists',
defaultMessage: 'Checklists',
Expand Down
11 changes: 9 additions & 2 deletions src/header/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,15 @@ export const getToolsMenuItems = ({ studioBaseUrl, courseId, intl }) => ([
},
{
href: `${studioBaseUrl}/export/${courseId}`,
title: intl.formatMessage(messages['header.links.export']),
}, {
title: intl.formatMessage(messages['header.links.exportCourse']),
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inclusion of this menu item needs to be gated by the same flags that we gate the other taxonomy menu items, which also means it needs tests added like these.

...(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true'
? [{
href: `${studioBaseUrl}/api/content_tagging/v1/object_tags/${courseId}/export/`,
title: intl.formatMessage(messages['header.links.exportTags']),
}] : []
),
{
href: `${studioBaseUrl}/checklists/${courseId}`,
title: intl.formatMessage(messages['header.links.checklists']),
},
Expand Down
32 changes: 30 additions & 2 deletions src/header/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getConfig, setConfig } from '@edx/frontend-platform';
import { getContentMenuItems } from './utils';
import { getContentMenuItems, getToolsMenuItems } from './utils';

const props = {
studioBaseUrl: 'UrLSTuiO',
courseId: '123',
intl: {
formatMessage: jest.fn(),
formatMessage: jest.fn(message => message.defaultMessage),
},
};

Expand All @@ -28,4 +28,32 @@ describe('header utils', () => {
expect(actualItems).toHaveLength(4);
});
});

describe('getToolsMenuItems', () => {
it('should include export tags option', () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
});
const actualItemsTitle = getToolsMenuItems(props).map((item) => item.title);
expect(actualItemsTitle).toEqual([
'Import',
'Export Course',
'Export Tags',
'Checklists',
]);
});
it('should not include export tags option', () => {
setConfig({
...getConfig(),
ENABLE_TAGGING_TAXONOMY_PAGES: 'false',
});
const actualItemsTitle = getToolsMenuItems(props).map((item) => item.title);
expect(actualItemsTitle).toEqual([
'Import',
'Export Course',
'Checklists',
]);
});
});
});