Parcourir la source

Moved templates to /views

tags/last-sinatra-version
Adrian Short il y a 14 ans
Parent
révision
f24adf7fb0
5 fichiers modifiés avec 34 ajouts et 46 suppressions
  1. +0
    -46
      app.rb
  2. +5
    -0
      public/style.css
  3. +7
    -0
      views/home.haml
  4. +15
    -0
      views/layout.haml
  5. +7
    -0
      views/wards.haml

+ 0
- 46
app.rb Voir le fichier

@@ -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}

+ 5
- 0
public/style.css Voir le fichier

@@ -11,4 +11,9 @@ input
{
font-size: 150%;
text-transform: uppercase;
}

.highlight
{
background-color: yellow;
}

+ 7
- 0
views/home.haml Voir le fichier

@@ -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

+ 15
- 0
views/layout.haml Voir le fichier

@@ -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

+ 7
- 0
views/wards.haml Voir le fichier

@@ -0,0 +1,7 @@
%h2
%span.highlight
= @postcode
is in
= @ward_name
Ward in
= @district_name

Chargement…
Annuler
Enregistrer