Skip to content

Commit

Permalink
Merge pull request #9 from lukemassa/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
lukemassa authored Dec 19, 2024
2 parents 46653ee + 54ed412 commit 58281e8
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 83 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: BSFishy/pip-action@v1
- uses: actions/setup-go@v5
with:
packages: |
j2cli
go-version-file: 'go.mod'
- run: make
- name: Setup Pages
uses: actions/configure-pages@v2
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
html:
@cd src/templates; j2 index.html > $(CURDIR)/docs/index.html
@cd src/templates; j2 weeks.html > $(CURDIR)/docs/weeks.html
@cd src/templates; j2 about.html > $(CURDIR)/docs/about.html
@cd src/templates; j2 oneweek.html > $(CURDIR)/docs/oneweek.html
@cd src/templates; j2 upcomingweeks.html > $(CURDIR)/docs/upcomingweeks.html
@cd src/templates; j2 submit.html > $(CURDIR)/docs/submit.html
@cd src/templates; j2 getinvolved.html > $(CURDIR)/docs/getinvolved.html
@go run main.go

development:
git rev-parse HEAD > $(CURDIR)/docs/commit.txt
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
FROM ckaserer/j2cli
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
RUN yum install -y golang
6 changes: 0 additions & 6 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,5 @@ build:
push:
docker push $(NS)/$(REPO):$(VERSION)

run:
docker run --rm --name $(NAME)-shell $(VOLUMES) $(NS)/$(REPO):$(VERSION) ./bin/report_who_can ndmad2 zookeeper-operator

email:
docker run --rm --name $(NAME)-shell $(VOLUMES) $(NS)/$(REPO):$(VERSION) ./bin/report_who_can ndmad2 zookeeper-operator --email [email protected]

shell:
docker run --rm --name $(NAME)-shell $(VOLUMES) -it $(NS)/$(REPO):$(VERSION) sh
8 changes: 4 additions & 4 deletions docker/Makefile.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NS = public.ecr.aws/d9x3d3q1/jclubtakeaways
VERSION ?= latest
NS = public.ecr.aws/d9x3d3q1
VERSION ?= 0.1.0

REPO = tester
NAME = tester
REPO = jclubtakeaways
NAME = jclubtakeaways
3 changes: 3 additions & 0 deletions docker/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Not totally sure how to deploy this.

I created a user with privileges and pushed it up to ECR, should find a better way
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/lukemassa/jclubtakeaways-gui

go 1.23
Empty file added go.sum
Empty file.
70 changes: 70 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package main

import (
"fmt"
"html/template"
"log"
"os"
"path/filepath"
"strings"
)

const (
srcDir = "src/templates"
outputDir = "docs"
)

func main() {
// Define the source directory for templates and the output directory for rendered files
// Ensure the output directory exists
err := os.MkdirAll(outputDir, os.ModePerm)
if err != nil {
log.Fatalf("Error creating output directory: %v", err)
}
entries, err := os.ReadDir(srcDir)
if err != nil {
log.Fatal(err)
}
for _, entry := range entries {
if entry.IsDir() {
continue
}
if entry.Name() == "base.html" {
continue
}

t, err := template.ParseFiles(filepath.Join(srcDir, "base.html"), filepath.Join(srcDir, entry.Name()))
if err != nil {
log.Fatal(err)
}
for _, tmplName := range t.Templates() {
if tmplName.Name() != entry.Name() {
continue
}
// Print the name of the template
if !strings.HasSuffix(tmplName.Name(), ".html") {
continue
}
err = renderTemplate(tmplName)
if err != nil {
log.Fatal(err)
}
}
}
}
func renderTemplate(tmpl *template.Template) error {
// Create an output file for each template
outputFile, err := os.Create(filepath.Join(outputDir, tmpl.Name()))
if err != nil {
return fmt.Errorf("error creating output file: %v", err)
}
defer outputFile.Close()

// Render the template (without any data, or you can pass data as needed)
err = tmpl.Execute(outputFile, nil)
if err != nil {
return fmt.Errorf("error rendering template: %v", err)
}

return nil
}
15 changes: 5 additions & 10 deletions src/templates/about.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{% extends "base.html" %}

{% block pageheader %}
{{ template "base.html" . -}}
{{ define "pageheader" }}
<h2 id="header">About JClub
</h2>
{% endblock %}

{% block pagebody %}

{{ end -}}
{{ define "pagebody" }}
<h3>What’s Journal Club?
</h3>

Expand Down Expand Up @@ -45,6 +42,4 @@ <h3>Who is welcome at Jclub?
<p>Anyone who is curious, is always learning, and wishes to be in the company of those who feel the same way.
<br>
<p>In-person Jclub attendance is limited by the discretion of the hosts, but the virtual living room of Jclub is always open to all. You’re invited to join us anytime you’re available.


{% endblock %}
{{ end -}}
27 changes: 10 additions & 17 deletions src/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-sheetrock/1.1.4/dist/sheetrock.min.js"></script>
<!--<link rel="stylesheet" href="///Users/luke/jclubtakeaways/docs/css/css.js"></script>-->

<title>JClub Takeaways</title>
{% block head %}{% endblock %}

{{ block "head" .}}{{ end }}
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
Expand All @@ -36,26 +34,23 @@
<ul id="navbar-right" class="nav navbar-nav navbar-right">
</ul>

</div><!--/.nav-collapse -->
</div> <!-- container -->
</div>
</div>
</nav>

<div class="page-header">

</div><!-- page-header -->
</div>

<body>
<div class="container">
<div class="page-header">
{% block pageheader %}
{% endblock %}
</div><!-- page-header -->

{% block pagebody %}{% endblock %}
</div> <!-- container -->


{% block pagefooter %}{% endblock %}
{{ block "pageheader" .}}
{{ end }}
</div>
{{ block "pagebody" .}}{{ end }}
</div>
{{ block "pagefooter" .}}{{ end }}
<table id="placeholder" style="display: none;"></table>
</body>
<script>
Expand Down Expand Up @@ -104,7 +99,6 @@
var label = labels[j];
var value = cells[j];

//I don't want to escape the "/", so I am looking at this one explicitly
if (label == "Date") {
if (/^[0-9\/]+$/.test(value)) {
rowobj[label] = value
Expand Down Expand Up @@ -198,7 +192,6 @@

function oneweek_from_row(row) {
var datestr = row[0];
//I don't want to escape the "/", so I am looking at this one explicitly
if (! /^[0-9\/]+$/.test(datestr))
return null;
var date = new Date(datestr);
Expand Down
8 changes: 4 additions & 4 deletions src/templates/getinvolved.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{{ template "base.html" . -}}


{% block pagebody %}
{{ define "pagebody" }}

<div>

Expand Down Expand Up @@ -59,7 +59,7 @@ <h3>Present at Jclub</h3>
</div>
<div role="tabpanel" class="tab-pane" id="host">
<h3>Sign up to host Jclub</h3>
<p>Starting in 2023, local Jclubbers will have the option to gather in person groups to attend hybrid Jclubs. A local speaker that opts to present in-person to a hybrid audience may host in their home, or be hosted by a Boston-area Jclub member.</p>
<p>Starting in 2023, local Jclubbers will have the option to gather in person groups to attend hybrid Jclubs. A local speaker that opts to present in-person to a hybrid audience may host in their home, or be hosted by a Cambridge-area Jclub member.</p>

<h3> Tips for hosting IRL Jclub</h3>

Expand Down Expand Up @@ -110,4 +110,4 @@ <h3> Tips for hosting IRL Jclub</h3>

</script>

{% endblock %}
{{ end -}}
14 changes: 7 additions & 7 deletions src/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "base.html" %}
{{ template "base.html" . -}}

{% block head %}
{{ define "head" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
{% endblock %}
{% block pageheader %}
{{ end -}}
{{ define "pageheader" }}
<h3 id="header">
</h3>
{% endblock %}
{{ end -}}

{% block pagebody %}
{{ define "pagebody" }}
<form id="takeaway">
<div class="form-group">
<label for='name'>Name</label>
Expand All @@ -30,4 +30,4 @@ <h3 id="header">
window.location.href = "/submit.html#" + last_thursday;
});
</script>
{% endblock %}
{{ end -}}
14 changes: 7 additions & 7 deletions src/templates/oneweek.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "base.html" %}
{{ template "base.html" . -}}

{% block head %}
{{ define "head" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
{% endblock %}
{% block pageheader %}
{{ end -}}
{{ define "pageheader" }}
<h3 id="header">
</h3>
{% endblock %}
{{ end -}}

{% block pagebody %}
{{ define "pagebody" }}
<table id="oneweek" class="table table-condensed table-striped">
<thead>
<th>Name</th>
Expand Down Expand Up @@ -71,4 +71,4 @@ <h3 id="header">
});
});
</script>
{% endblock %}
{{ end -}}
14 changes: 7 additions & 7 deletions src/templates/submit.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "base.html" %}
{{ template "base.html" . -}}

{% block head %}
{{ define "head" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
{% endblock %}
{% block pageheader %}
{{ end -}}
{{ define "pageheader" }}
<h3 id="header">
</h3>
{% endblock %}
{{ end -}}

{% block pagebody %}
{{ define "pagebody" }}
<form id="takeaway">
<div class="form-group">
<label for='name'>Name</label>
Expand Down Expand Up @@ -60,4 +60,4 @@ <h3 id="header">
});
});
</script>
{% endblock %}
{{ end -}}
10 changes: 5 additions & 5 deletions src/templates/upcomingweeks.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends "base.html" %}
{{ template "base.html" . -}}

{% block pageheader %}
{{ define "pageheader" }}
<h3 id="header">Upcoming Weeks
</h3>
{% endblock %}
{{ end -}}

{% block pagebody %}
{{ define "pagebody" }}
<table id="weeks" class="table table-condensed table-striped">
<thead>
<th>Date</th>
Expand Down Expand Up @@ -36,4 +36,4 @@ <h3 id="header">Upcoming Weeks
});
});
</script>
{% endblock %}
{{ end -}}
10 changes: 5 additions & 5 deletions src/templates/weeks.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends "base.html" %}
{{ template "base.html" . -}}

{% block pageheader %}
{{ define "pageheader" }}
<h3 id="header">Previous Weeks
</h3>
{% endblock %}
{{ end -}}

{% block pagebody %}
{{ define "pagebody" }}
<table id="weeks" class="table table-condensed table-striped">
<thead>
<th>Date</th>
Expand Down Expand Up @@ -35,4 +35,4 @@ <h3 id="header">Previous Weeks
});
});
</script>
{% endblock %}
{{ end -}}

0 comments on commit 58281e8

Please sign in to comment.