Class: BootstrapPager::Generators::ViewsGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/bootstrap_pager/views_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

:nodoc:



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/bootstrap_pager/views_generator.rb', line 9

def self.banner #:nodoc:
  <<-BANNER.chomp
rails g bootstrap_pager:views THEME [options]

    Copies all paginator partial templates to your application.
    You can choose a template THEME by specifying one from the list below:

  - default
      The default one.
      This one is used internally while you don't override the partials.
#{themes.map {|t| "        - #{t.name}\n#{t.description}"}.join("\n")}
BANNER
end

Instance Method Details

#copy_or_fetchObject

:nodoc:



24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/bootstrap_pager/views_generator.rb', line 24

def copy_or_fetch #:nodoc:
  return copy_default_views if file_name == 'default'

  themes = self.class.themes
  if theme = themes.detect {|t| t.name == file_name}
    download_templates theme
  else
    say %Q[no such theme: #{file_name}\n  avaliable themes: #{themes.map(&:name).join ", "}]
  end
end