Class: Showboat::Generators::SlideGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/showboat/slide/slide_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_slide_to_presentationObject

source_root File.expand_path(‘../templates’, __FILE__)



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/generators/showboat/slide/slide_generator.rb', line 11

def add_slide_to_presentation
  haml = ''
  if file_name == "title"
    haml = "%section.title-template(data-state=\"no-background\")\n  %h1 Mode Set\n  %h2 Presentation Name\n  %h2 Continued or presenter\n  %date= Time.zone.now.strftime \"%m.%d.%Y\"\n  = image_tag \"showboat/title-smoke.png\", alt: \"mode set\", class: \"smoke\"\n  .slant\n  %div.modeset-logo\n\n  %aside.notes\n    talk fast\n\n    HAML\n\n  elsif file_name == \"copy\"\n    haml = <<-HAML\n%section.copy-template(data-heading=\"Copy Template <span>sub heading</span>\")\n  :markdown\n    # The copy template\n\n    HAML\n\n  elsif file_name == \"list\"\n    haml = <<-HAML\n%section.list-template(data-heading=\"List Template <span>sub heading</span>\")\n  :markdown\n    - a list item\n    - another list item\n\n    HAML\n\n  elsif file_name == \"fragment\"\n    haml = <<-HAML\n%section.list-template(data-heading=\"List Template <span>sub heading</span>\")\n  %h1 Fragments\n  %ul\n    %li.fragment.fade-in A fragment\n    %li.fragment.fade-in Another fragment\n\n    HAML\n\n  elsif file_name == \"media\"\n    haml = <<-HAML\n%section.media-template(data-heading=\"Media Template <span>Project Name</span>\" data-link=\"Example.com\" data-src=\"http://www.modeset.com\")\n  = image_tag \"showboat/fpo/fpo-tablet-handheld-laptop.png\", alt: \"fpo\", class: \"reflect\"\n\n    HAML\n\n  elsif file_name == \"end\"\n    haml = <<-HAML\n%section.end-template\n  %h1 thank you\n  .slant\n  %div.modeset-logo\n\n    HAML\n  end\n\n  if haml.empty?\n    puts \"\#{file_name} template not found.\"\n    puts \"Available templates are: title, copy, list, fragment, media, end\"\n  else\n    File.open(\"app/views/showboat/index.html.haml\", 'a') {|f| f.write(haml) }\n    puts \"\#{file_name} template appended to app/views/showboat/index.html.haml\"\n  end\nend\n"