Skip to content

Commit

Permalink
better layout
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingmachine committed Oct 25, 2014
1 parent 567ab0e commit 470cc6f
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Rules
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ compile '*' do
item_layout = "default"

case item.attributes[:filename]
when /home/ then
filter :redcarpet, :options => {fenced_code_blocks: true, tables: true}, :renderer => RedcarpetSyntaxHighlighter
layout "home"
when /haml$/ then
filter :haml
layout item_layout
Expand Down
13 changes: 6 additions & 7 deletions layouts/default.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
%a{:href => "/"}
CLOJURE<span> for the </span>BRAVE<span> and </span>TRUE
.subtitle
%span a practical book for stouthearted beginners
%span the hobbit-approved guide to learning Clojure
.lambda
λ
.engage-me-please
.container
%a.buy{:href => "https://leanpub.com/clojure-for-the-brave-and-true"} Buy the DRM-free PDF, epub, and mobi!
%a.buy{:href => "https://leanpub.com/clojure-for-the-brave-and-true"} Buy the DRM-free PDF, epub, and mobi for $35!
%form#mc-embedded-subscribe-form.validate{:action => "http://flyingmachinestudios.us1.list-manage.com/subscribe/post?u=60763b0c4890c24bd055f32e6&amp;amp;id=0b40ffd1e1", :method => "post", :name => "mc-embedded-subscribe-form", :novalidate => "", :target => "_blank"}
%p
Spending your nights pining for the next chapter of
Expand All @@ -37,6 +37,7 @@
or subscribe for email updates:
%input#mce-EMAIL.email{:name => "EMAIL", :placeholder => "email address", :required => "", :type => "email", :value => ""}/
%input#mc-embedded-subscribe.button{:name => "subscribe", :type => "submit", :value => "Subscribe!"}/

#top-nav
.items.container
%ul
Expand All @@ -55,11 +56,11 @@
%form#search{:action => "/search/"}
%input#tipue_search_input{:name => "q", :type => "search", :placeholder => "search site"}
%li
%a.buy{:href => "https://leanpub.com/clojure-for-the-brave-and-true"} buy the ebook!!?!
%a.buy{:href => "https://leanpub.com/clojure-for-the-brave-and-true"} buy the ebook $35!!?!
%li.subscribe
%form#mc-embedded-subscribe-form.validate{:action => "http://flyingmachinestudios.us1.list-manage.com/subscribe/post?u=60763b0c4890c24bd055f32e6&amp;amp;id=0b40ffd1e1", :method => "post", :name => "mc-embedded-subscribe-form", :novalidate => "", :target => "_blank"}
%input#mce-EMAIL.email{:name => "EMAIL", :placeholder => "email address", :required => "", :type => "email", :value => ""}/
%input#mc-embedded-subscribe.button{:name => "subscribe", :type => "submit", :value => "subscribe"}/
%input#mc-embedded-subscribe.button{:name => "subscribe", :type => "submit", :value => "get email updates"}/
%li.tweet
%a.twitter-share-button{:href => "https://twitter.com/share"} tweet bravely and truly
:javascript
Expand All @@ -68,7 +69,6 @@
.page.container
.chapter-nav
.wrapper

.content
= find_and_preserve(yield)
.pagenav.bottom
Expand All @@ -83,8 +83,7 @@
.next
%a{:href => relative_path_to(i)}
= i[:link_title]
&rarr;

&rarr;
#disqus_thread
:javascript
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
Expand Down
105 changes: 105 additions & 0 deletions layouts/home.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
!!!
- @items = chapters
- count = @items.size
- index = @items.index(@item)
%html{:lang => "en"}
%head
%meta{:charset => "utf-8"}/
%meta{:path => @item.path}
%base{:href => "/"}/
%title
Learn Clojure with Clojure for the Brave and True
%link{:href => relative_path_to("/stylesheets/main.css"), :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => relative_path_to("/stylesheets/pygments.css"), :media => "screen", :rel => "stylesheet", :type => "text/css"}/
%link{:href => 'http://fonts.googleapis.com/css?family=Oswald:400,300|Gentium+Book+Basic:400,700|Fjalla+One|Courgette', :rel => 'stylesheet', :type => 'text/css'}
%body
.masthead
.container
.title
%a{:href => "/"}
CLOJURE<span> for the </span>BRAVE<span> and </span>TRUE
.subtitle
%span the hobbit-approved guide to learning Clojure
.lambda
λ
.engage-me-please
.container
%form#mc-embedded-subscribe-form.validate{:action => "http://flyingmachinestudios.us1.list-manage.com/subscribe/post?u=60763b0c4890c24bd055f32e6&amp;amp;id=0b40ffd1e1", :method => "post", :name => "mc-embedded-subscribe-form", :novalidate => "", :target => "_blank"}
%p
Spending your nights pining for the next chapter of
<em>Clojure for the Brave and True</em>?
%br/
Then follow
%a{:href => "https://twitter.com/nonrecursive"} @nonrecursive
or subscribe for email updates:
%input#mce-EMAIL.email{:name => "EMAIL", :placeholder => "email address", :required => "", :type => "email", :value => ""}/
%input#mc-embedded-subscribe.button{:name => "subscribe", :type => "submit", :value => "Subscribe!"}/
#top-nav
.items.container
%ul
%li.home
- if index
- if index != 0
- i = @items[index - 1]

%a{:href => relative_path_to(i)}
&larr;
%a{:href => "/#toc"} &uarr;
- if i = @items[index + 1]
%a{:href => relative_path_to(i)}
&rarr;
%li.chapters
%form#search{:action => "/search/"}
%input#tipue_search_input{:name => "q", :type => "search", :placeholder => "search site"}
%li.subscribe
%form#mc-embedded-subscribe-form.validate{:action => "http://flyingmachinestudios.us1.list-manage.com/subscribe/post?u=60763b0c4890c24bd055f32e6&amp;amp;id=0b40ffd1e1", :method => "post", :name => "mc-embedded-subscribe-form", :novalidate => "", :target => "_blank"}
%input#mce-EMAIL.email{:name => "EMAIL", :placeholder => "email address", :required => "", :type => "email", :value => ""}/
%input#mc-embedded-subscribe.button{:name => "subscribe", :type => "submit", :value => "get email updates"}/
%li.tweet
%a.twitter-share-button{:href => "https://twitter.com/share"} tweet bravely and truly
:javascript
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs')

.page.container

.content
= find_and_preserve(yield)
.pagenav.bottom
- if index
- if index != 0
- i = @items[index - 1]
.prev
%a{:href => relative_path_to(i)}
&larr;
= i[:link_title]
- if i = @items[index + 1]
.next
%a{:href => relative_path_to(i)}
= i[:link_title]
&rarr;
#disqus_thread
:javascript
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'clojureforthebraveandtrue'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

%script{:src => "https://code.jquery.com/jquery-2.1.1.min.js"}
%script{:src => relative_path_to("/javascripts/jquery.sticky.js")}
%script{:src => relative_path_to("/javascripts/sticky.js")}
:javascript
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43463851-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

0 comments on commit 470cc6f

Please sign in to comment.