active_scaffold
Version, currently 0.3.79 versions
github.com/maiha/active-scaffold.cr
ActiveScaffold for Amber on Crystal
Installation
# Add this to your shard.yml
dependencies:
active_scaffold:
github: maiha/active-scaffold.cr
version: ~> 0.3.7Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- maiha
Dependencies
Runtime Dependencies
- db~> 0.5.0github: crystal-lang/crystal-db
- var>= 0.2.1github: maiha/var.cr
- amber~> 0.6.7github: amberframework/amber
- pretty>= 0.5.6github: maiha/pretty.cr
- granite_orm*github: maiha/granite-orm, branch: master
Development Dependencies
- sqlite3*github: crystal-lang/crystal-sqlite3dev
README
active_scaffold.cr 
ActiveScaffold for Amber on Crystal.
- amber-0.6.7
- granite-orm (maiha fork)
- crystal-0.24.1
Installation
Add this to your amber application's shard.yml:
dependencies:
active_scaffold:
github: maiha/active_scaffold.cr
version: 0.3.7
granite_orm:
#github: amberframework/granite-orm
github: maiha/granite-orm
branch: master
Usage
require "active_scaffold"
class UsersController < ApplicationController
include ActiveScaffold(User)
active_scaffold do |config|
# config.id = "code" # primary key (default: "id")
config.columns = ["first_name", "last_name"]
config.actions = ["list", "show"]
config.action_links["show"].label = "View"
config.list.paging.order = "id DESC"
config.list.paging.limit = 15
config.list.paging.window = 5
# config.list.paging.count = false # disable `SELECT COUNT`
config.show.label = "user(%s)"
end
end
Global settings
You can put global settings in ActiveScaffold::Default that sets default values to all controllers.
ActiveScaffold::Default::List::PAGING = {limit: 5}
All configurable parameters are in ActiveScaffold::Default.
See https://github.com/maiha/active-scaffold.cr/wiki/API:-Global-settings
Debug
- add
?debugparameter to the url, or
active_scaffold do |config|
config.debug = true
API
- config : ActiveScaffold::Config::Core
- config.columns : ActiveScaffold::Data::Columns
- config.column : ActiveScaffold::Data::Column
- config.action_links : ActiveScaffold::Data::ActionLinks
- config.action_link : ActiveScaffold::Data::ActionLink
- config.list : ActiveScaffold::Config::List
- config.list.paging : ActiveScaffold::Data::Paging
- config.show : ActiveScaffold::Config::Show
- config.edit : ActiveScaffold::Config::Edit
- config.update : ActiveScaffold::Config::Update
Install
Currently, there are no full generators. So please setup files manually as follows.
once for an application
public/dist/active_scaffold.css->../../lib/active_scaffold/src/active_scaffold/assets/stylesheets/active_scaffold.css
(cd public/dist && ln -s ../../lib/active_scaffold/src/active_scaffold/assets/stylesheets/active_scaffold.css)
src/views/layouts/application.slang- add css to the end of
headpart - add js to the end of
bodypart
- add css to the end of
link rel="stylesheet" href="/dist/active_scaffold.css"
script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
Put into shard.yml.
targets:
active_scaffold:
main: lib/active_scaffold/bin/gen.cr
Then, build it.
shards build
each controllers
For example, please run following command for UsersController and User model.
./bin/active_scaffold users
This writes following files if missing.
config/routes.crsrc/models/user.crsrc/controllers/users_controller.crsrc/views/users->../../lib/active_scaffold/src/active_scaffold/views
TODO
- data
- [x]
ActiveScaffold::Data::Action(T) - [x]
ActiveScaffold::Data::Actions(T) - [x]
ActiveScaffold::Data::ActionLink(T) - [x]
ActiveScaffold::Data::ActionLinks(T) - [x]
ActiveScaffold::Data::Column(T) - [x]
ActiveScaffold::Data::Columns(T)
- [x]
- config
- [x]
ActiveScaffold::Configure(T) - [x]
ActiveScaffold::Config::Base(T) - [x]
ActiveScaffold::Config::Core(T) - [x]
ActiveScaffold::Config::Edit(T) - [x]
ActiveScaffold::Config::List(T) - [ ]
ActiveScaffold::Config::Search(T) - [x]
ActiveScaffold::Config::Show(T)
- [x]
- actions
- [x]
ActiveScaffold::Actions::Create(T) - [x]
ActiveScaffold::Actions::Delete(T) - [x]
ActiveScaffold::Actions::Edit(T) - [x]
ActiveScaffold::Actions::List(T) - [x]
ActiveScaffold::Actions::New(T) - [x]
ActiveScaffold::Actions::Show(T) - [x]
ActiveScaffold::Actions::Update(T)
- [x]
- features
- [x] debug
- [x] pagination
- [x] sorting
- [x] global settings
- [ ] ajax
- [ ] search
- [ ] in place editor
- [ ] assosications
- [ ] nested
- [ ] generators
- [ ] auths and roles
- [ ] localizations
Development
crystal spec -v
Contributing
- Fork it ( https://github.com/maiha/active_scaffold.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- maiha maiha - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.3.7- Tagged
- Feb 25, 2018
- Commit
77b8f1166517- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/maiha/active-scaffold.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 9