Ready first version of reusable apps dispatching.
This commit is contained in:
parent
87e3bc293c
commit
aeb39757c7
@ -1,17 +1,10 @@
|
|||||||
require 'rsummer/mapp'
|
require 'rsummer/summer'
|
||||||
require 'rwinter/mapp'
|
require 'rwinter/winter'
|
||||||
|
|
||||||
Rapp = Rack::Builder.new do
|
map '/summer' do
|
||||||
use Rack::ShowExceptions
|
run Sinatra::Summer.new
|
||||||
use Rack::Lint
|
end
|
||||||
|
|
||||||
map '/mapp1' do
|
map '/winter' do
|
||||||
run Sinatra::Mapp1.new
|
run Sinatra::Winter.new
|
||||||
end
|
|
||||||
|
|
||||||
map '/mapp2' do
|
|
||||||
run Sinatra::Mapp2.new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
run Rapp
|
|
||||||
|
@ -15,7 +15,7 @@ module Sinatra
|
|||||||
|
|
||||||
get '/?' do
|
get '/?' do
|
||||||
@title = "Tatra Mountains, Błyszcz (2159 m)"
|
@title = "Tatra Mountains, Błyszcz (2159 m)"
|
||||||
erb :app
|
erb :index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<h2><%= @title %></h2>
|
|
||||||
|
|
||||||
<p><%= image_tag "/images/tatry1.jpg", :closed => true, :alt => @title, :title => @title %></p>
|
|
3
examples/rsummer/views/index.erb
Normal file
3
examples/rsummer/views/index.erb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<h2><%= @title %></h2>
|
||||||
|
|
||||||
|
<p><%= image_tag "/images/tatry1.jpg", :alt => @title, :title => @title %></p>
|
@ -3,12 +3,6 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<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" %>
|
<%= stylesheet_link_tag "/stylesheets/mapp.css" %>
|
||||||
<%= javascript_script_tag "/javascripts/mapp.js" %>
|
<%= javascript_script_tag "/javascripts/mapp.js" %>
|
||||||
|
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
require 'mapp'
|
require 'winter'
|
||||||
|
|
||||||
Mapp2 = Rack::Builder.new do
|
use Rack::ShowExceptions
|
||||||
use Rack::ShowExceptions
|
use Rack::Lint
|
||||||
use Rack::Lint
|
|
||||||
|
|
||||||
use Rack::Static, :urls => ["/stylesheets", "/images"], :root => "public"
|
map '/' do
|
||||||
|
run Sinatra::Winter.new
|
||||||
map '/' do
|
|
||||||
run Sinatra::Mapp2.new
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
run Mapp2
|
|
||||||
|
3
examples/rwinter/views/index.erb
Normal file
3
examples/rwinter/views/index.erb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<h2><%= @title %></h2>
|
||||||
|
|
||||||
|
<p><%= image_tag "/images/tatry2.jpg", :alt => @title, :title => @title %></p>
|
@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
|
||||||
<%= stylesheet_link_tag "/stylesheets/mapp.css" %>
|
<%= stylesheet_link_tag "/stylesheets/mapp.css" %>
|
||||||
<%= javascript_script_tag "/javascripts/mapp.js" %>
|
<%= javascript_script_tag "/javascripts/mapp.js" %>
|
||||||
|
|
||||||
|
21
examples/rwinter/winter.rb
Normal file
21
examples/rwinter/winter.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user