Skip to content

Commit

Permalink
feat: allow license library content edit (#139)
Browse files Browse the repository at this point in the history
* feat: allow license library content edit
  • Loading branch information
rayzhou-bit authored Nov 3, 2022
1 parent 5f5250f commit b4b3179
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
>
Expand All @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
>
Expand All @@ -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
Expand Down

0 comments on commit b4b3179

Please sign in to comment.