LogoLogo
v1.6.1
v1.6.1
  • 🌸What is Petal Pro?
  • πŸ’‘Changelog
  • ⏫Upgrade guide
  • Guides
    • πŸš€Creating a web app from start to finish
  • πŸ‘©β€πŸ³Recipes
    • πŸ’How to apply a recipe with git cherry pick
    • #️⃣UUIDs
    • ✍️First/Last name
    • πŸ“¦NPM packages
    • πŸ—ΊοΈGoogle Maps
  • Fundamentals
    • πŸ’ΏInstallation
    • πŸ“‚Folder structure
    • πŸ—ƒοΈIncluded Pages
    • πŸ˜€Users & Authentication
    • 🏒Organizations & Multitenancy
    • 🧊Components
    • ⬛Dark mode
    • 🎨Branding
    • 🌱Seeding
    • πŸ“„Layouts & Menus
    • πŸ–ΌοΈImage uploads
    • πŸ‘₯Impersonation
    • πŸ› οΈBackground Tasks and Jobs
    • πŸ”§Util & Helpers
    • πŸ“§Emails
    • πŸͺJavascript Hooks
    • πŸ“šExtra Hex Libraries
    • πŸ—οΈGenerators
    • πŸ—£οΈTranslations
    • πŸ–οΈContributing
    • πŸ›«Deployment
    • πŸ›‘οΈTesting
Powered by GitBook
On this page

Was this helpful?

  1. Fundamentals

Util & Helpers

We have two files to put helper functions:

  • Util (/lib/petal_pro/util/util.ex) - utility functions used anywhere, eg. random_string()

  • PetalProWeb.Helpers (lib/petal_pro_web/helpers.ex)- utilities functions imported into views (templates and live views), eg. main_menu_items(), is_admin?

If you want to add new helpers, ask "is this only going to be used in templates and live views?". If yes then put it in helpers.ex. If "no", put it in util.ex.

PreviousBackground Tasks and JobsNextEmails

Last updated 1 year ago

Was this helpful?

πŸ”§