Skip to content

Commit

Permalink
Merge pull request #47 from pikesley/layout-fixes
Browse files Browse the repository at this point in the history
Layout fixes
  • Loading branch information
Sam Pikesley committed Dec 2, 2013
2 parents 19cbd23 + 5f2dbff commit b5306d7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
39 changes: 21 additions & 18 deletions lib/uncle_clive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@
class Spectrum < Sinatra::Base
use Rack::GoogleAnalytics, :tracker => 'UA-20895204-11'

@@locals = {
:bootstrap_theme => '../lavish-bootstrap.css',
:additional_styles => [
'../sinclair.css'
],
:github => {
:user => 'pikesley',
:project => 'uncle-clive',
:ribbon => 'right_darkblue_121621'
}
}

get '/' do
haml :readme, :locals => {
:bootstrap_theme => '../lavish-bootstrap.css',
:title => '© 1982 Sinclair Research Ltd.',
:text => markdown(File.read('README.md')),
:github => {
:user => 'pikesley',
:project => 'uncle-clive',
:ribbon => 'right_darkblue_121621'
haml :readme, :locals => @@locals.merge(
{
:title => '© 1982 Sinclair Research Ltd.'
}
}
)
end

get '/:text' do
Expand Down Expand Up @@ -64,16 +71,12 @@ def respond text, gitfiti = false

when 'text/html'
cs.formatter = UncleClive::Formatters::HTMLTableFormatter.new
halt haml :tabliser, :locals => {
:bootstrap_theme => '../lavish-bootstrap.css',
:title => params[:text],
:table => cs[params[:text]],
:github => {
:user => 'pikesley',
:project => 'uncle-clive',
:ribbon => 'right_darkblue_121621'
halt haml :tabliser, :locals => @@locals.merge(
{
:title => params[:text],
:table => cs[params[:text]]
}
}
)

when 'text/plain'
cs.formatter = UncleClive::Formatters::TextFormatter.new
Expand Down
4 changes: 4 additions & 0 deletions lib/views/layout.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
%head
%title= title
%link{:rel => 'stylesheet', :href => '//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css', :type => "text/css"}
-if defined? additional_styles
-additional_styles.each do |style|
%link{:rel => 'stylesheet', :href => style, :type => "text/css"}

-if defined? bootstrap_theme
%link{:rel => 'stylesheet', :href => bootstrap_theme, :type => "text/css"}

Expand Down
2 changes: 1 addition & 1 deletion lib/views/readme.haml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#readme~ text
#readme~ markdown(File.read('README.md'))

0 comments on commit b5306d7

Please sign in to comment.