From f24adf7fb016ea0918ebb438d41a648c38988855 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 13 Apr 2010 00:22:47 +0100 Subject: [PATCH] Moved templates to /views --- app.rb | 46 ---------------------------------------------- public/style.css | 5 +++++ views/home.haml | 7 +++++++ views/layout.haml | 15 +++++++++++++++ views/wards.haml | 7 +++++++ 5 files changed, 34 insertions(+), 46 deletions(-) create mode 100644 views/home.haml create mode 100644 views/layout.haml create mode 100644 views/wards.haml diff --git a/app.rb b/app.rb index ad704e3..1586200 100644 --- a/app.rb +++ b/app.rb @@ -19,50 +19,4 @@ get '/wards' do @ward_name = result_ary['administrative']['ward']['title'] haml :wards end - -__END__ - -@@layout -!!! -%html - %head - %title Find My Candidates - %link{ :rel => 'stylesheet', :type => 'text/css', :href => 'style.css' } - %body - #header - %h1 Find My Candidates - #main - = yield - #footer - %hr/ - %p - Made by - %a{ :href => "http://adrianshort.co.uk/" } Adrian Short - -# - with - %a{ :href => "http://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/" } Ordnance Survey - and - %a{ :href => "http://www.sutton.gov.uk/" } Sutton Council - data, - %a{ :href => "http://uk-postcodes.com" } UK Postcodes API - and - %a{ :href => "http://sinatrarb.com" } Sinatra. - %p - Hosted by - %a{ :href => "http://heroku.com" } Heroku. - Source at - %a{ :href => "http://github.com/adrianshort" } Github. - -@@home -%form{ :method => 'get', :action => '/wards' } - %label{ :for => "postcode" } Postcode - %input{ :type => 'text', :name => 'postcode', :size => 8, :maxlength => 8 } - %input{ :type => 'submit', :value => "Find" } --# - - for ward in @wards - %p= ward - - -@@wards -%h2 #{@postcode} is in #{@ward_name} Ward in #{@district_name} \ No newline at end of file diff --git a/public/style.css b/public/style.css index 1975a08..894c39e 100644 --- a/public/style.css +++ b/public/style.css @@ -11,4 +11,9 @@ input { font-size: 150%; text-transform: uppercase; +} + +.highlight +{ + background-color: yellow; } \ No newline at end of file diff --git a/views/home.haml b/views/home.haml new file mode 100644 index 0000000..c98ea93 --- /dev/null +++ b/views/home.haml @@ -0,0 +1,7 @@ +%form{ :method => 'get', :action => '/wards' } + %label{ :for => "postcode" } Postcode + %input{ :type => 'text', :name => 'postcode', :size => 8, :maxlength => 8 } + %input{ :type => 'submit', :value => "Find" } +-# + - for ward in @wards + %p= ward \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml new file mode 100644 index 0000000..d23ea93 --- /dev/null +++ b/views/layout.haml @@ -0,0 +1,15 @@ +!!! Strict +%html + %head + %title Find My Candidates + %link{ :rel => 'stylesheet', :type => 'text/css', :href => 'style.css' } + %body + #header + %h1 Find My Candidates + #main + = yield + #footer + %hr + %p + Made by + %a{ :href => "http://adrianshort.co.uk/" } Adrian Short \ No newline at end of file diff --git a/views/wards.haml b/views/wards.haml new file mode 100644 index 0000000..e5d56ba --- /dev/null +++ b/views/wards.haml @@ -0,0 +1,7 @@ +%h2 + %span.highlight + = @postcode + is in + = @ward_name + Ward in + = @district_name \ No newline at end of file