Skip to content

Commit 2896fff

Browse files
Merge pull request #1 from WeatherGod3218/weather-dev
feat: Update README
2 parents 4a83ef8 + 926324f commit 2896fff

5 files changed

Lines changed: 53 additions & 42 deletions

File tree

‎README.md‎

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
1-
# counters
2-
Days Since Last Useless House Service was Mode: 0
3-
```mermaid
4-
erDiagram
5-
6-
RESET {
7-
string username
8-
string description
9-
time timestamp
10-
}
11-
COUNTER {
12-
string id
13-
string createdBy
14-
string title
15-
string description
16-
RESET lastReset
17-
list[RESET] history
18-
}
1+
# Counters ![Static Badge](https://img.shields.io/badge/weather-%23b16ded?style=flat&logo=github&logoColor=black&labelColor=0%2C0%2C0&link=https%3A%2F%2Fgithub.com%2FweatherGod3218%2F)
2+
## Day's Since Last Useless House Service was Made: 0
193

20-
```
4+
A simple interface for logging and displaying time since a certain event has occured, allowing for CSHer's to track how long its been since a prior event. Heavily inspired off the "Days since last..." meme format.
5+
6+
This project uses Golang, [Gin](https://fastapi.tiangolo.com/), HTML/CSS, and Javascript.
217

22-
__TODO__
8+
This project ALSO uses a modified version of bootstrap 5! Check it out [here!](https://github.com/ComputerScienceHouse/csh-material-bootstrap/tree/bootstrap-5)
239

24-
[] Load History
10+
## Installing
11+
1. Clone and cd into the repo: git clone https://github.com/WeatherGod3218/counters
12+
>> (OPTIONAL): Make another branch if your working on a large thing!
2513
26-
[] Allow adding a reset
14+
## Setup
15+
1. Make sure you have docker installed
16+
>> (OPTIONAL): You can use docker compose as well!!
17+
2. Copy the .env.template file, rename it to .env and place it in the root folder
18+
3. Ask an RTP for counters secrets, add them to the .env accordingly
2719

28-
[] Implement csh-auth
20+
## Run
2921

30-
[] Make Sections Smaller in Width
22+
Counters is containerized through a docker file.
3123

24+
1. Build the docker file
25+
```
26+
docker build -t Counters .
27+
```
28+
2. Run the newly built docker on port 8000
29+
```
30+
docker run -p 8080:80 Counters
31+
```
32+
33+
## Docker Compose
34+
35+
Counters also has support for Docker Compose, a extended version of docker that simplifies the steps.
36+
37+
(This is a really cool thing! If you use docker often, check it out!)
38+
```
39+
docker compose up
40+
```

‎api.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func GetResetPage(c *gin.Context) {
6161
})
6262
}
6363

64-
func GetCounterId(c *gin.Context) {
64+
func LoadCounter(c *gin.Context) {
6565
idToUse := c.Param("id")
6666

6767
counter, cError := database.GetCounterFromId(c, idToUse)
@@ -89,6 +89,7 @@ func ResetCounter(c *gin.Context) {
8989
resetTime := translateTime(c.PostForm("reset-time"))
9090

9191
reset := &database.Reset{
92+
Id: bson.NewObjectID(),
9293
Reporter: tempName,
9394
Instigator: c.PostForm("reset-user"),
9495
Description: c.PostForm("reset-description"),
@@ -109,6 +110,7 @@ func CreateCounter(c *gin.Context) {
109110
resetTime := translateTime(c.PostForm("reset-time"))
110111

111112
reset := &database.Reset{
113+
Id: bson.NewObjectID(),
112114
Reporter: tempName,
113115
Instigator: c.PostForm("reset-user"),
114116
Description: c.PostForm("reset-description"),

‎main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func main() {
4242
router.Use(auth.CookieMiddleware())
4343

4444
router.GET("/", GetHomePage)
45-
router.GET("counters/:id", GetCounterId)
45+
router.GET("counters/:id", LoadCounter)
4646

4747
router.GET("/create", GetCreatePage)
4848
router.POST("/create", CreateCounter)

‎templates/counter.tmpl‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@
1111
</form>
1212
<br/>
1313
<div>
14-
<ul class="list-group list-unstyled text-wrap text-break">
14+
<ul class="list-group list-unstyled text-wrap text-break w-75 mx-auto">
1515
{{ range $i, $reset := .History }}
16-
<li class = "p-4">
17-
<div class="list-group-item p-3">
16+
<li class = "p-2">
17+
<div class="list-group-item p-2">
1818
<div class="container">
19-
<div class="row">
19+
{{/* <div class="row">
2020
<div class="col-12">
2121
<h3 class="text-center my-2 fs-3">{{ $reset.Description }}</h3>
2222
</div>
23-
</div>
24-
23+
</div> */}}
2524
<div class="row">
26-
<div class="col">
27-
<div class="p-2">
28-
<span class="fs-5">{{ $reset.Description }}</span>
29-
<br/>
30-
<span class="days-since fw-bold display-1" data-timestamp="{{ $reset.Timestamp }}"> </span>
31-
<br/>
32-
<span class="description"><i>reported by: {{ $reset.Reporter }} caused by {{ $reset.Instigator }})</i></span>
33-
</div>
25+
<div class="col d-flex flex-column justify-content-center">
26+
<div class="text-center my-auto">
27+
<span class="fs-5">{{ $reset.Description }}</span>
28+
<br/>
29+
<span class="description"><i>reported by: {{ $reset.Reporter }}</i></span>
30+
</div>
3431
</div>
3532
<div class="col">
36-
<div class="p-2 border bg-light">Box 2</div>
33+
<div class="text-center my-auto">
34+
<span class="days-since fw-bold display-3" data-timestamp="{{ $reset.Timestamp }}"> </span>
35+
<span class="description d-block">Day(s) Ago</span>
36+
</div>
3737
</div>
3838
</div>
3939
</div>

‎templates/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ <h2 class="text-center w-100 mb-3">
99
<input class="form-control" type="text" placeholder= "Find Counters">
1010
<br/>
1111
<div>
12-
<ul class="list-group list-unstyled text-wrap text-break">
12+
<ul class="list-group list-unstyled text-wrap text-break w-75 mx-auto">
1313
{{ range $i, $counter := .Counters }}
1414
<li class="p-1">
1515
<a class="text-center list-group-item list-group-item-action p-3" href="/counters/{{ $counter.IDHex }}">

0 commit comments

Comments
 (0)