mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Haml generator
This commit is contained in:
parent
ae8df1a6d1
commit
9a3c0b00f8
1 changed files with 11 additions and 2 deletions
|
@ -1,11 +1,20 @@
|
|||
module Kaminari
|
||||
module Generators
|
||||
class ViewsGenerator < Rails::Generators::Base
|
||||
source_root File.expand_path('../../../../app/views', __FILE__)
|
||||
source_root File.expand_path('../../../../app/views/kaminari', __FILE__)
|
||||
|
||||
class_option :template_engine, :type => :string, :aliases => '-e', :desc => 'Template engine for the views. Available options are "erb" and "haml".'
|
||||
|
||||
desc 'Copies all paginator partials to your application.'
|
||||
def copy_views
|
||||
directory 'kaminari', 'app/views/kaminari'
|
||||
Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|
|
||||
copy_file f, "app/views/kaminari/#{f}"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def filename_pattern
|
||||
File.join self.class.source_root, "*.html.#{options[:template_engine] || 'erb'}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue