# ivanyv/activeadmin_reorderable architecture

> Architecture diagram of the GitHub repository ivanyv/activeadmin_reorderable, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivanyv/activeadmin_reorderable
- Repository: https://github.com/ivanyv/activeadmin_reorderable

## Overview

##### Component Relationships

a) Core Components:
- It to:
- DSL Module (lib/active_admin/reorderable/dsl.rb)
- Table Methods Module (lib/active_admin/reorderable/table_methods.rb)
- View Components:
- IndexAsReorderableTable
- ReorderableTableFor

b) Asset Pipeline:
- JavaScript Component (activeadmin_reorderable.js)
- Stylesheet Component (activeadmin_reorderable.scss)
- Their integration with ActiveAdmin's asset pipeline

##### Data Flow

- Configuration flow from DSL to view components
- JavaScript event handling for drag-and-drop operations
- Model updates through the insert_at API

##### Implementation Details

Notes showing:
- Required model interface (insert_at method)
- Asset inclusion requirements
- Configuration options

##### Specific Elements

**┌─ ActiveAdmin Framework ─────────────────┐**
- ┌─ ActiveAdmin Reorderable ────────┐   │
- Engine                           │   │
- DSL Extensions              │   │
- Table Methods               │   │
- View Components            │   │
- ┘   │

- ┌─ Asset Pipeline ─────────────────┐   │
- JavaScript                    │   │
- Stylesheets                  │   │
- ┘   │
- ┘

##### Integration Points

Clear connection points for:
- How the gem hooks into ActiveAdmin
- Where assets are injected
- Model integration points
- View template integration

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph ActiveAdmin[ActiveAdmin Framework]
        subgraph Plugin[ActiveAdmin Reorderable Plugin]
            Engine["Engine Component"]:::core
            DSL["DSL Extensions"]:::core
            TableMethods["Table Methods"]:::core
            
            subgraph ViewComponents[View Components]
                IndexTable["IndexAsReorderableTable"]:::view
                ReorderableTable["ReorderableTableFor"]:::view
            end
            
            Engine --> DSL
            Engine --> TableMethods
            DSL --> ViewComponents
            TableMethods --> ViewComponents
        end
        
        subgraph AssetPipeline[Asset Pipeline]
            JS["JavaScript Component"]:::asset
            CSS["Stylesheet Component"]:::asset
        end
    end
    
    subgraph External[External Dependencies]
        ActsList["acts_as_list gem"]:::external
    end
    
    subgraph ClientApp[Client Rails Application]
        Model["ActiveRecord Model"]:::client
        AdminResource["Admin Resource"]:::client
    end
    
    Engine --> AssetPipeline
    Plugin --> ActsList
    Model --> ActsList
    AdminResource --> Plugin
    JS --> Model
    
    %% Click events for file mapping
    click Engine "https://github.com/ivanyv/activeadmin_reorderable/blob/master/lib/activeadmin_reorderable/engine.rb"
    click DSL "https://github.com/ivanyv/activeadmin_reorderable/blob/master/lib/active_admin/reorderable/dsl.rb"
    click TableMethods "https://github.com/ivanyv/activeadmin_reorderable/blob/master/lib/active_admin/reorderable/table_methods.rb"
    click IndexTable "https://github.com/ivanyv/activeadmin_reorderable/blob/master/lib/active_admin/views/index_as_reorderable_table.rb"
    click ReorderableTable "https://github.com/ivanyv/activeadmin_reorderable/blob/master/lib/active_admin/views/reorderable_table_for.rb"
    click JS "https://github.com/ivanyv/activeadmin_reorderable/blob/master/app/assets/javascripts/activeadmin_reorderable.js"
    click CSS "https://github.com/ivanyv/activeadmin_reorderable/blob/master/app/assets/stylesheets/activeadmin_reorderable.scss"
    
    %% Styling
    classDef core fill:#2b6cb0,stroke:#1a4971,color:white
    classDef view fill:#48bb78,stroke:#2f855a,color:white
    classDef asset fill:#ecc94b,stroke:#d69e2e,color:black
    classDef external fill:#a0aec0,stroke:#718096,color:white
    classDef client fill:#ed8936,stroke:#dd6b20,color:white
    
    %% Legend
    subgraph Legend
        CoreComp["Core Components"]:::core
        ViewComp["View Components"]:::view
        AssetComp["Asset Components"]:::asset
        ExtComp["External Dependencies"]:::external
        ClientComp["Client Components"]:::client
    end
```
