Skip to content

Commit

Permalink
feat: hide 2U specific fields
Browse files Browse the repository at this point in the history
Few 2U specific fields are appearing for all types of the course(s)
which is creating confusion for the partners.Due to this change,
2U fields would only be displayed for 2U courses

PROD-3032
  • Loading branch information
uzairr committed Nov 23, 2022
1 parent 5792440 commit a9aa6fb
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 309 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODE_ENV='production'
IDENTIFIER_2U='2U'
BASE_URL=null
LMS_BASE_URL=null
STUDIO_BASE_URL=null
Expand Down
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NODE_ENV='development'
IDENTIFIER_2U='2U'
PORT=18400
BASE_URL='localhost:18400'
LMS_BASE_URL='http://localhost:18000'
Expand Down
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ LOGO_TRADEMARK_URL=https://edx-cdn.org/v3/default/logo-trademark.svg
LOGO_WHITE_URL=https://edx-cdn.org/v3/default/logo-white.svg
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
SITE_NAME='edX'
IDENTIFIER_2U='2U'
64 changes: 37 additions & 27 deletions src/components/EditCoursePage/EditCourseForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { getConfig } from '@edx/frontend-platform';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { Icon, Hyperlink, Chip } from '@edx/paragon';
import { CloseSmall } from '@edx/paragon/icons';
Expand Down Expand Up @@ -226,6 +227,10 @@ export class BaseEditCourseForm extends React.Component {
this.setCollapsible(true);
}

filterCourseTypes2U(courseType) {
return courseType.label.includes(getConfig().IDENTIFIER_2U);
}

render() {
const {
handleSubmit,
Expand Down Expand Up @@ -306,6 +311,7 @@ export class BaseEditCourseForm extends React.Component {
priceLabels,
runTypeModes,
} = parsedTypeOptions;
const courseTypes2U = courseTypeOptions.filter(this.filterCourseTypes2U);
const disabled = courseInReview || !editable;
const showMarketingFields = !currentFormValues.type || !courseTypes[currentFormValues.type]
|| courseTypes[currentFormValues.type].course_run_types.some((crt) => crt.is_marketable);
Expand Down Expand Up @@ -1046,34 +1052,38 @@ export class BaseEditCourseForm extends React.Component {
className="course-skill"
/>
)}
<Field
name="organization_short_code_override"
component={RenderInputTextField}
label={
<FieldLabel text="Organization Short Code Override" optional />
}
extraInput={{ onInvalid: this.openCollapsible }}
disabled={disabled}
optional
/>
<Field
name="organization_logo_override_url"
component={ImageUpload}
label={(
<FieldLabel
id="organization_logo_override.label"
text="Organization Logo Override"
{courseTypes2U?.length > 0 && (
<>
<Field
name="organization_short_code_override"
component={RenderInputTextField}
label={
<FieldLabel text="Organization Short Code Override" optional />
}
extraInput={{ onInvalid: this.openCollapsible }}
disabled={disabled}
optional
/>
)}
extraInput={{ onInvalid: this.openCollapsible }}
id="organization-logo-override"
className="course-image"
maxImageSizeKilo={256}
requiredWidth={110}
requiredHeight={110}
disabled={disabled}
optional
/>
<Field
name="organization_logo_override_url"
component={ImageUpload}
label={(
<FieldLabel
id="organization_logo_override.label"
text="Organization Logo Override"
/>
)}
extraInput={{ onInvalid: this.openCollapsible }}
id="organization-logo-override"
className="course-image"
maxImageSizeKilo={256}
requiredWidth={110}
requiredHeight={110}
disabled={disabled}
optional
/>
</>
)}
{administrator && (
<>
<FieldLabel text="Merchandising Location Restriction" className="mb-2" />
Expand Down
Loading

0 comments on commit a9aa6fb

Please sign in to comment.