-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add export course tags menu #830
Changes from 3 commits
db898a8
873b902
c4c7daa
effca98
20727dc
d0b1bec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,9 +64,20 @@ export const getToolsMenuItems = ({ studioBaseUrl, courseId, intl }) => ([ | |
title: intl.formatMessage(messages['header.links.import']), | ||
}, | ||
{ | ||
href: `${studioBaseUrl}/export/${courseId}`, | ||
title: intl.formatMessage(messages['header.links.export']), | ||
}, { | ||
href: `${studioBaseUrl}/import/${courseId}`, | ||
title: intl.formatMessage( | ||
getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true' | ||
? messages['header.links.exportCourse'] | ||
: messages['header.links.export'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm.. I'm not sure we need to do this? But I'm not sure who to ask.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did this to avoid changing the menu for everyone without ENABLE_TAGGING_TAXONOMY_PAGES. But I'm also not sure if we need this. Let's see if we have some comments in the Upstream/CC review. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine to change the base menu text ("Export" -> "Export Course"), and I think that's better than having this more complex logic. The "Export Tags" should be gated by the flag though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done: 20727dc |
||
), | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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']), | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { getConfig, setConfig } from '@edx/frontend-platform'; | ||
import { getContentMenuItems } from './utils'; | ||
import { getContentMenuItems, getToolsMenuItems } from './utils'; | ||
|
||
const props = { | ||
studioBaseUrl: 'UrLSTuiO', | ||
|
@@ -28,4 +28,22 @@ describe('header utils', () => { | |
expect(actualItems).toHaveLength(4); | ||
}); | ||
}); | ||
describe('getToolsMenuItems', () => { | ||
it('should include export tags option', () => { | ||
setConfig({ | ||
...getConfig(), | ||
ENABLE_TAGGING_TAXONOMY_PAGES: 'true', | ||
}); | ||
const actualItems = getToolsMenuItems(props); | ||
expect(actualItems).toHaveLength(4); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please test that the items shown are the items we expect (instead of just checking the length)? It's ok to just check their titles. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! Done: effca98 |
||
}); | ||
it('should not include export tags option', () => { | ||
setConfig({ | ||
...getConfig(), | ||
ENABLE_TAGGING_TAXONOMY_PAGES: 'false', | ||
}); | ||
const actualItems = getToolsMenuItems(props); | ||
expect(actualItems).toHaveLength(3); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path seems to point to
import
, however the title seems to be for export.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @xitij2000 !
Fixed here: d0b1bec