0
0
Fork 0

issue #10 added the domain to all page links

This commit is contained in:
Gibheer 2011-09-29 19:48:59 +02:00
parent e478a71c32
commit 92f0b94696
6 changed files with 32 additions and 17 deletions

12
page.rb
View File

@ -80,4 +80,16 @@ class Blog < Sinatra::Base
content
end
end
def domain path = ''
$settings[:domain] + path
end
def title
$settings[:title]
end
def subtitle
$settings[:subtitle]
end
end

View File

@ -1,4 +1,7 @@
$settings = {
:domain => 'http://example.com',
:title => 'zero-knowledge',
:subtitle => 'scripte, programmieren und administrtieren',
:environment => :development,
:logging => true,
:method_override => true,

View File

@ -1,14 +1,14 @@
!!! XML
%feed{:xmlns => 'http://www.w3.org/2005/Atom'}
%title="zero-knowledge"
%subtitle="scripting, programming and administrating"
%link{:href => 'http://zero-knowledge.org/'}
%link{:type => 'application/atom+xml', :rel => "self", :href => 'http://zero-knowledge.org/atom.xml'}
%title=title
%subtitle=subtitle
%link{:href => domain}
%link{:type => 'application/atom+xml', :rel => "self", :href => domain('/atom.xml')}
%updated=Post.get_all_released.last.written.xmlschema
%id='http://zero-knowledge.org/'
%id=domain
-@posts.each do |post|
%entry
%id="http://zero-knowledge.org/post/#{post.id}"
%id=domain("/post/#{post.id}")
%link{:type => 'text/html', :rel => "alternate", :href => "/post/#{post.id}"}
%title=post.title
%updated=post.written.xmlschema

View File

@ -3,11 +3,11 @@
=haml :post_single, :layout => nil
.page
-if @current_page > 2
%a{:href => '/?page=1'}="<<"
%a{:href => domain('/?page=1')}="<<"
-if @current_page > 1
%a{:href => "/?page=#{@current_page - 1}"}="<"
%a{:href => domain("/?page=#{@current_page - 1}")}="<"
%span.bold=@current_page
-if @current_page < @page_count + 1
%a{:href => "/?page=#{@current_page + 1}"}=">"
%a{:href => domain("/?page=#{@current_page + 1}")}=">"
-if @current_page < (@page_count)
%a{:href => "/?page=#{@page_count + 1}"}=">>"
%a{:href => domain("/?page=#{@page_count + 1}")}=">>"

View File

@ -1,18 +1,18 @@
!!! 5
%html
%head
%title="zero-knowledge - scripte, programmieren und administrtieren"
%title="#{title} - #{subtitle}"
%meta{:'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
%link{:rel => 'stylesheet', :href => '/stylesheet.css', :type => 'text/css'}
%script{:src => '/public/javascript/head.min.js'}
%link{:rel => 'alternate', :type => 'application/atom+xml', :href => '/atom.xml', :title => 'Atom 1.0'}
%script{:src => domain('/public/javascript/head.min.js')}
%link{:rel => 'alternate', :type => 'application/atom+xml', :href => domain('/atom.xml'), :title => 'Atom 1.0'}
%body
#wrapper
%header#header
%h1
%a{:href =>"/"}
%img{:src => "/public/images/zero-knowledge.png", :alt => "zero-knowledge"}
%img{:style => "float:right", :src => "/public/images/blub.png", :alt => "Logo"}
%a{:href => domain}
%img{:src => domain("/public/images/zero-knowledge.png"), :alt => title}
%img{:style => "float:right", :src => domain("/public/images/blub.png"), :alt => "Logo"}
#content
=yield
%footer#footer

View File

@ -1,7 +1,7 @@
%article
%header
%h1
%a{:href => "/post/#{@post.id}"}=@post.title
%a{:href => domain("/post/#{@post.id}")}=@post.title
%footer
.author=@post.account.username
.date