Skip to content

Commit

Permalink
moving more stuff from docs stash
Browse files Browse the repository at this point in the history
  • Loading branch information
SallyMcGrath committed Feb 22, 2024
1 parent 9f7c4d9 commit b161ae6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
3 changes: 3 additions & 0 deletions common-docs/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ main_org_name = "Code Your Future"
org = "https://github.com/CodeYourFuture"
repo = "https://github.com/CodeYourFuture/curriculum/"
root = "curriculum"
# No proxy - we don't mind if example issues are incomplete
issuesorgapi = "https://api.github.com/repos/CodeYourFuture/"

[security.funcs]
# Allow accessing a GitHub bearer token to avoid rate limits when doing HTTP fetches to the GitHub API.
# This can be generated at https://github.com/settings/tokens?type=beta and needs read-only access to all public CYF GitHub repos.
Expand Down
2 changes: 1 addition & 1 deletion common-docs/layouts/partials/block/local.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="c-block__title e-heading__2" id="{{ $blockData.name |urlize }}">
{{ partial "objectives/block.html" . }}
</details>
{{ end }}
{{ if $block.Params.Partial }}
{{ if $block.Params.Path }}
{{ partial "story.html" $block}}
{{ end}}
</section>
13 changes: 11 additions & 2 deletions common-docs/layouts/partials/mock-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
{{/* Page Content */}}
{{ .Scratch.SetInMap "mockPage" "Content" "<p>This is mock content.</p>" }}

{{/* Shortcode Inners */}}
{{ .Scratch.SetInMap "mockPage" "Inner" "This is mock content." }}
{{/* Permalink */}}
{{ .Scratch.SetInMap "mockPage" "Permalink" "http://example.com/mock-permalink" }}

Expand Down Expand Up @@ -46,10 +48,10 @@
{{ .Scratch.SetInMap "mockPage" "IsSection" false }}

{{/* Section Name */}}
{{ .Scratch.SetInMap "mockPage" "Section" "blog" }}
{{ .Scratch.SetInMap "mockPage" "Section" "Sprint" }}

{{/* Layout Type */}}
{{ .Scratch.SetInMap "mockPage" "Layout" "post" }}
{{ .Scratch.SetInMap "mockPage" "Layout" "prep" }}

{{/* Navigation Links - Set as empty if not applicable */}}
{{ .Scratch.SetInMap "mockPage" "Next" "" }}
Expand Down Expand Up @@ -78,6 +80,13 @@
{{/* Menus - Define menu items as needed */}}
{{ .Scratch.SetInMap "mockPage" "Menus" (dict "main" (slice (dict "Name" "mock Menu Item" "URL" "/mock-menu-item"))) }}

{{/* PARAMS from front matter */}}
{{ $Params := (dict) }}

{{ .Scratch.SetInMap "Params" "URL" "http://example.com"}}
{{ .Scratch.SetInMap "Params" "backlog" "Module-HTML-CSS"}}
{{ .Scratch.SetInMap "Params" "backlog_filter" "Week 1"}}
{{ .Scratch.SetInMap "mockPage" "Params" $Params}}
{{/* ==================
The mockPage object in Scratch is now ready to be used in stories
================== */}}
17 changes: 7 additions & 10 deletions common-docs/layouts/partials/story.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ <h2>There's no code at that endpoint - check your path in block front matter</h2
role="tab"
aria-controls="{{ .Title | urlize }}_code-panel"
>Code</button>
<button
{{ if .Params.partial }}
<button
id="{{ .Title | urlize }}_render"
data-toggle="tab"
class="c-tabs__tab e-heading__3"
role="tab"
aria-controls="{{ .Title | urlize }}_render-panel"
>Render</button>
{{ end}}
</div>

<!-- Tab Content -->
Expand All @@ -76,6 +78,7 @@ <h3><a href="{{$docsFile}}">Notes 🔗</a></h3>
{{else}}
<p>There's no documentation for this block yet! <a href="{{$docsFile}}">Add documentation</a></p>
{{end}}
<hr>
<div class="c-note c-note--tip">
<h5 class="c-note__title">Something missing? Something wrong?</h5>
<p class="c-note__text">Help us improve this page by <a href="{{$docsFile}}">contributing</a> or <a href="{{$.Site.Params.repo}}issues/new">raising an issue</a></p>
Expand Down Expand Up @@ -110,7 +113,6 @@ <h3><a href="{{$historyPage}}">History 🔗</a></h3>
<dt>No PRs reference this! It was likely built in the first commit</dt>
<dd><a href="{{$firstCommit.html_url}}">SHA {{$firstCommit.sha}}</a></dd>
{{ end}}

</dl>
{{ end }}

Expand All @@ -125,16 +127,11 @@ <h5>📆 Code Last updated: <a href="{{$latestCommit.html_url }}"><time datetime
{{ $fencedCode | markdownify }}
</section>

<!-- Render Panel -->
<div class="c-tabs__panel" role="tabpanel" aria-labelledby="#{{ .Title | urlize }}_render" id="{{ .Title | urlize }}_render-panel">
{{ if .Params.partial }}
<div class="c-tabs__panel" role="tabpanel" aria-labelledby="#{{ .Title | urlize }}_render" id="{{ .Title | urlize }}_render-panel">
{{ partial .Params.partial $mockPage }}
{{ else}}
No render available
{{ end }}
</div>
{{ end}}
</div>
</tab-panels>
{{ end }}


{{ end }}

0 comments on commit b161ae6

Please sign in to comment.