Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1204 Reduce duplication in module project tickets #1224

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion common-theme/layouts/_default/backlog.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
{{ define "main" }}
{{ $backlog_filter := .Page.Params.backlog_filter }}
{{ $repos := .Page.Params.backlog }}
{{ if not (reflect.IsSlice $repos) }}
{{ $repos = slice $repos }}
{{ end }}
<article>
{{ partial "page-header.html" . }}
{{ with .Content }}
<section class="c-copy">{{ . }}</section>
{{ end }}
{{ partial "issues.html" . }}
{{/* you can have multiple repos but probably for sanity let's just stick with one label filter
for each repo, grab the issues that match the filter
*/}}
{{ range $repos }}
{{ $issueBlocks := partial "block/issues-list-as-blocks.html" (dict "backlog" . "backlog_filter" $backlog_filter) }}
{{ range $issueBlocks }}
<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">
{{ .name }}
<a class="c-issue__link" href="{{ .src }}">🔗</a>
<a
href="https://curriculum.codeyourfuture.io/api/clone?state={{ dict "issue" .number "module" .Page.Params.backlog "sprint" .Page.Params.backlog_filter "prevURL" (urls.AbsLangURL .Page.RelPermalink) | jsonify }}"
class="e-button"
data-props="{{ .Page.RelPermalink }}">
Clone
</a>
</summary>
<div class="c-issue__body">
{{ partial "block/block.html" (dict "block" . "Page"
$.Page "Site" site )
}}
</div>
</details>
{{ with .labels.nodes }}
<ul class="c-issue__labels c-label__list">
{{ range . }}
<li
class="c-issue__label c-label"
style="--color:#{{ .color }}4d">
<span
class="c-issue__label-name c-label__name"
title="{{ .description }}">
{{ .name }}
</span>
</li>
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ end }}
</article>
{{ end }}
26 changes: 14 additions & 12 deletions common-theme/layouts/partials/block/issue.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@
{{ end }}
{{ end }}
{{ end }}

{{/* extract objectives */}}
{{ $extractedObjectives := partial "strings/extract-github-objectives.html" $response.body }}

{{ if gt (len $extractedObjectives) 0 }}
<details>
<summary>
<h3 class="e-heading__4">Learning Objectives</h3>
</summary>
{{ range $extractedObjectives }}
{{ . | markdownify }}
{{ end }}
</details>
{{ end }}
</header>
{{/* extract objectives */}}
{{ $extractedObjectives := partial "strings/extract-github-objectives.html" $response.body }}

{{ if gt (len $extractedObjectives) 0 }}
<details>
<summary>
<h3 class="e-heading__5">Learning Objectives</h3>
</summary>
{{ range $extractedObjectives }}
{{ . | markdownify }}
{{ end }}
</details>
{{ end }}
<div class="c-block__content c-copy">
{{ $response.body | markdownify }}
</div>
Expand Down
20 changes: 17 additions & 3 deletions common-theme/layouts/partials/block/issues-list-as-blocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
nodes {
title
url
number
labels(
first: 25
orderBy: {
direction: DESC
field: NAME
}
) {
nodes {
name
color
description
}
}
}
}
}
Expand All @@ -37,9 +51,9 @@
{{ $issueBlocks := slice }}
{{ with resources.GetRemote "https://api.github.com/graphql" (merge $request (partial "github-auth.html" .)) }}
{{ with .Content | unmarshal }}
{{ with .data.repository.issues }}
{{ range .nodes }}
{{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" .url) }}
{{ with .data.repository.issues.nodes }}
{{ range sort . "title" "asc" }}
{{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" .url "number" .number "labels" .labels) }}
{{ end }}
{{ end }}
{{ end }}
Expand Down
96 changes: 0 additions & 96 deletions common-theme/layouts/partials/issues.html

This file was deleted.

14 changes: 10 additions & 4 deletions common-theme/layouts/partials/page-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@
<h2
class="c-page-header__subtitle c-page-header__backlog e-heading__3"
data-pagefind-weight="0.5">
{{ $repos := .Page.Params.backlog | default ""}}
{{ if not (reflect.IsSlice $repos)}}
{{ $repos = slice .Page.Params.backlog}}
{{ end}}
{{ range $repos}}
<a
class="c-page-header__link"
href="{{ .Page.Site.Params.org }}/{{ .Page.Params.backlog }}/issues"
>{{ .Page.Params.backlog }}
🔗</a
>
href="{{ site.Params.org }}/{{ . }}/issues"
> {{ . }}
🔗 </a
>&nbsp;
{{ end}}
</h2>
{{ else }}
{{ with .Page.Description }}
Expand Down
Loading