Ruby JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



dm-cutie-ui is a live reporting tool for dm-cutie.

Adding Custom Columns

The partial 'grid' takes three keys to create its local variables: :columns, :records, :adhoc_columns (discussed next)

Columns should be respond to #each, it will generally be a DataMapper PropertySet. Each element in columns will be used in a #send method call on each of the elements in records. That means instead of doing the standard partial :grid, :locals => { :columns =>, :records => @my_collection}

You can add any other columns you want as long as there is a method that a 'record' will respond to. For example, every object has a 'class' method, so you could do partial :grid, :locals => { :columns => + [:class], :records => @my_collection }

This would cause the class name to be output in a column (pretty useless), but you can add any method you want to the class and simply add its name to the set of elements being passed to :columns

As an alternative method you can pass a column name to a proc in the :adhoc_columns parameter partial :grid, :locals => { :columns =>, :records => @my_collection, :adhoc_columns => { :my_cool_class_name => lambda{|my_record| my_record.class } } }

This would result in a column named 'my_cool_class_name' with a value of 'MyModel'. Obviously you can be more creative :)

Note: the proc should accept one parameter, the specific record from the collection of items passed to :records

IMPORTANT NOTE: Remember, if you are adding additional columns to the grid, make sure you pass the column names to the 'menu' partial if you want the ability to hide that column.

DataMapper Default Context

DataMapper requires a 'default' repository. In DM UI all users use their own repository, so a fake repository is stubbed as

DataMapper.setup :default, "abstract://null"

All calls should be done through the Sinatra helper method #repo.


  • If you boot a server with extras and then browse to a dm-cutie repo with out those extras you get an error
    • should probably change extras loaded to a 'per repository' thing
  • Make *.erbs more dry, its probably possible to get ride of them all together if the hooks had the following methods display_views, display_relationships
  • Make this app less ugly, I suck horribly at CSS :)
    • Deal w/ the super fields
  • --include-hooks=this,that/there,etc
    • figure out how to support including hooks/views that aren't a part of dm-cutie or dm-cutie-extras
  • dm-pagination
  • If someone built a merb-slice version of this, they would be awesome.
  • Sinatra shutdown hook to clean up the tmp directory