lib/trestle/admin/builder.rb in trestle-0.8.5 vs lib/trestle/admin/builder.rb in trestle-0.8.6
- old
+ new
@@ -40,12 +40,12 @@
def table(options={}, &block)
admin.table = Table::Builder.build(options.reverse_merge(admin: admin, sortable: true), &block)
end
- def form(&block)
- admin.form = Form.new(&block)
+ def form(options={}, &block)
+ admin.form = Form.new(options, &block)
end
def admin(&block)
@admin.singleton_class.class_eval(&block) if block_given?
@admin
@@ -56,9 +56,17 @@
@controller
end
def routes(&block)
@admin.additional_routes = block
+ end
+
+ def breadcrumb(label=nil, path=nil, &block)
+ if block_given?
+ @admin.breadcrumb = block
+ else
+ @admin.breadcrumb = -> { Breadcrumb.new(label, path) }
+ end
end
end
end
end