Sha256: be97b764f8ab089a1b28027866e01d279d9d01a03a757737ca4b82ee5b32d85b

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'haml'
require 'sinatra'
require 'json'

module Nutcracker
  module Web
    class App < Sinatra::Base
      enable :inline_templates
      set :root, File.expand_path('../'*4,__FILE__)

      get '/' do
        haml :index
      end
      
      def overview
        $nutcracker.overview rescue
         JSON.parse File.read File.join(settings.root,"example.json")
      end
      
      def self.assets
        require 'sprockets'
        Sprockets::Environment.new { |env|
          %w(javascripts stylesheets templates).each { |asset|
            env.append_path File.join(settings.root,"assets/#{asset}")
          }
        }
      end

    end
  end
end

__END__

@@ layout
%html
  %head
    %title Nutcracker-Web
    %script(type='text/javascript' src='http://www.google.com/jsapi')
    %script(type='text/javascript' src='assets/application.js')
    %link(rel='stylesheet' href='assets/application.css')
    %link(rel="shortcut icon" href="http://publishers.kontera.com/favicon.ico")
  %body
    = yield

@@ index
#navbar
.container
  #container{ "data-clusters" => overview.to_json }
    loading...
#footer
- 3.times do
  %br

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nutcracker-web-0.0.2 lib/nutcracker/web/app.rb