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

201623-site merge #353

Merged
merged 21 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b78442f
docs: update 2016 to 201623 in everywhere but the actual go module name
ashhhleyyy Oct 11, 2023
a7d180c
Replaced Text Banners with Logo-Based Titles, Blue-Shifted the banner…
Keeeeeeeen Sep 25, 2023
66eec3b
Rounds edges generally across the website
Keeeeeeeen Oct 26, 2023
3426f51
Merge pull request #5 from UniversityRadioYork/docker-fixes
Keeeeeeeen Oct 27, 2023
cbe89bf
Merge pull request #6 from UniversityRadioYork/kory-headers
Keeeeeeeen Oct 29, 2023
81dc7f2
Merge branch 'development' into kory-curvening
Keeeeeeeen Oct 29, 2023
991b1ac
Merge pull request #7 from UniversityRadioYork/kory-curvening
Keeeeeeeen Oct 29, 2023
65a3530
Fixed a missing curly bracket that I missed when sorting a merge conf…
Keeeeeeeen Oct 29, 2023
03dcb97
Merge pull request #8 from UniversityRadioYork/i-fucked-the-merge-con…
JP5457 Oct 29, 2023
5d8e5af
added on tap to index
alyxbb Nov 3, 2023
ce51842
fix: typo in on_demand model
alyxbb Nov 4, 2023
d83cd72
Merge pull request #27 from UniversityRadioYork/alyxbb-ontap-homepage
Keeeeeeeen Nov 4, 2023
b3a35e2
Merge pull request #28 from UniversityRadioYork/alyxbb-typo
Keeeeeeeen Nov 4, 2023
7fbb09c
yeet sessions (#30)
alyxbb Nov 5, 2023
b5d8dff
Reduces Border Radius on new curved objects, converts common curves t…
Keeeeeeeen Oct 31, 2023
07302b5
Merge pull request #32 from UniversityRadioYork/kory-misc-changes
alyxbb Nov 5, 2023
64fb8e5
cleaned up index infobar (#29)
alyxbb Nov 5, 2023
158d4b4
moved teams to about us page, deleted the old teams page (#33)
dizorganised Nov 10, 2023
433e929
Merge branch 'UniversityRadioYork:development' into development
Keeeeeeeen Nov 17, 2023
79924fb
Merge branch 'UniversityRadioYork:development' into development
Keeeeeeeen Dec 8, 2023
f5da8d7
chore: add nix flake for devshell (#35)
ashhhleyyy Dec 29, 2023
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ public/css/*.scss.css
.myradio.key
config.toml
public/css/*.scss.css.map

.direnv/
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ RUN set -e && \
cp /usr/local/sassc-$SASS_VERSION/bin/sassc /usr/local/bin/sassc && \
rm -rf /usr/local/sassc-$SASS_VERSION /usr/local/libsass-$SASS_VERSION

RUN mkdir -p /go/src/github.com/UniversityRadioYork/2016-site
WORKDIR /go/src/github.com/UniversityRadioYork/2016-site
WORKDIR /usr/src/app

COPY . /go/src/github.com/UniversityRadioYork/2016-site
COPY . /usr/src/app/

EXPOSE 3000

RUN go get -d -v
RUN go get

ENV TZ "Europe/London"

EXPOSE 3000

ENTRYPOINT echo "\033[0;31mWARNING: \033[0mRunning with Docker will change \"localhost\" to \"0.0.0.0\" in your config. Remember to change it back!" && \
sed -i 's/localhost/0.0.0.0/g' *.toml && make run
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ build-sass: $(SASS_SRC)
$(SASS_COMPILER) $(MAIN_FILE) $(OUTPUT_FILE) -t compressed

build-docker-image:
docker build -t 2016-site .
docker build -t 201623-site .

docker:
docker run -it --rm -p 3000:3000 -v $$GOPATH/src/github.com/UniversityRadioYork/2016-site:/go/src/github.com/UniversityRadioYork/2016-site 2016-site
docker run -it --rm -p 3000:3000 -v .:/usr/src/app 201623-site

clean:
rm -f $(OUTPUT_FILE) $(BINARY)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 2016-site #
# 201623-site #

## How to install ##
Full instructions for installation are available in the USING.md file.
Expand Down
8 changes: 4 additions & 4 deletions USING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export GOPATH=~/go

#### Pulling from git
* Make sure GOPATH is set (`echo $GOPATH`)
* `go get github.com/UniversityRadioYork/2016-site`
* This downloads 2016-site to ~/go/src/github.com/UniversityRadioYork/2016-site along with all necessary dependencies
* To update your working copy of the repo, running `go get` in the 2016-site directory, but you can also checkout to a specific branch if required:
* `go get github.com/UniversityRadioYork/201623-site`
* This downloads 201623-site to ~/go/src/github.com/UniversityRadioYork/201623-site along with all necessary dependencies
* To update your working copy of the repo, running `go get` in the 201623-site directory, but you can also checkout to a specific branch if required:
* `git checkout this-is-a-branch-name`

#### Running the server =====
Expand All @@ -51,7 +51,7 @@ export GOPATH=~/go

### Editing files
#### Ubuntu
Trivial. Open a file editor and browse to ~/go/src/github.com/UniversityRadioYork/2016-site
Trivial. Open a file editor and browse to ~/go/src/github.com/UniversityRadioYork/201623-site

#### Windows
* Windows likes to hide the actual files for the Ubuntu subsystem.
Expand Down
1 change: 0 additions & 1 deletion config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@

[pageContext.youtube]
APIKey = "AIzaSyCzI5Gvpq1hPlfjvB81EVc0vLv_11eW7NI"
sessionsPlaylistID = "PLsxUDJzU4VKDudlmlYb-ImFKreFKAfFln"
cinPlaylistID = "PLsxUDJzU4VKAAH1pOogbzJx7pZgd-2zOx"
channelURL = "//youtube.com/ury1350"

Expand Down
43 changes: 43 additions & 0 deletions controllers/about.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package controllers

import (
"log"
"net/http"

"github.com/UniversityRadioYork/2016-site/models"
"github.com/UniversityRadioYork/2016-site/structs"
"github.com/UniversityRadioYork/2016-site/utils"
"github.com/UniversityRadioYork/myradio-go"
)

// AboutController is the controller for the about page.
type AboutController struct {
Controller
}

// NewAboutController returns a new AboutController with the MyRadio session s
// and configuration context c.
func NewAboutController(s *myradio.Session, c *structs.Config) *AboutController {
return &AboutController{Controller{session: s, config: c}}
}

// Get handles the HTTP GET request r for the about us page, writing to w.
func (aboutC *AboutController) Get(w http.ResponseWriter, r *http.Request) {
teamM := models.NewTeamModel(aboutC.session)
teams, err := teamM.GetAll()
if err != nil {
log.Println(err)
utils.RenderTemplate(w, aboutC.config.PageContext, nil, "404.tmpl")
return
}
data := struct {
Teams []myradio.Team
}{
Teams: teams,
}
err = utils.RenderTemplate(w, aboutC.config.PageContext, data, "about.tmpl")
if err != nil {
log.Println(err)
return
}
}
10 changes: 5 additions & 5 deletions controllers/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type IndexController struct {
type RenderData struct {
CurrentAndNext *myradio.CurrentAndNext
Banners []myradio.Banner
Teams []myradio.Team
Timeslots []myradio.Timeslot
Podcasts []myradio.Podcast
MsgBoxError bool
ShowOnAir bool
Expand All @@ -36,7 +36,7 @@ func (ic *IndexController) Get(w http.ResponseWriter, r *http.Request) {
// This is where any form params would be parsed
model := models.NewIndexModel(ic.session)

currentAndNext, banners, teams, podcasts, showOnAir, err := model.Get()
currentAndNext, banners, timeslots, podcasts, showOnAir, err := model.Get()

if err != nil {
log.Println(err)
Expand All @@ -46,7 +46,7 @@ func (ic *IndexController) Get(w http.ResponseWriter, r *http.Request) {
data := RenderData{
CurrentAndNext: currentAndNext,
Banners: banners,
Teams: teams,
Timeslots: timeslots,
Podcasts: podcasts,
ShowOnAir: showOnAir,
MsgBoxError: false,
Expand All @@ -64,7 +64,7 @@ func (ic *IndexController) Post(w http.ResponseWriter, r *http.Request) {
// Get all the data for the webpage
model := models.NewIndexModel(ic.session)

currentAndNext, banners, teams, podcasts, showOnAir, err := model.Get()
currentAndNext, banners, timeslots, podcasts, showOnAir, err := model.Get()

if err != nil {
log.Println(err)
Expand All @@ -74,7 +74,7 @@ func (ic *IndexController) Post(w http.ResponseWriter, r *http.Request) {
data := RenderData{
CurrentAndNext: currentAndNext,
Banners: banners,
Teams: teams,
Timeslots: timeslots,
Podcasts: podcasts,
ShowOnAir: showOnAir,
MsgBoxError: false,
Expand Down
9 changes: 0 additions & 9 deletions controllers/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ func NewStaticController(c *structs.Config) *StaticController {
return &StaticController{Controller{config: c}}
}

// GetAbout handles the HTTP GET request r for the About page, writing to w.
func (staticC *StaticController) GetAbout(w http.ResponseWriter, r *http.Request) {
err := utils.RenderTemplate(w, staticC.config.PageContext, nil, "about.tmpl")
if err != nil {
log.Println(err)
return
}
}

// GetContact handles the HTTP GET request r for the Contact page, writing to w.
func (staticC *StaticController) GetContact(w http.ResponseWriter, r *http.Request) {
err := utils.RenderTemplate(w, staticC.config.PageContext, nil, "contact.tmpl")
Expand Down
21 changes: 0 additions & 21 deletions controllers/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,3 @@ func (teamC *TeamController) Get(w http.ResponseWriter, r *http.Request) {
return
}
}

// GetAll handles the HTTP GET request r for the all teams page, writing to w.
func (teamC *TeamController) GetAll(w http.ResponseWriter, r *http.Request) {
teamM := models.NewTeamModel(teamC.session)
teams, err := teamM.GetAll()
if err != nil {
log.Println(err)
utils.RenderTemplate(w, teamC.config.PageContext, nil, "404.tmpl")
return
}
data := struct {
Teams []myradio.Team
}{
Teams: teams,
}
err = utils.RenderTemplate(w, teamC.config.PageContext, data, "teams.tmpl")
if err != nil {
log.Println(err)
return
}
}
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem(system:
let
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) lib;
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
sassc
gnumake
go
];
};
}
);
}
10 changes: 6 additions & 4 deletions models/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewIndexModel(s *myradio.Session) *IndexModel {
//
// On success, it returns the current and next show, and nil.
// Otherwise, it returns undefined data and the error causing failure.
func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []myradio.Banner, teams []myradio.Team, podcasts []myradio.Podcast, showOnAir bool, err error) {
func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []myradio.Banner, timeslots []myradio.Timeslot, podcasts []myradio.Podcast, showOnAir bool, err error) {
currentAndNext, err = m.session.GetCurrentAndNext()
if err != nil {
return
Expand All @@ -28,12 +28,14 @@ func (m *IndexModel) Get() (currentAndNext *myradio.CurrentAndNext, banners []my
if err != nil {
return
}

teams, err = m.session.GetCurrentTeams()
timeslots, err = m.session.GetPreviousTimeslots(11)
if err != nil {
return
}

// If show currently on air, remove it from previous timeslots
if currentAndNext.Current.Id != 0 {
timeslots = timeslots[1:11]
}
//Get 10 podcasts from page 0 (the latest podcasts)
allpodcasts, err := m.session.GetAllPodcasts(10, 0, false)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions models/on_demand.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ func (m *OnDemandModel) GetLastMixcloudTimeslots() (timeslots []myradio.Timeslot
if err != nil {
return
}
currrentAndNext, err := m.session.GetCurrentAndNext()
currentAndNext, err := m.session.GetCurrentAndNext()
if err != nil {
return
}
// If show currently on air, remove it from previous timeslots
if currrentAndNext.Current.Id != 0 {
if currentAndNext.Current.Id != 0 {
timeslots = timeslots[1:11]
}
return
Expand Down
Loading
Loading