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 = <<-HAML
%section.title-template(data-state="no-background")
  %h1 Mode Set
  %h2 Presentation Name
  %h2 Continued or presenter
  %date= Time.zone.now.strftime "%m.%d.%Y"
  = image_tag "showboat/title-smoke.png", alt: "mode set", class: "smoke"
  .slant
  %div.modeset-logo

  %aside.notes
    talk fast

    HAML

  elsif file_name == "copy"
    haml = <<-HAML
%section.copy-template(data-heading="Copy Template <span>sub heading</span>")
  :markdown
    # The copy template

    HAML

  elsif file_name == "list"
    haml = <<-HAML
%section.list-template(data-heading="List Template <span>sub heading</span>")
  :markdown
    - a list item
    - another list item

    HAML

  elsif file_name == "fragment"
    haml = <<-HAML
%section.list-template(data-heading="List Template <span>sub heading</span>")
  %h1 Fragments
  %ul
    %li.fragment.fade-in A fragment
    %li.fragment.fade-in Another fragment

    HAML

  elsif file_name == "media"
    haml = <<-HAML
%section.media-template(data-heading="Media Template <span>Project Name</span>" data-link="Example.com" data-src="http://www.modeset.com")
  = image_tag "showboat/fpo/fpo-tablet-handheld-laptop.png", alt: "fpo", class: "reflect"

    HAML

  elsif file_name == "end"
    haml = <<-HAML
%section.end-template
  %h1 thank you
  .slant
  %div.modeset-logo

    HAML
  end

  if haml.empty?
    puts "#{file_name} template not found."
    puts "Available templates are: title, copy, list, fragment, media, end"
  else
    File.open("app/views/showboat/index.html.haml", 'a') {|f| f.write(haml) }
    puts "#{file_name} template appended to app/views/showboat/index.html.haml"
  end
end