diff --git a/src/components/EditCoursePage/EditCourseForm.jsx b/src/components/EditCoursePage/EditCourseForm.jsx index f442ac5bf..1038f7dee 100644 --- a/src/components/EditCoursePage/EditCourseForm.jsx +++ b/src/components/EditCoursePage/EditCourseForm.jsx @@ -283,8 +283,16 @@ export class BaseEditCourseForm extends React.Component { runTypeModes, } = parsedTypeOptions; const disabled = courseInReview || !editable; - const showMarketingFields = !currentFormValues.type || !courseTypes[currentFormValues.type] - || courseTypes[currentFormValues.type].course_run_types.some((crt) => crt.is_marketable); + + function isMarketingFieldsVisible(currentFormValuesType, courseTypesDict) { + /** + * Check if the course type is defined in the courseTypes object and if any of the course run types are marketable + */ + return (currentFormValuesType && courseTypesDict[currentFormValuesType]) === undefined ? false + : courseTypesDict[currentFormValuesType].course_run_types.some((crt) => crt.is_marketable); + } + + const showMarketingFields = isMarketingFieldsVisible(currentFormValues.type, courseTypes); const courseIsPristine = isPristine(initialValues, currentFormValues); const publishedContentChanged = initialValues.course_runs diff --git a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap index 3d40fe359..9fe29d9c4 100644 --- a/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap +++ b/src/components/EditCoursePage/__snapshots__/EditCourseForm.test.jsx.snap @@ -8055,59 +8055,61 @@ exports[`BaseEditCourseForm renders html correctly with minimal data 1`] = ` "onInvalid": [Function], } } - id="sdesc" label={ -

- An effective short description: -

- -

- - Learn more. - -

-

- - Example: - -

-

- The first MOOC to teach positive psychology. Learn science-based principles and practices for a happy, meaningful life. -

+
+
+ Introductory +
+
+ No prerequisites; a learner who has completed some or all secondary school could complete the course. +
+
+ Intermediate +
+
+ Basic prerequisites; learners need to complete secondary school or some university courses. +
+
+ Advanced +
+
+ Significant prerequisites; the course is geared to third or fourth year university students or master’s degree students. +
+
} - id="sdesc.label" + id="level.label" optional={false} - text="Short description" + text="Course level" /> } - maxChars={500} - name="short_description" + name="level_type" + options={ + Array [ + Object { + "label": "--", + "value": "", + }, + Object { + "label": "Beginner", + "value": "beginner", + }, + Object { + "label": "Intermediate", + "value": "intermediate", + }, + Object { + "label": "Advanced", + "value": "advanced", + }, + ] + } + required={false} />

- An effective long description: + The subject of the course.

-

- The first four lines are visible when the About page opens. Learners can select “See More” to view the full description. + You can select up to two subjects in addition to the primary subject. Only the primary subject appears on the About page.

@@ -8158,13 +8142,37 @@ exports[`BaseEditCourseForm renders html correctly with minimal data 1`] = `

} - id="ldesc.label" + id="subject1.label" optional={false} - text="Long description" + text="Primary subject" /> } - maxChars={2500} - name="full_description" + name="subjectPrimary" + options={ + Array [ + Object { + "label": "--", + "value": "", + }, + Object { + "label": "Business", + "value": "business", + }, + Object { + "label": "Chemistry", + "value": "chemistry", + }, + Object { + "label": "English", + "value": "english", + }, + Object { + "label": "Security", + "value": "security", + }, + ] + } + required={false} /> -

- The skills and knowledge learners will acquire in this course. -

-

- Format each item as a bullet with four to ten words. -

-

- - Example: - -

-
    -
  • - Basic R Programming -
  • -
  • - An applied understanding of linear and logistic regression -
  • -
  • - Application of text analytics -
  • -
  • - Linear and integer optimization -
  • -
-

- - Learn more. - -

- - } - id="outcome.label" - optional={false} - text="What you will learn" + helpText="" + id={null} + optional={true} + text="Secondary subject" /> } - maxChars={2500} - name="outcome" + name="subjectSecondary" + optional={true} + options={ + Array [ + Object { + "label": "--", + "value": "", + }, + Object { + "label": "Business", + "value": "business", + }, + Object { + "label": "Chemistry", + "value": "chemistry", + }, + Object { + "label": "English", + "value": "english", + }, + Object { + "label": "Security", + "value": "security", + }, + ] + } /> -

- A review of content covered in your course, organized by week or module. -

-
    -
  • - Focus on topics and content. -
  • -
  • - Do not include detailed information about course logistics, such as grading, communication policies, and reading lists. -
  • -
  • - Format items as either paragraphs or a bulleted list. -
  • -
-

- - Learn more. - -

-

- - Example: - -

-
    -
  • -

    - Week 1: From Calculator to Computer -

    -

    - Introduction to basic programming concepts, such as values and expressions, as well as making decisions when implementing algorithms and developing programs. -

    -
  • -
  • -

    - Week 2: State Transformation -

    -

    - Introduction to state transformation, including representation of data and programs as well as conditional repetition. -

    -
  • -
- - } - id="syllabus.label" + helpText="" + id={null} optional={true} - text="Syllabus" + text="Tertiary subject" /> } - maxChars={500} - name="syllabus_raw" - /> - -

- Specific knowledge learners must have to be successful in the course. If the course has no prerequisites, enter “None”. -

-

- - Learn more. - -

-

- - Examples: - -

-
    -
  • - Secondary school (high school) algebra; basic mathematics concepts -
  • -
  • - Graduate-level understanding of Keynesian economics -
  • -
  • - Basic algebra -
  • -
- - } - id="prereq.label" - optional={true} - text="Prerequisites" - /> + name="subjectTertiary" + optional={true} + options={ + Array [ + Object { + "label": "--", + "value": "", + }, + Object { + "label": "Business", + "value": "business", + }, + Object { + "label": "Chemistry", + "value": "chemistry", + }, + Object { + "label": "English", + "value": "english", + }, + Object { + "label": "Security", + "value": "security", + }, + ] } - maxChars={1000} - name="prerequisites_raw" /> -

- A quote from a learner in the course, demonstrating the value of taking the course. -

-

- Should be no more than 25–50 words in length. -

-

- - Learn more. - -

-

- - Example: - -

-

- “Brilliant course! It’s definitely the best introduction to electronics in the world! Interesting material, clean explanations, well prepared quizzes, challenging homework, and fun labs.” – Previous Student -

- - } - id="testimonials.label" + helpText="" + id={null} optional={true} - text="Learner testimonials" + text="Organization Short Code Override" /> } - maxChars={500} - name="learner_testimonials" + name="organization_short_code_override" + optional={true} /> -

- Any frequently asked questions and the answers to those questions. -

-

- - Learn more. - -

-

- - Example: - -

- - Do I need to know any programming languages before I start? - -

- No, this course is designed for beginners. -

- - What version of Swift will I be learning? - -

- Swift version 4. -

- - } - id="faq.label" - optional={true} - text="Frequently asked questions" + helpText="" + id="organization_logo_override.label" + optional={false} + text="Organization Logo Override" /> } - maxChars={2500} - name="faq" + maxImageSizeKilo={256} + name="organization_logo_override_url" + optional={true} + requiredHeight={110} + requiredWidth={110} /> -
- + + -
-
- Introductory -
-
- No prerequisites; a learner who has completed some or all secondary school could complete the course. -
-
- Intermediate -
-
- Basic prerequisites; learners need to complete secondary school or some university courses. -
-
- Advanced -
-
- Significant prerequisites; the course is geared to third or fourth year university students or master’s degree students. -
-
- - } - id="level.label" - optional={false} - text="Course level" - /> - } - name="level_type" - options={ - Array [ - Object { - "label": "--", - "value": "", - }, - Object { - "label": "Beginner", - "value": "beginner", - }, - Object { - "label": "Intermediate", - "value": "intermediate", - }, - Object { - "label": "Advanced", - "value": "advanced", - }, - ] - } - required={false} - /> - -

- The subject of the course. -

-

- You can select up to two subjects in addition to the primary subject. Only the primary subject appears on the About page. -

-

- - Learn more. - -

- - } - id="subject1.label" - optional={false} - text="Primary subject" - /> - } - name="subjectPrimary" - options={ - Array [ - Object { - "label": "--", - "value": "", - }, - Object { - "label": "Business", - "value": "business", - }, - Object { - "label": "Chemistry", - "value": "chemistry", - }, - Object { - "label": "English", - "value": "english", - }, - Object { - "label": "Security", - "value": "security", - }, - ] - } - required={false} - /> - - } - name="subjectSecondary" - optional={true} - options={ - Array [ - Object { - "label": "--", - "value": "", - }, - Object { - "label": "Business", - "value": "business", - }, - Object { - "label": "Chemistry", - "value": "chemistry", - }, - Object { - "label": "English", - "value": "english", - }, - Object { - "label": "Security", - "value": "security", - }, - ] - } - /> - - } - name="subjectTertiary" - optional={true} - options={ - Array [ - Object { - "label": "--", - "value": "", - }, - Object { - "label": "Business", - "value": "business", - }, - Object { - "label": "Chemistry", - "value": "chemistry", - }, - Object { - "label": "English", - "value": "english", - }, - Object { - "label": "Security", - "value": "security", - }, - ] - } - /> - - } - name="organization_short_code_override" - optional={true} - /> - - } - maxImageSizeKilo={256} - name="organization_logo_override_url" - optional={true} - requiredHeight={110} - requiredWidth={110} - /> - - - -
- No Preview Link Available -
- - } - > -
- - All fields are required for publication unless otherwise specified. - -
- -

- Maximum 70 characters. Recommended 50 or fewer characters. -

-

- An effective course title: -

-
    -
  • - Clearly indicates the course subject matter. -
  • -
  • - Follows search engine optimization (SEO) guidelines. -
  • -
  • - Targets a global audience. -
  • -
-

- - Learn more. - -

-

- - Example: - -

-

- English Grammar and Essay Writing -

- - } - id="title.label" - optional={false} - text="Title" - /> - } - name="title" - required={true} - type="text" - /> - -

- - Note: Course editors cannot edit the URL slug. Please reach out to your project coordinator or edX support to edit this field. - -

-

- This field is optional. If left blank, edX will automatically create a URL slug based on the course title. -

-

- If you find that a given URL slug is already in use, we recommend adding your school or institution name to the slug to ensure uniqueness. -

-

- This URL slug can be changed, and learners who visit an older URL will be redirected to the current URL. -

-

- - What is a URL slug? - -

-

- In the example URL www.edx.org/course/math-101, the URL slug is “math-101.” Using URL slugs that are short and easily understandable helps learners find and remember course pages, and also drives higher rankings in search engine results. -

- - } - id="slug.label" - optional={true} - text="URL slug" - /> - } - name="url_slug" - optional={true} - type="text" - /> -
- -

- The Product source is a key that identifies where the course originates. -

-

- - Example: - -

-

- If the course originates from the edX platform, the Product source is edX. -

-
- } - id="productSource" - optional={false} - text="Product Source" - /> -
- N/A -
- -
- -
- Test101x -
-
-
- -
-
- - - Date: - - - -
-
- - Time (UTC): - - -
-
-
- -

- The Course enrollment track determines what enrollment tracks are eligible for the course runs. -

-

- - Example: - -

-

- The Verified and Audit selection will allow course runs to either be Verified and Audit or Audit only. -

- - } - id="type.label" - optional={false} - text="Course enrollment track" - /> - } - name="type" - options={ - Array [ - Object { - "label": "Select enrollment track", - "value": "", - }, - Object { - "label": "Credit", - "value": "9521aa7d-801b-4a67-92c3-716ea30f5086", - }, - Object { - "label": "Masters Only", - "value": "7b41992e-f268-4331-8ba9-72acb0880454", - }, - Object { - "label": "Verified and Audit", - "value": "8a8f30e1-23ce-4ed3-a361-1325c656b67b", - }, - Object { - "label": "Professional Only", - "value": "fdde7d04-7ce0-4ff7-ac90-7f518e90ac1e", - }, - Object { - "label": "Audit Only", - "value": "03e09c15-4127-4031-bc02-e20fcbdf09f0", - }, - ] - } - /> - - -

- Course teams are responsible for securing any necessary permissions for use of third-party logos. -

-

- To elaborate on the support, please include additional information in the “About this course” section. Please avoid including statements that the course is jointly offered or that the 3rd party is collaborating or partnering with edX. -

- - } - id="collaborators.label" - optional={true} - text="Collaborators" - /> - - -

- An eye-catching, colorful image that captures the essence of your course. -

-
    -
  • - New course images must be 1134×675 pixels in size. -
  • -
  • - The image must be a JPEG or PNG file. -
  • -
  • - Each course must have a unique image. -
  • -
  • - The image cannot include text or headlines. -
  • -
  • - You must have permission to use the image. Possible image sources include Flickr creative commons, Stock Vault, Stock XCHNG, and iStock Photo. -
  • -
-

- - Learn more. - -

- - } - id="image.label" - optional={false} - text="Image" - /> - } - maxImageSizeKilo={1000} - name="imageSrc" - requiredHeight={675} - requiredWidth={1134} - /> - - You can add tags in the format mba-no-gmat,mba,mba_4_modules,mba_NY -

+ Array [ + "unpublished", + ] } - id="tags.label" - optional={true} - text="Topics" /> - } - loadOptions={[Function]} - name="tags" - optional={true} - /> -
+
+ No Preview Link Available +
+ + } + > +
+ + All fields are required for publication unless otherwise specified. + +

- An effective short description: + Maximum 70 characters. Recommended 50 or fewer characters. +

+

+ An effective course title:

  • - Contains 25–50 words. -
  • -
  • - Functions as a tagline. -
  • -
  • - Conveys compelling reasons to take the course. + Clearly indicates the course subject matter.
  • - Follows SEO guidelines. + Follows search engine optimization (SEO) guidelines.
  • Targets a global audience. @@ -9839,7 +9071,7 @@ exports[`BaseEditCourseForm renders html correctly with skills data when skills

@@ -9852,205 +9084,133 @@ exports[`BaseEditCourseForm renders html correctly with skills data when skills

- The first MOOC to teach positive psychology. Learn science-based principles and practices for a happy, meaningful life. -

- - } - id="sdesc.label" - optional={false} - text="Short description" - /> - } - maxChars={500} - name="short_description" - /> - -

- An effective long description: -

-
    -
  • - Contains 150–300 words. -
  • -
  • - Is easy to skim. -
  • -
  • - Uses bullet points instead of dense text paragraphs. -
  • -
  • - Follows SEO guidelines. -
  • -
  • - Targets a global audience. -
  • -
-

- The first four lines are visible when the About page opens. Learners can select “See More” to view the full description. -

-

- - Learn more. - + English Grammar and Essay Writing

} - id="ldesc.label" + id="title.label" optional={false} - text="Long description" + text="Title" /> } - maxChars={2500} - name="full_description" + name="title" + required={true} + type="text" /> -

- The skills and knowledge learners will acquire in this course. -

-

- Format each item as a bullet with four to ten words. -

- Example: + Note: Course editors cannot edit the URL slug. Please reach out to your project coordinator or edX support to edit this field.

-
    -
  • - Basic R Programming -
  • -
  • - An applied understanding of linear and logistic regression -
  • -
  • - Application of text analytics -
  • -
  • - Linear and integer optimization -
  • -

- - Learn more. - + This field is optional. If left blank, edX will automatically create a URL slug based on the course title.

- - } - id="outcome.label" - optional={false} - text="What you will learn" - /> - } - maxChars={2500} - name="outcome" - /> -

- A review of content covered in your course, organized by week or module. + If you find that a given URL slug is already in use, we recommend adding your school or institution name to the slug to ensure uniqueness.

-
    -
  • - Focus on topics and content. -
  • -
  • - Do not include detailed information about course logistics, such as grading, communication policies, and reading lists. -
  • -
  • - Format items as either paragraphs or a bulleted list. -
  • -

- - Learn more. - + This URL slug can be changed, and learners who visit an older URL will be redirected to the current URL.

- Example: + What is a URL slug?

-
    -
  • -

    - Week 1: From Calculator to Computer -

    -

    - Introduction to basic programming concepts, such as values and expressions, as well as making decisions when implementing algorithms and developing programs. -

    -
  • -
  • -

    - Week 2: State Transformation -

    -

    - Introduction to state transformation, including representation of data and programs as well as conditional repetition. -

    -
  • -
+

+ In the example URL www.edx.org/course/math-101, the URL slug is “math-101.” Using URL slugs that are short and easily understandable helps learners find and remember course pages, and also drives higher rankings in search engine results. +

} - id="syllabus.label" + id="slug.label" optional={true} - text="Syllabus" + text="URL slug" /> } - maxChars={500} - name="syllabus_raw" + name="url_slug" + optional={true} + type="text" /> +
+ +

+ The Product source is a key that identifies where the course originates. +

+

+ + Example: + +

+

+ If the course originates from the edX platform, the Product source is edX. +

+
+ } + id="productSource" + optional={false} + text="Product Source" + /> +
+ N/A +
+ +
+ +
+ Test101x +
+
+
+ +
+
+ + + Date: + + + +
+
+ + Time (UTC): + + +
+
+

- Specific knowledge learners must have to be successful in the course. If the course has no prerequisites, enter “None”. -

-

- - Learn more. - + The Course enrollment track determines what enrollment tracks are eligible for the course runs.

- Examples: + Example:

-
    -
  • - Secondary school (high school) algebra; basic mathematics concepts -
  • -
  • - Graduate-level understanding of Keynesian economics -
  • -
  • - Basic algebra -
  • -
+

+ The Verified and Audit selection will allow course runs to either be Verified and Audit or Audit only. +

} - id="prereq.label" - optional={true} - text="Prerequisites" + id="type.label" + optional={false} + text="Course enrollment track" /> } - maxChars={1000} - name="prerequisites_raw" + name="type" + options={ + Array [ + Object { + "label": "Select enrollment track", + "value": "", + }, + Object { + "label": "Credit", + "value": "9521aa7d-801b-4a67-92c3-716ea30f5086", + }, + Object { + "label": "Masters Only", + "value": "7b41992e-f268-4331-8ba9-72acb0880454", + }, + Object { + "label": "Verified and Audit", + "value": "8a8f30e1-23ce-4ed3-a361-1325c656b67b", + }, + Object { + "label": "Professional Only", + "value": "fdde7d04-7ce0-4ff7-ac90-7f518e90ac1e", + }, + Object { + "label": "Audit Only", + "value": "03e09c15-4127-4031-bc02-e20fcbdf09f0", + }, + ] + } + /> + + +

+ Course teams are responsible for securing any necessary permissions for use of third-party logos. +

+

+ To elaborate on the support, please include additional information in the “About this course” section. Please avoid including statements that the course is jointly offered or that the 3rd party is collaborating or partnering with edX. +

+ + } + id="collaborators.label" + optional={true} + text="Collaborators" + /> +

- A quote from a learner in the course, demonstrating the value of taking the course. -

-

- Should be no more than 25–50 words in length. + An eye-catching, colorful image that captures the essence of your course.

+
    +
  • + New course images must be 1134×675 pixels in size. +
  • +
  • + The image must be a JPEG or PNG file. +
  • +
  • + Each course must have a unique image. +
  • +
  • + The image cannot include text or headlines. +
  • +
  • + You must have permission to use the image. Possible image sources include Flickr creative commons, Stock Vault, Stock XCHNG, and iStock Photo. +
  • +

Learn more.

-

- - Example: - -

-

- “Brilliant course! It’s definitely the best introduction to electronics in the world! Interesting material, clean explanations, well prepared quizzes, challenging homework, and fun labs.” – Previous Student -

} - id="testimonials.label" - optional={true} - text="Learner testimonials" + id="image.label" + optional={false} + text="Image" /> } - maxChars={500} - name="learner_testimonials" + maxImageSizeKilo={1000} + name="imageSrc" + requiredHeight={675} + requiredWidth={1134} /> -

- Any frequently asked questions and the answers to those questions. -

-

- - Learn more. - -

-

- - Example: - -

- - Do I need to know any programming languages before I start? - -

- No, this course is designed for beginners. -

- - What version of Swift will I be learning? - -

- Swift version 4. -

- +

+ You can add tags in the format mba-no-gmat,mba,mba_4_modules,mba_NY +

} - id="faq.label" + id="tags.label" optional={true} - text="Frequently asked questions" + text="Topics" /> } - maxChars={2500} - name="faq" + loadOptions={[Function]} + name="tags" + optional={true} />