This repository has been archived by the owner on Apr 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging doc updates, UI improvements, breadcrumb refactor (#893)
* second iteration of deprecated docs * more reference changes * changed id_token sample (#887) * replaced skyforms with bootstrap forms (#888) * Updated live auth docs (#889) * changed id_token sample * updated error msg for /otp returning 400 code 16 * Added comma to 4xx json object * Sandbox UX improvements and analytics (#890) * Moved sandbox instructions above the form * Added Google Analytics events for form submissions and errors. * replaced breadcrumb liquid template with modified jekyll-breadcrumbs module (#892) * Delete api-draft Unused file
- Loading branch information
1 parent
e2cc111
commit f572fb6
Showing
4 changed files
with
106 additions
and
26 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,25 +1,46 @@ | |||
<div class="breadcrumbs hidden-print"> | {% assign url = page.url | remove: "/" %} | ||
<div class="container"> |
|
||
<h1 class="pull-left">{{ page.title }}</h1> | {% if url.size > 0 %} | ||
<ol class="pull-right breadcrumb"> | <nav class="breadcrumbs hidden-print"> | ||
<li><a href="{{ site.baseurl }}/">Home</a></li> | <div class="container"> | ||
{% assign crumbs = page.url | split: '/' %} | <h1 class="pull-left">{{ page.title }}</h1> | ||
{% assign crumbs_total = crumbs | size | minus: 1 %} |
|
||
{% for crumb in crumbs offset: 1 %} | <ol class="pull-right breadcrumb" vocab="http://schema.org/" typeof="BreadcrumbList"> | ||
{% if forloop.index == crumbs_total %} |
|
||
<li class="active"><a href="{{ site.baseurl | append: page.url }}">{{ page.title }}</a></li> | {% comment %} List home page for all bread crumbs {% endcomment %} | ||
{% else %} | {% assign position = 1 %} | ||
{% assign crumb_limit = forloop.index | plus: 1 %} |
|
||
{% capture crumb_url %}{% for c in crumbs limit: crumb_limit %}{{ c | append: '/' }}{% endfor %}{% endcapture %} | <li class="active" property="itemListElement" typeof="ListItem"> | ||
{% assign crumb_with_index = crumb_url | append: 'index.html' %} | <a property="item" typeof="WebPage" href="{{ "/" | prepend: site.baseurl }}"> | ||
{% assign current_page = site.baseurl | append: page.url %} | <span property="name">Home</span> | ||
{% for p in site.pages %} | </a> | ||
{% if crumb_with_index != current_page and crumb_with_index == p.url %} | <meta property="position" content="{{ position }}" /> | ||
<li><a href="{{ crumb_with_index }}">{{ crumb | replace: '-', ' ' | capitalize }}</a> | </li> | ||
{% endif %} |
|
||
{% endfor %} | {% comment %} Iteration breadcrumb item {% endcomment %} | ||
{% endif %} | {% for crumb in breadcrumbs %} | ||
{% endfor %} |
|
||
</ol> | {% comment %} Skip if root {% endcomment %} | ||
</div> | {% if crumb.url == "/" %} | ||
</div><!--/breadcrumbs--> | {% continue %} | ||
{% endif %} | |||
|
|||
{% comment %} SEO data {% endcomment %} | |||
{% assign position = position | plus: 1 %} | |||
|
|||
{% comment %} List crumbs leading up to the page title {% endcomment %} | |||
{% if crumb.url != page.url %} | |||
<li class="active" property="itemListElement" typeof="ListItem"> | |||
<a property="item" typeof="WebPage" href="{{ crumb.url | prepend: site.baseurl }}"> | |||
<span property="name">{{ crumb.title }}</span> | |||
</a> | |||
<meta property="position" content="{{ position }}" /> | |||
</li> | |||
{% endif %} | |||
|
|||
{% endfor %} | |||
|
|||
</ol> | |||
</div> | |||
</nav> | |||
{% endif %} |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
require_relative 'drops/breadcrumb_item.rb' | |||
|
|||
Jekyll::Hooks.register :pages, :pre_render do |page, payload| | |||
drop = Drops::BreadcrumbItem | |||
|
|||
if page.url == "/" | |||
then payload["breadcrumbs"] = [ | |||
drop.new(page, payload) | |||
] | |||
else | |||
payload["breadcrumbs"] = [] | |||
pth = page.url.split("/") | |||
|
|||
0.upto(pth.size - 1) do |int| | |||
joined_path = pth[0..int].join("/") | |||
item = page.site.pages.find { |page_| joined_path == "" && page_.url == "/" || page_.url.chomp("/") == joined_path } | |||
payload["breadcrumbs"] << drop.new(item, payload) if item | |||
end | |||
end | |||
end | |||
|
|||
Jekyll::Hooks.register :documents, :pre_render do |documents, payload| | |||
drop = Drops::BreadcrumbItem | |||
|
|||
if documents.url == "/" | |||
then payload["breadcrumbs"] = [ | |||
drop.new(documents, payload) | |||
] | |||
else | |||
payload["breadcrumbs"] = [] | |||
pth = documents.url.split("/") | |||
|
|||
0.upto(pth.size - 1) do |int| | |||
joined_path = pth[0..int].join("/") | |||
item = documents.site.documents.find { |documents| joined_path == "" && documents.url == "/" || documents.url.chomp("/") == joined_path } | |||
payload["breadcrumbs"] << drop.new(item, payload) if item | |||
end | |||
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
module Drops | |||
class BreadcrumbItem < Liquid::Drop | |||
extend Forwardable | |||
|
|||
def_delegator :@page, :data | |||
def_delegator :@page, :url | |||
|
|||
def initialize(page, payload) | |||
@payload = payload | |||
@page = page | |||
end | |||
|
|||
def title | |||
@page.data["breadcrumb"] != nil ? @page.data["breadcrumb"] : @page.data["title"] | |||
end | |||
|
|||
def subset | |||
@page.data["subset"] | |||
end | |||
end | |||
end |