feat: allow license library content edit (#139)

* feat: allow license library content edit
This commit is contained in:
Raymond Zhou
2022-11-03 16:58:22 -07:00
committed by GitHub
parent 5f5250fd2c
commit b4b31794af
4 changed files with 36 additions and 8 deletions

View File

@@ -29,7 +29,7 @@ export const LicenseDetails = ({
// redux
updateField,
}) => (
level === LicenseLevel.block && details && license !== 'select' ? (
level !== LicenseLevel.course && details && license !== 'select' ? (
<div className="border-primary-100 border-top pb-3">
<Form.Group>
<Form.Label className="mt-3">
@@ -81,7 +81,7 @@ export const LicenseDetails = ({
actions={(
<Form.Checkbox
checked={details.noncommercial}
disabled={level !== LicenseLevel.block}
disabled={level === LicenseLevel.course}
onChange={(e) => updateField({
licenseDetails: {
...details,
@@ -116,7 +116,7 @@ export const LicenseDetails = ({
actions={(
<Form.Checkbox
checked={details.noDerivatives}
disabled={level !== LicenseLevel.block}
disabled={level === LicenseLevel.course}
onChange={(e) => updateField({
licenseDetails: {
...details,
@@ -152,7 +152,7 @@ export const LicenseDetails = ({
actions={(
<Form.Checkbox
checked={details.shareAlike}
disabled={level !== LicenseLevel.block}
disabled={level === LicenseLevel.course}
onChange={(e) => updateField({
licenseDetails: {
...details,

View File

@@ -37,7 +37,7 @@ export const LicenseSelector = ({
as="select"
ref={ref}
defaultValue={license}
disabled={level !== LicenseLevel.block}
disabled={level === LicenseLevel.course}
floatingLabel={intl.formatMessage(messages.licenseTypeLabel)}
onChange={(e) => onLicenseChange(e.target.value)}
>
@@ -47,7 +47,7 @@ export const LicenseSelector = ({
return (<option value={LicenseTypes[key]}>{text}</option>);
})}
</Form.Control>
{level === LicenseLevel.block ? (
{level !== LicenseLevel.course ? (
<IconButtonWithTooltip
iconAs={Icon}
src={Delete}

View File

@@ -176,4 +176,20 @@ exports[`LicenseDetails snapshots snapshots: renders as expected with level set
exports[`LicenseDetails snapshots snapshots: renders as expected with level set to block and license set to select 1`] = `""`;
exports[`LicenseDetails snapshots snapshots: renders as expected with level set to library 1`] = `""`;
exports[`LicenseDetails snapshots snapshots: renders as expected with level set to library 1`] = `
<div
className="border-primary-100 border-top pb-3"
>
<Form.Group>
<Form.Label
className="mt-3"
>
<FormattedMessage
defaultMessage="License Details"
description="Title for license detatils subsection"
id="authoring.videoeditor.license.detailsSubsection.title"
/>
</Form.Label>
</Form.Group>
</div>
`;

View File

@@ -104,7 +104,7 @@ exports[`LicenseSelector snapshots snapshots: renders as expected with library l
<Form.Control
as="select"
defaultValue="all-rights-reserved"
disabled={true}
disabled={false}
floatingLabel="License Type"
onChange={[Function]}
>
@@ -124,6 +124,18 @@ exports[`LicenseSelector snapshots snapshots: renders as expected with library l
Creative Commons
</option>
</Form.Control>
<IconButtonWithTooltip
iconAs="Icon"
onClick={[Function]}
tooltipContent={
<FormattedMessage
defaultMessage="Delete"
description="Message presented to user for action to delete license selection"
id="authoring.videoeditor.license.deleteLicenseSelection"
/>
}
tooltipPlacement="top"
/>
</Form.Row>
<Form.Text>
<FormattedMessage