class Kaminari::Generators::ViewsGenerator
Private Class Methods
themes()
click to toggle source
# File lib/generators/kaminari/views_generator.rb, line 37 def self.themes begin @themes ||= GitHubApiHelper.get_files_in_master.group_by {|fn, _| fn[0...(fn.index('/') || 0)]}.delete_if {|fn, _| fn.blank?}.map do |name, files| Theme.new name, files end rescue SocketError [] end end
Private Instance Methods
copy_default_views()
click to toggle source
# File lib/generators/kaminari/views_generator.rb, line 54 def copy_default_views filename_pattern = File.join self.class.source_root, "*.html.#{template_engine}" Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f| copy_file f, "app/views/kaminari/#{f}" end end
download_templates(theme)
click to toggle source
# File lib/generators/kaminari/views_generator.rb, line 47 def download_templates(theme) theme.templates_for(template_engine).each do |template| say " downloading #{template.name} from kaminari_themes..." create_file template.name, GitHubApiHelper.get_content_for("#{theme.name}/#{template.name}") end end
template_engine()
click to toggle source
# File lib/generators/kaminari/views_generator.rb, line 61 def template_engine options[:template_engine].try(:to_s).try(:downcase) || 'erb' end