Open geekelo opened 1 month ago
This code configures the admin interface for managing Airdrop
records in an ActiveAdmin panel within a Ruby on Rails application. Here's a detailed explanation of what's happening:
airdrop.rb
Airdrop
model with ActiveAdmin, creating an admin interface for managing Airdrop
records.destroy
action, preventing users from deleting Airdrop
records via the admin interface.store
when querying Airdrop
records, improving performance by reducing the number of database queries.Airdrop
resource under the Stores
menu with the label Airdrops
in the ActiveAdmin interface, helping to organize the admin panel by grouping related resources together.store_id
, airdrop_type
, name
, description
, blockchain
, token_symbol
, currency
, exchange_rate
, status
, active
, completed_at
, and recipients_csv
.Airdrop
is in a pending state and is active.admin_send_airdrop_tokens
).send_airdrop_tokens
method on the Airdrop
model, which likely handles the process of distributing tokens to recipients.Airdrop
.Customizes the form for creating and editing Airdrop
records.
The form is configured to support file uploads (multipart: true
).
The form is divided into several panels:
Airdrop Status:
status
(a dropdown with the AIRDROP_STATUS
options) and completed_at
(a datepicker for selecting the completion date).Airdrop Info:
airdrop_type
(a dropdown with AIRDROP_TYPES
), name
, store
(a dropdown with active stores), description
, blockchain
(a dropdown with blockchain options), token_symbol
(a dropdown with cryptocurrency symbols), currency
(a dropdown with currencies, here only 'USD'), exchange_rate
, and active
.para
) to guide the admin on how to fill in the fields, especially concerning the exchange_rate
.Airdrop Recipients:
recipients_csv
) for uploading a CSV file containing the airdrop recipients.participation, ref1, balance, wallet_address, token_balance
).Airdrop
records, including customizations for the form, listing, and actions.This setup offers a comprehensive and user-friendly interface for managing airdrop campaigns within the application, with all necessary controls and validations in place.
FILE