Method: Nwiki::Frontend::Html#html

Defined in:
lib/nwiki/frontend/app/html.rb

#html(page) ⇒ Object



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
# File 'lib/nwiki/frontend/app/html.rb', line 23

def html page
  erb = ERB.new <<EOS
<!DOCTYPE HTML>
<html>
<head>
  <title><%= page.title %> - <%= @wiki.title %></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="/articles.xml">
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
</head>
<body>
  <div class="container">
    <div class="row">
<div class="col-md-8"><h1><a href="/articles/"><%= @wiki.title %></a></h1></div>
<div class="col-md-4"><h2 class="text-right"><small><%= @wiki.subtitle %></small></h2></div>
    </div>
    <div class="row">
<div class="col-md-12">
  <%= page.to_html %>
</div>
    </div>
  </div>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
</body>
</html>
EOS
  erb.result(binding).force_encoding(page.encoding)
end