Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
106 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1 @@ | ||
site_title: Mike Bloy | ||
main: | ||
- id: index | ||
title: Intro | ||
url: / | ||
|
||
- id: professional | ||
title: Professional | ||
url: /professional.html | ||
|
||
- id: personal | ||
title: Personal | ||
url: /personal.html | ||
|
||
- id: resume | ||
title: Resume | ||
url: /resume.html | ||
|
||
- id: colophon | ||
title: Colophon | ||
url: /colophon.html | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,96 @@ | ||
module NavLinkHelpers | ||
def nav_link(link) | ||
content_tag(:li, {:id => "nav_#{link[:id]}"}) do | ||
link_to(link[:title], link[:url], | ||
title: (link[:extended_title] ? link[:extended_title] : link[:title])) | ||
def main_menu_items | ||
resources = sitemap.where(:menu => true).all | ||
resources.map{ |resource| NavMenuItem.new(resource) }.sort | ||
end | ||
|
||
def social_menu_items | ||
[ EmailMenuItem.new(data.contact.email) ] + | ||
data.contact.social.map{|item| SocialMenuItem.new(item) } | ||
end | ||
|
||
def menu_item(item) | ||
li_opts = {} | ||
li_opts[:id] = "nav_#{item.html_id}" if item.html_id | ||
content_tag(:li, li_opts) do | ||
link_to(item.name, item.link, title: item.title) | ||
end | ||
end | ||
|
||
end | ||
|
||
|
||
class SocialMenuItem | ||
def initialize(item) | ||
@item = item | ||
end | ||
|
||
def name | ||
@item[:title] | ||
end | ||
|
||
def title | ||
@item[:extended_title] || @item[:title] | ||
end | ||
|
||
def link | ||
@item[:url] | ||
end | ||
|
||
def html_id | ||
@item[:id] | ||
end | ||
end | ||
|
||
|
||
class EmailMenuItem < SocialMenuItem | ||
def initialize(email) | ||
@item = { | ||
id: 'email', | ||
title: 'Email', | ||
extended_title: "Email: #{email}", | ||
url: "mailto:#{email}" | ||
} | ||
end | ||
end | ||
|
||
|
||
class NavMenuItem | ||
def initialize(resource) | ||
@resource = resource | ||
end | ||
|
||
def name | ||
if @resource.data.link && @resource.data.link.name | ||
@resource.data.link.name | ||
else | ||
title | ||
end | ||
end | ||
|
||
def email_nav_link | ||
email = data.contact.email | ||
nav_link(id: 'email', | ||
title: 'Email', | ||
extended_title: "Email: #{email}", | ||
url: "mailto:#{email}") | ||
def title | ||
if @resource.data.link && @resource.data.link.title | ||
@resource.data.link.title | ||
elsif @resource.data.title | ||
@resource.data.title | ||
else | ||
@resource.path.gsub(/#{@resource.ext}$/, '') | ||
end | ||
end | ||
|
||
def link | ||
@resource.url | ||
end | ||
|
||
def weight | ||
@resource.data.weight.to_i | ||
end | ||
|
||
def <=>(other) | ||
[weight, name] <=> [other.weight, other.name] | ||
end | ||
|
||
def html_id | ||
@resource.path.gsub(/#{@resource.ext}$/, '') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
--- | ||
layout: false | ||
menu: true | ||
title: Resume | ||
--- | ||
<!DOCTYPE html> | ||
<!-- /ht Paul Irish - http://front.ie/j5OMXi --> | ||
|