BananaCrystal / email-templates

This repository contains in-house email templates that serve as structure for our emails. Each template can be updated and modified to fit requirements.
MIT License
0 stars 0 forks source link

limits.rb #27

Open geekelo opened 1 month ago

geekelo commented 1 month ago

FILE

ActiveAdmin.register Limit do
  permit_params :name, :slug, :amount, :units, :time_frame, :currency, :status

  config.sort_order = 'name_asc'

  menu parent: 'Configuration', label: 'Limits'

  # See permitted parameters documentation:
  # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
  #
  # Uncomment all parameters which should be permitted for assignment
  #
  # permit_params :name, :slug, :amount, :units, :time_frame, :currency, :status
  #
  # or
  #
  # permit_params do
  #   permitted = [:name, :slug, :amount, :units, :time_frame, :currency, :status]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end

  form do |f|
    f.inputs do
      f.input :name
      f.input :slug
      f.input :amount
      f.input :units
      f.input :time_frame
      f.input :currency
      f.input :status, as: :select, collection: ['active', 'inactive']
    end
    f.actions
  end
end
geekelo commented 1 month ago

This ActiveAdmin configuration defines an interface for managing Limit records within your application. The configuration provides a form for creating and updating records, and organizes these records under the "Configuration" menu with the label "Limits." Here's a detailed breakdown of the setup:

1. Menu Configuration

2. Permitted Parameters

3. Sorting Configuration

4. Form Configuration

Summary

This configuration creates a straightforward interface for managing Limit records in your application via ActiveAdmin. It organizes the resource under the "Configuration" menu, allows admins to create or update limits with relevant attributes, and provides a clean and user-friendly form with input fields and a status selector. The default sorting by name helps administrators quickly locate specific limits in the index view.