Skip to content
Browse files

Fixed generator

  • Loading branch information...
1 parent ddb179e commit 43c6317851acda7250f644a5ee43764600f0cdd4 @bogdan committed Jan 15, 2014
Showing with 12 additions and 2 deletions.
  1. +1 −1 Readme.markdown
  2. +1 −0 lib/datagrid/form_builder.rb
  3. +10 −1 lib/datagrid/scaffold.rb
View
2 Readme.markdown
@@ -159,9 +159,9 @@ create app/grids/skills_grid.rb
create app/controllers/skills_controller.rb
create app/views/skills/index.html.erb
route resources :skills
+insert app/assets/stylesheet/application.css
```
-
### Customize Built-in partials
In order to get a control on datagrid built-in partials run:
View
1 lib/datagrid/form_builder.rb
@@ -21,6 +21,7 @@ def datagrid_label(filter_or_attribute, options_or_text = {}, options = {}, &blo
def datagrid_boolean_enum_filter(attribute_or_filter, options = {})
datagrid_enum_filter(attribute_or_filter, options)
end
+
def datagrid_extended_boolean_filter(attribute_or_filter, options = {})
datagrid_enum_filter(attribute_or_filter, options)
end
View
11 lib/datagrid/scaffold.rb
@@ -9,7 +9,16 @@ def create_scaffold
template "index.html.erb", "app/views/#{grid_controller_short_name}/index.html.erb"
route("resources :#{grid_controller_short_name}")
in_root do
- inject_into_file "app/assets/stylesheets/application.css", " *= require datagrid", {:before => %r{require_self}} # before all
+ {
+ "css" => " *= require datagrid",
+ "css.sass" => " *= require datagrid",
+ "css.scss" => " *= require datagrid",
+ }.each do |extension, string|
+ file = "app/assets/stylesheets/application.#{extension}"
+ if File.exists?(Rails.root.join(file))
+ inject_into_file file, string + "\n", {:before => %r{.*require_self}} # before all
+ end
+ end
end
end

0 comments on commit 43c6317

Please sign in to comment.
Something went wrong with that request. Please try again.