Skip to content

Commit

Permalink
Merge branch 'main' into vscode-intro-video
Browse files Browse the repository at this point in the history
  • Loading branch information
moneyinthesky committed Jul 27, 2024
2 parents d88d4fe + ac3eba3 commit 111ab03
Show file tree
Hide file tree
Showing 39 changed files with 350 additions and 276 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Dependencies
/node_modules
**/node_modules
**/_vendor
# Production
/build
**/public
Expand Down
2 changes: 1 addition & 1 deletion common-content/en/blocks/demo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ At {{<our-name>}} we expect you to demo your work to the class. You must have ma

The timekeeper will keep the groups on track.

Split into groups of no more than 5 people. Each person will have 2 minutes to demo their work to the group. After the demo, the group will give feedback for 10 minutes. Then the next person will demo their work.
Split randomly into groups of no more than 5 people. Each person will have 2 minutes to demo their work to the group. After the demo, the group will give feedback for 10 minutes. Then the next person will demo their work.

## 🧑🏼‍🎓 Trainees

Expand Down
2 changes: 1 addition & 1 deletion common-content/en/blocks/setup-project-teams/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is a project you will build in a team. First form your team, then start the

#### We recommend:

- [ ] Create a Slack channel for your team. Use this channel and your class time for communication about the project management and the product development.
- [ ] Create a temporary Slack channel for your team. Use this channel and your class time for communication about the project management and the product development.
- [ ] Each team member must understand the requirements of a ticket before moving it from the Backlog to Ready. Make use of your class time to discuss the tickets as a team.
- [ ] Decide whether you are going to work on tickets individually or as a pair. You may work faster on your own but may learn more as a pair.
- [ ] Each feature must be reviewed by another member of your team . Set a branch protection rule on your main branch to enforce this.
Expand Down
26 changes: 0 additions & 26 deletions common-content/en/blocks/study-45/index.md

This file was deleted.

26 changes: 0 additions & 26 deletions common-content/en/blocks/study-60/index.md

This file was deleted.

19 changes: 0 additions & 19 deletions common-content/en/blocks/study-90/index.md

This file was deleted.

File renamed without changes.
5 changes: 2 additions & 3 deletions common-theme/layouts/_default/success.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ <h2 class="e-heading__4 c-objectives__title is-invisible">
{{/* Retrieve the blockData from Scratch */}}
{{ $blockData := $.Page.Scratch.Get "blockData" }}
{{/* Depending on the type of block, call the appropriate partial */}}
{{ if or (eq $blockData.type "readme") (eq $blockData.type "pd") }}
{{ if or (eq $blockData.type "readme") }}
{{ partial "objectives/parsed" (dict "blockData" $blockData "pageContext" $pageContext) }}
{{ end }}
{{ if or (eq $blockData.type "local") (eq $blockData.type "local_course") }}
{{ else }}
{{ partial "objectives/lookup.html" (dict "blockData" $blockData "pageContext" $pageContext) }}
{{ end }}

Expand Down
7 changes: 3 additions & 4 deletions common-theme/layouts/partials/block/data.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{{ else }}
{{ if "github" | in $src }}
{{/* Change base URL to api.github.com */}}
{{ $newSrc := replace $src "https://github.com/CodeYourFuture/" "https://api.github.com/repos/CodeYourFuture/" }}
{{ $newSrc := replace $src "https://github.com/" "https://api.github.com/repos/" }}

{{ if (in $src "issues") }}
{{ .Scratch.SetInMap "blockData" "type" "issue" }}
Expand All @@ -69,10 +69,9 @@

{{ if "cyf-pd.netlify.app" | in $src }}
{{ .Scratch.SetInMap "blockData" "type" "pd" }}
{{ $blockPath := replace $src "https://cyf-pd.netlify.app/blocks/" "" }}
{{ $blockPath := replace $src "https://cyf-pd.netlify.app/blocks/" "pd/blocks/" }}
{{ $blockPath := replace $blockPath "/readme/" "" }}
{{ $newSrc := printf "https://api.github.com/repos/CodeYourFuture/CYF-PD/readme/content/blocks/%s/" $blockPath }}
{{ .Scratch.SetInMap "blockData" "api" $newSrc }}
{{ .Scratch.SetInMap "blockData" "api" $blockPath }}
{{ end }}

{{ if "youtu" | in $src }}
Expand Down
51 changes: 10 additions & 41 deletions common-theme/layouts/partials/block/pd.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,28 @@
{{ $blockData := .Page.Scratch.Get "blockData" }}
{{ $pageContext := . }}
{{ $block := $blockData }}
{{ $tab_set_id := $blockData.name | anchorize }}
{{ $issueForm := print $.Site.Params.org "/" $.Site.Params.pdrepo "/issues/new?assignees=&labels=Feedback&template=feedback_template.yml&title=Feedback+on+" ($blockData.name | urlize) }}

{{ with resources.GetRemote $blockData.api $blockData.headers }}
{{ with .Err }}
{{ errorf "Failed %s on %s. Error: %s" $blockData.api $pageContext.Title . }}
{{ end }}

{{ $response := .Content | unmarshal }}

{{/* Here we are decoding the content from the base64 readme API
and turning it back into a Hugo doc with front matter
TODO: move this to a regular mounted module and dump all this
*/}}
{{ $decodedContent := $response.content | base64Decode }}
{{ $placeholder := "UNIQUE_PLACEHOLDER" }}
{{ $decodedContentWithPlaceholder :=
replaceRE "((?:.*---.*){1})---" "${1}" $decodedContent
}}
{{ $contentParts := split $decodedContentWithPlaceholder $placeholder }}
{{ $frontMatter := index $contentParts 0 }}
{{ $markdownContent := index $contentParts 1 }}
{{ $parsedFrontMatter := $frontMatter | transform.Unmarshal }}

{{/* We get PD times from the font-matter in the PD CMS, not the block's own front-matter */}}
{{ $.Page.Scratch.SetInMap "blockData" "time" $parsedFrontMatter.time }}
{{ $block = $parsedFrontMatter | default $blockData }}


{{ with .Page.Site.GetPage $blockData.api }}
<section
class="c-block c-block--{{ $blockData.type }}"
aria-labelledby="{{ $blockData.name |urlize }}">
<header class="c-block__header">
<h2
class="c-block__title e-heading__2"
id="{{ $blockData.name |urlize }}">
<a href="{{ $response.html_url }}">{{ $block.title }} 🔗</a>
{{ .Title }}
</h2>
<a href="{{ $issueForm }}" class="c-block__feedback e-button"
>🤙🏽 Feedback</a
>
{{ partial "time.html" $pageContext }}

</header>

{{ with $markdownContent }}
{{ with .Content }}
<section class="c-copy">{{ . | markdownify }}</section>
{{ end }}

{{/* These tabs are based on tabs.html and provision the same web component */}}


<tab-panels class="c-tabs c-tabs--pd">
<div class="c-tabs__list" id="{{ $tab_set_id }}" role="tablist">
Expand All @@ -64,7 +35,7 @@
aria-selected="true">
👉🏽 PD Session
</button>
{{ range $index, $item := $block.exercises }}
{{ range $index, $item := .Params.Exercises }}
<button
data-toggle="tab"
id="tab-label-{{ $item.name | anchorize }}"
Expand All @@ -75,16 +46,16 @@
🧩 {{ add 1 $index }})
{{ trim $item.name " " | truncate 20 }}
</button>
{{- end -}}
{{ end }}
</div>

<div class="c-tabs__group" id="{{ $tab_set_id }}">
{{/* First tab is all the setup */}}
<div
id="{{ $tab_set_id }}-intro"
class="c-tabs__panel c-tabs__panel--pd is-active"
role="tabpanel"
aria-labelledby="tab-label-intro">
{{ with $block.objectives }}
{{ with .Params.Objectives }}
<details class="c-objectives">
<summary>
<h3 class="c-objectives__title e-heading__5">
Expand All @@ -94,24 +65,22 @@ <h3 class="c-objectives__title e-heading__5">
{{ partial "objectives/block.html" . }}
</details>
{{ end }}
{{ with $block.prep }}
{{ with .Params.Prep }}
<section class="c-copy">
<h3>Preparation</h3>
<div class="c-copy__node">{{ . | markdownify }}</div>
</section>
{{ end }}
{{ with $block.introduction }}
{{ with .Params.Introduction }}
<section class="c-copy">
<h3>Introduction</h3>
<div class="c-copy__node">{{ . | markdownify }}</div>
</section>
{{ end }}
</div>

{{/* Now we go to range over exercises */}}
{{ with $block.exercises }}
{{ with .Params.Exercises }}
{{ range . }}
{{ $tab_set_id := $tab_set_id }}
<div
id="{{ $tab_set_id }}-{{ .name | anchorize }}"
class="c-tabs__panel c-tabs__panel--pd"
Expand Down
119 changes: 63 additions & 56 deletions common-theme/layouts/partials/issues.html
Original file line number Diff line number Diff line change
@@ -1,69 +1,76 @@
{{/* This is a page, basically, not a block, so we don't go via blockData for now */}}
{{ $repo := .Params.backlog }}
{{ $issuesUrlBase := print $.Site.Params.orgapi $repo "/issues?per_page=100&state=open&direction=asc&page=" }}
{{ $issuesUrl := print $.Site.Params.orgapi $repo "/issues?per_page=100&state=open&direction=asc" }}
{{ $filter := .Params.backlog_filter }}
{{ $currentPath := .Page.RelPermalink }}
{{ $headers := partial "github-auth.html" }}
{{/* <!-- walk through paginated issues --> */}}
{{ .Page.Scratch.Set "issues" slice }}
{{ partial "fetch-paginated-issues.html" (dict "Scratch" .Page.Scratch "issuesUrlBase" $issuesUrlBase "currentPath" $currentPath "page" 1 "headers" $headers) }}
{{ $issues := .Page.Scratch.Get "issues" }}

{{/* <!-- if no object show error --> */}}
{{ if ne $issues nil }}
<!-- range over issues list and pull out useful data -->
{{ range $issues }}
{{ with resources.GetRemote $issuesUrl $headers }}
{{ with .Err }}
{{ errorf "Failed %s on %s. Error: %s" $issuesUrl .Page.Title . }}
{{ end }}

{{ with .Content }}
{{ if eq . "[]" }}
{{ warnf "No issues found at %s" $issuesUrl }}
{{ else }}
{{ $issues := . | unmarshal }}
{{/* <!-- range over issues list and pull out useful data --> */}}
{{ range $issues }}

{{ $showIssue := true }}
<!-- if a filter exists, only show issues with the right label -->
{{ if $filter }}
{{ $showIssue = false }}
{{ range .labels }}
{{ if in .name
$filter
}}
{{ $showIssue = true }}
{{ $showIssue := true }}
{{/* <!-- if a filter exists, only show issues with the right label --> */}}
{{ if $filter }}
{{ $showIssue = false }}
{{ range .labels }}
{{ if in .name
$filter
}}
{{ $showIssue = true }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
<!-- now show the issue -->
{{ if $showIssue }}
{{ if strings.Contains .body "_No response_" }}
{{ errorf "Issue %s contains _No response_ - please edit the issue to remove it." .html_url }}
{{ end }}
<div class="c-alert" role="alert" hidden>
<span class="alert__message"></span>
<button aria-label="Close" class="clean-btn close" type="button">
<span aria-hidden="true">&times;</span>
</button>
</div>
<details class="c-issue">
<summary class="c-issue__title e-heading__3">
{{ .title }} <a class="c-issue__link" href="{{ .html_url }}">🔗</a>
<a
href="/api/clone?state={{ dict "issue" .number "module" $repo "sprint" $filter "prevPath" $currentPath | jsonify }}"
class="e-button"
data-props="{{ $currentPath }}">
Clone
</a>
</summary>
<div class="c-issue__body">{{ .body | markdownify }}</div>
</details>
{{ with .labels }}
<ul class="c-issue__labels c-label__list">
{{ range . }}
<li class="c-issue__label c-label" style="--github:#{{ .color }}4d">
<span
class="c-issue__label-name c-label__name"
title="{{ .description }}">
{{ .name }}
</span>
</li>
<!-- now show the issue -->
{{ if $showIssue }}
{{ if strings.Contains .body "_No response_" }}
{{ errorf "Issue %s contains _No response_ - please edit the issue to remove it." .html_url }}
{{ end }}
</ul>
<div class="c-alert" role="alert" hidden>
<span class="alert__message"></span>
<button aria-label="Close" class="clean-btn close" type="button">
<span aria-hidden="true">&times;</span>
</button>
</div>
<details class="c-issue">
<summary class="c-issue__title e-heading__3">
{{ .title }}
<a class="c-issue__link" href="{{ .html_url }}">🔗</a>
<a
href="/api/clone?state={{ dict "issue" .number "module" $repo "sprint" $filter "prevPath" $currentPath | jsonify }}"
class="e-button"
data-props="{{ $currentPath }}">
Clone
</a>
</summary>
<div class="c-issue__body">{{ .body | markdownify }}</div>
</details>
{{ with .labels }}
<ul class="c-issue__labels c-label__list">
{{ range . }}
<li
class="c-issue__label c-label"
style="--github:#{{ .color }}4d">
<span
class="c-issue__label-name c-label__name"
title="{{ .description }}">
{{ .name }}
</span>
</li>
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ else }}
{{ errorf "Error, fetch of %s failed: %v" $issuesUrlBase $issues }}
{{ end }}
Loading

0 comments on commit 111ab03

Please sign in to comment.