Skip to content

Instantly share code, notes, and snippets.

@ErinClaudio
Created April 1, 2024 22:42
Show Gist options
  • Save ErinClaudio/393ca48b7f2a77b8d65d5ab36a7f120c to your computer and use it in GitHub Desktop.
Save ErinClaudio/393ca48b7f2a77b8d65d5ab36a7f120c to your computer and use it in GitHub Desktop.

Dashboard Image Update Feature

  • Location: Integrate within 'Page Text' navbar option on the dashboard.
  • Functionality: Allow staff to update Hero Image (1 image) and About Us Images (1 or 2 images).

Implementation Criteria

  • Model Usage:

    • Use PageText model.
    • Attachments: has_one_attached :hero_image and has_many_attached :about_us_images.
  • Form Updates:

    • Add input for Hero Image (single attachment).
    • Add input for About Us images (up to two attachments).
    • Inputs must be clearly labelled.
  • Validations:

    • Ensure uploaded files are images and of acceptable size.
  • Controller Actions:

    • Add to PageTextsController for attaching images.
    • Include functionality to upload and purge images.
  • UI Components:

    • Reuse partials for upload input and image display table.
  • Permissions:

    • Update policy as necessary to accommodate new features.
  • Frontend Display:

    • On org's root/home page, display Hero Image and About Us images if available.
    • Default image for the second About Us image if only one is uploaded.
  • Testing:

    • Include tests for new functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment