Module: Werewolf::Views

Defined in:
lib/werewolf.rb

Instance Method Summary collapse

Instance Method Details

#layoutObject



71
72
73
74
75
76
77
78
79
# File 'lib/werewolf.rb', line 71

def layout
  html do
    title "Werewolf"
    body do
      h1 "Werewolf"
      self << yield
    end
  end
end

#villageObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/werewolf.rb', line 81

def village
 ul do
  for villager in @village.villagers do
    li villager.name
  end
 end
 
 form(:action => R(Villagers, @village.id), :method => "post") do 
   label "Add Player", :for => "villager[name]"; br 
   input :name => "villager[name]", :type => "text"; br
   input :type => "submit", :value => "Add"
 end 
 
 p "Roles are " + Werewolf::Models::Role.find(:all).map(&:name).to_sentence
 p { a "All", :href => R(Villages) }
end

#villagesObject



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/werewolf.rb', line 98

def villages
 ul do
  for village in @villages do
    li village.started_at
  end
 end
 
 form(:action => R(Villages), :method => "post") do 
   input :type => "submit", :value => "Create"
 end 
end