Sha256: a3c35aaf1f061d4cda391a338ea3b4f4b828b66b3c9dbb5b218742846f3ffe63

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

# -*- coding: utf-8 -*-
require 'erb'

module Nwiki
  module Frontend
    class Top
      def initialize git_repo_path, opts = {}
        @wiki = Nwiki::Core::Wiki.new git_repo_path
      end

      def call env
        [
          200,
          { "Content-Type" => "text/html; charset=#{Nwiki::Core::Wiki.repo_filename_encoding}" },
          [html]
        ]
      end

      def html
        erb = ERB.new <<EOS
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="refresh" content="5;URL=http://niku.name/articles/">
  <title><%= @wiki.title %></title>
  <link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="/articles.xml">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  <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">
  <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
</head>
<body>
  <div class="container">
    <div class="row">
    <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">
        <p>ここまだ何にも作ってないんす.<a href="./articles/">articles</a>以下が動いているのでそっちを見てね.5秒経つと自動で移動します.</p>
      </div>
    </div>
  </div>
</body>
</html>
EOS
        erb.result(binding).force_encoding(Nwiki::Core::Wiki.repo_filename_encoding)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nwiki-0.1.3 lib/nwiki/frontend/app/top.rb