Class: WebAppTheme::Generators::LayoutGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::NamedBase
- Base
- WebAppTheme::Generators::LayoutGenerator
- Defined in:
- lib/generators/web_app_theme/layout/layout_generator.rb
Instance Method Summary collapse
- #copy_images ⇒ Object
- #copy_jquery ⇒ Object
- #copy_js ⇒ Object
- #copy_layout_file ⇒ Object
- #copy_locales ⇒ Object
- #copy_stylesheets ⇒ Object
Methods inherited from Base
Instance Method Details
#copy_images ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/generators/web_app_theme/layout/layout_generator.rb', line 35 def copy_images return unless [:images] copy_file File.join('images', 'avatar.png'), File.join('public', 'images', 'web-app-theme', 'avatar.png') ['application_edit.png', 'cross.png', 'tick.png', 'key.png'].each do |file| copy_file File.join('images', 'icons', file), File.join('public', 'images', 'web-app-theme', file) end end |
#copy_jquery ⇒ Object
48 49 50 51 |
# File 'lib/generators/web_app_theme/layout/layout_generator.rb', line 48 def copy_jquery return unless [:jquery] copy_file 'javascripts/jquery-1.3.min.js', 'public/javascripts/jquery-1.3.min.js' end |
#copy_js ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/generators/web_app_theme/layout/layout_generator.rb', line 53 def copy_js return unless [:js] ['javascripts/jquery.scrollTo.js', 'javascripts/jquery.localscroll.js'].each do |file| copy_file file, File.join('public', file) end end |
#copy_layout_file ⇒ Object
22 23 24 |
# File 'lib/generators/web_app_theme/layout/layout_generator.rb', line 22 def copy_layout_file template "view_layout_#{options[:template]}.html.#{extension}", File.join("app/views/layouts", "#{name}.html.#{extension}") end |
#copy_locales ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/generators/web_app_theme/layout/layout_generator.rb', line 26 def copy_locales return unless [:locales] ["config/locales/de_de.yml", "config/locales/pt_br.yml"].each do |file| copy_file file, file end end |
#copy_stylesheets ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/generators/web_app_theme/layout/layout_generator.rb', line 61 def copy_stylesheets return unless [:stylesheets] if [:sass] create_sass 'stylesheets/base.css', File.join('public', 'stylesheets', 'sass', 'web_app_theme.sass') create_sass "stylesheets/themes/#{options[:theme]}/style.css", File.join('public', 'stylesheets', 'sass', 'themes', [:theme], 'style.sass') create_sass 'web_app_theme_override.css', File.join('public', 'stylesheets', 'sass', 'web_app_theme_override.sass') else copy_file 'stylesheets/base.css', File.join('public', 'stylesheets', 'web_app_theme.css') copy_file "stylesheets/themes/#{options[:theme]}/style.css", File.join('public', 'stylesheets', 'themes', [:theme], 'style.css') copy_file 'web_app_theme_override.css', File.join('public', 'stylesheets', 'web_app_theme_override.css') end end |