Skip to content

Commit

Permalink
Updated org map to new Organization struct, updated templates, added …
Browse files Browse the repository at this point in the history
…Lake afton PNG file. (#109)

Co-authored-by: James Kupke <[email protected]>
  • Loading branch information
jameskupke and James Kupke authored Oct 4, 2023
1 parent 27c8f76 commit acf7bfd
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func issueSearch(ctx context.Context, label, token string, ch chan<- Issue) erro

q := fmt.Sprintf(`is:open type:issue label:"%s"`, label)
for k, v := range orgs {
if v == true {
if v.Visible == true {
q += " org:" + k
}
}
Expand Down
29 changes: 28 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ import (
"github.com/unrolled/render"
)

type Organization struct {
Title string
ImagePath string
Visible bool
}

// Any project under one of these organizations counts
var orgs = map[string]Organization{
"devict": {
Title: "devICT",
ImagePath: "public/images/logos/devict.svg",
Visible: true,
},
"makeict": {
Title: "makeICT",
ImagePath: "public/images/logos/makeict.svg",
Visible: true,
},
"lake-afton-public-observatory": {
Title: "Lake Afton Public Observatory",
ImagePath: "public/images/logos/lake-afton.png",
Visible: true,
},
}

/*
// Any project under one of these organizations counts
var orgs = map[string]bool{
"devict": true,
Expand All @@ -26,6 +52,7 @@ var orgs = map[string]bool{
"ennovar": false,
"lake-afton-public-observatory": true,
}
*/

type Project struct {
Title string
Expand Down Expand Up @@ -166,7 +193,7 @@ func logger(h http.Handler) http.Handler {

func home(w http.ResponseWriter, r *http.Request) {
data := struct {
Orgs map[string]bool
Orgs map[string]Organization
Projects map[string]Project
Year int
Config HacktoberfestConfiguration
Expand Down
2 changes: 1 addition & 1 deletion profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func profile(w http.ResponseWriter, r *http.Request) {
}

info := struct {
Orgs map[string]bool
Orgs map[string]Organization
Projects map[string]Project
User goth.User
New bool
Expand Down
2 changes: 1 addition & 1 deletion prs.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func fetchPRs(usernames []string, token string) ([]PR, error) {
}

for i, pr := range prs {
prs[i].Valid = orgs[pr.Repo.Owner] || projects[pr.Repo.Owner+"/"+pr.Repo.Name].Visible
prs[i].Valid = orgs[pr.Repo.Owner].Visible || projects[pr.Repo.Owner+"/"+pr.Repo.Name].Visible
}

return prs, nil
Expand Down
Binary file added public/images/logos/lake-afton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions templates/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@
</div>
<div class="mt-10">
<ul data-sr-slide-up class="grid grid-cols-1 gap-6 sm:grid-cols-2">
{{ range $p, $i := .Orgs }}
{{ if $i }}
{{ range $orgName, $org := .Orgs }}
{{ if $org.Visible }}
<li class="col-span-1 bg-white rounded-lg shadow hover:shadow-md">
<a class="group block text-center w-full" href="https://github.com/{{ $p }}">
<div class="p-6"><img class="block mx-auto max-h-10" src="public/images/logos/{{ $p }}.svg" alt="{{ $p }}"></div>
<a class="group block text-center w-full" href="https://github.com/{{ $orgName }}">
<div class="p-6"><img class="block mx-auto max-h-10" src="{{ $org.ImagePath }}" alt="{{ $org.Title }}"></div>
<div class="border-t border-gray-200">
<div class="flex">
<div class="w-0 flex-1 flex">
Expand Down
8 changes: 4 additions & 4 deletions templates/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
<div class="bg-gray-100 p-6">
<h3 class="text-gray-900 text-xs font-medium uppercase tracking-wide">Organizations</h3>
<ul class="mt-3 grid grid-cols-1 gap-6 sm:grid-cols-2">
{{ range $p, $i := .Orgs }}
{{ if $i }}
{{ range $orgName, $org := .Orgs }}
{{ if $org.Visible }}
<li class="col-span-1 bg-white rounded-lg shadow hover:shadow-md">
<a class="group block text-center w-full" href="https://github.com/{{ $p }}" target="_blank">
<div class="p-6"><img class="block mx-auto max-h-10" src="public/images/logos/{{ $p }}.svg" alt="{{ $p }}"></div>
<a class="group block text-center w-full" href="https://github.com/{{ $orgName }}" target="_blank">
<div class="p-6"><img class="block mx-auto max-h-10" src="{{ $org.ImagePath }}" alt="{{ $org.Title }}"></div>
<div class="border-t border-gray-200">
<div class="flex">
<div class="w-0 flex-1 flex">
Expand Down

0 comments on commit acf7bfd

Please sign in to comment.