lib/rademade_admin/model/configuration.rb in rademade_admin-0.1.5 vs lib/rademade_admin/model/configuration.rb in rademade_admin-0.1.6
- old
+ new
@@ -27,10 +27,18 @@
#
def list_fields
@list_fields ||= RademadeAdmin::Model::Configuration::ListFields.new
end
+ # Return configured csv info
+ #
+ # @return [RademadeAdmin::Model::Configuration::CsvFields]
+ #
+ def csv_fields
+ @csv_fields ||= RademadeAdmin::Model::Configuration::CsvFields.new
+ end
+
# Return configured fields info
#
# @return [RademadeAdmin::Model::Configuration::FormFields]
#
def form_fields
@@ -44,11 +52,15 @@
def field_labels
@field_labels ||= RademadeAdmin::Model::Configuration::FieldsLabels.new
end
def all_field_names
- @all_field_names ||= Set.new(list_fields.all.map(&:name) + form_fields.all.map(&:name))
+ @all_field_names ||= Set.new([
+ list_fields.all.map(&:name),
+ form_fields.all.map(&:name),
+ csv_fields.all.map(&:name)
+ ].flatten(1))
end
def model(model_name)
@model_name = model_name.to_s
end
@@ -75,9 +87,13 @@
field_labels.configure(*field_options, &block)
end
def list(*field_options, &block)
list_fields.configure(*field_options, &block)
+ end
+
+ def csv(*field_options, &block)
+ csv_fields.configure(*field_options, &block)
end
def form(*field_options, &block)
form_fields.configure(*field_options, &block)
end