-
Notifications
You must be signed in to change notification settings - Fork 0
/
_style.rb
33 lines (26 loc) · 1.07 KB
/
_style.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# Some minimal style
#
git_commit "Add some minimal style to shape the layout" do
replace_file 'app/views/layouts/application.html.haml', :flavor => 'html5'
insert_into_file 'app/helpers/application_helper.rb', :before => "\nend" do
<<-EOF
# Include ancestors, e.g. Admin::UsersController -> "admin_users"
def underscored_controller_name
controller.class.name.underscore.gsub('_controller', '').gsub('/', '_')
end
def body_css_classes
"\#{underscored_controller_name} \#{underscored_controller_name}_\#{action_name}"
end
EOF
end
replace_file 'app/stylesheets/partials/_base.scss', :flavor => 'html5'
replace_file 'app/stylesheets/partials/_page.scss', :flavor => 'html5'
install_file 'app/stylesheets/partials/_flash.scss'
append_file 'app/stylesheets/style.scss', "\n@import 'partials/flash';\n"
gsub_file 'app/views/layouts/_flashes.html.haml',
':class => key',
':class => "flash #{key}"'
install_file 'app/stylesheets/partials/_pages.scss'
append_file 'app/stylesheets/style.scss', "@import 'partials/pages';\n"
end