Ready first version of reusable apps dispatching.

This commit is contained in:
Wlodek Bzyl 2009-06-02 00:00:42 +02:00
parent 87e3bc293c
commit aeb39757c7
9 changed files with 42 additions and 36 deletions

View File

@ -1,17 +1,10 @@
require 'rsummer/mapp'
require 'rwinter/mapp'
require 'rsummer/summer'
require 'rwinter/winter'
Rapp = Rack::Builder.new do
use Rack::ShowExceptions
use Rack::Lint
map '/mapp1' do
run Sinatra::Mapp1.new
end
map '/mapp2' do
run Sinatra::Mapp2.new
end
map '/summer' do
run Sinatra::Summer.new
end
map '/winter' do
run Sinatra::Winter.new
end
run Rapp

View File

@ -15,7 +15,7 @@ module Sinatra
get '/?' do
@title = "Tatra Mountains, Błyszcz (2159 m)"
erb :app
erb :index
end
end
end

View File

@ -1,3 +0,0 @@
<h2><%= @title %></h2>
<p><%= image_tag "/images/tatry1.jpg", :closed => true, :alt => @title, :title => @title %></p>

View File

@ -0,0 +1,3 @@
<h2><%= @title %></h2>
<p><%= image_tag "/images/tatry1.jpg", :alt => @title, :title => @title %></p>

View File

@ -3,12 +3,6 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- does not work
<link charset="utf-8" href="/stylesheets/mapp.css" media="screen" rel="stylesheet" type="text/css">
-->
<%= stylesheet_link_tag "/stylesheets/mapp.css" %>
<%= javascript_script_tag "/javascripts/mapp.js" %>

View File

@ -1,14 +1,8 @@
require 'mapp'
require 'winter'
Mapp2 = Rack::Builder.new do
use Rack::ShowExceptions
use Rack::Lint
use Rack::ShowExceptions
use Rack::Lint
use Rack::Static, :urls => ["/stylesheets", "/images"], :root => "public"
map '/' do
run Sinatra::Mapp2.new
end
map '/' do
run Sinatra::Winter.new
end
run Mapp2

View File

@ -0,0 +1,3 @@
<h2><%= @title %></h2>
<p><%= image_tag "/images/tatry2.jpg", :alt => @title, :title => @title %></p>

View File

@ -2,6 +2,7 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<%= stylesheet_link_tag "/stylesheets/mapp.css" %>
<%= javascript_script_tag "/javascripts/mapp.js" %>

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
require 'sinatra/base'
gem 'wbzyl-sinatra-static-assets'
require 'sinatra/static_assets'
module Sinatra
class Winter < Sinatra::Base
helpers Sinatra::UrlForHelper
helpers Sinatra::StaticAssets
set :app_file, __FILE__
set :static, true
get '/?' do
@title = "Tatra Mountains, Dolina Gąsienicowa (1500 m)"
erb :index
end
end
end