Skip to content
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

Replace the body textarea with a Monaco editor #9532

Draft
wants to merge 16 commits into
base: editionable-landing-pages
Choose a base branch
from

Commits on Oct 17, 2024

  1. Add Editionable LandingPage model

    - LandingPage is a new document type rendered by Frontend
      which constructs its page using blocks specified in
      the details of the content item (not to be confused with
      the reusable content blocks project).
    - Here we add it as an editionable object, add a
      PublishingAPI presenter to allow it to be published,
      and update Whitehall's list of allowed rendering apps
      to include Frontend (this is the first, but the consolidation
      work means it won't be the last document type that will
      need this).
    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    49bd534 View commit details
    Browse the repository at this point in the history
  2. Add LandingPage controller

    - _form partial is required for editions
    - add resource route
    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    de2428c View commit details
    Browse the repository at this point in the history
  3. Allow setting base_path on LandingPage creation

    - Add additional_significant_fields partial
    - This handles editing the base_path the first time the
      document is created
    - allow the slug parameter in EditionsController
    - skip updating document slugs for landing pages. We
      want to be able to specify the base_path explicitly
      for these editions, so having them set automatically
      from the title is not desired.
    
    Co-authored-by: Richard Towers <[email protected]>
    KludgeKML and richardTowers committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    a861eaf View commit details
    Browse the repository at this point in the history
  4. Add landing pages to new document options

    - Add redirect to new_document_controller to
      allow it to bounce landing pages to their controller.
    richardTowers authored and KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    c96273a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e66f84f View commit details
    Browse the repository at this point in the history
  6. Add landing page to i18n

    richardTowers authored and KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    31318e8 View commit details
    Browse the repository at this point in the history
  7. Add LandingPage in test

    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    7fba3b5 View commit details
    Browse the repository at this point in the history
  8. Add Model/Presenter tests

    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    f9f604a View commit details
    Browse the repository at this point in the history
  9. Lint fixes to above

    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    4559cf9 View commit details
    Browse the repository at this point in the history
  10. Add some validations to LandingPage

    - base_path must exist and not already be taken
    - body must be valid YAML (and more, root element must be blocks: - we can expand this to stricter testing, but maybe that should be by schema?)
    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    dc1a544 View commit details
    Browse the repository at this point in the history
  11. Fix test name

    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    8e109b4 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    a53508c View commit details
    Browse the repository at this point in the history
  13. Basic controller tests

    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    f816ff3 View commit details
    Browse the repository at this point in the history
  14. Rubocop fix for model

    KludgeKML committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    dc9a20d View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    5b0e85c View commit details
    Browse the repository at this point in the history
  16. Replace the body textarea with a Monaco editor

    This should provide a much better editing experience for YAML files. It
    gives us syntax highlighting, code folding, line numbers, and a whole
    bunch of other features.
    
    It does not yet provide schema validation, or schema-powered
    autocomplete, but that's a possible improvement for later.
    
    We're using ecmascript modules to load the third party javascript here,
    rather than installing it with npm. This is just because bundling the
    code and making the rails asset pipeline aware of it is a yak shave.
    Hopefully the YAML editor won't be a long term component, so this will
    be a temporary oddity.
    richardTowers committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    fbd21c1 View commit details
    Browse the repository at this point in the history