Skip to content

Commit

Permalink
201623-site merge (#353)
Browse files Browse the repository at this point in the history
* docs: update 2016 to 201623 in everywhere but the actual go module name

* Replaced Text Banners with Logo-Based Titles, Blue-Shifted the banner backgrounds to increase contrast with the text, and inverted the current and next element so it blends with its new blue background less

* Rounds edges generally across the website

* Fixed a missing curly bracket that I missed when sorting a merge conflict cause I'm an idiot

* added on tap to index

* fix: typo in on_demand model

* yeet sessions (#30)

Removes Outdated Live Music at URY Sections

* Reduces Border Radius on new curved objects, converts common curves to variables for easier editing, and fixes some general issues

* cleaned up index infobar (#29)

Cleans up index infobar, removes links to individual teams and now links to get involved

* moved teams to about us page, deleted the old teams page (#33)

* Updated Dockerfile and Makefile - MG

* moved teams to about and deleted original teams page

* chore: add nix flake for devshell (#35)

adds nix flake for devshell

---------

Co-authored-by: Ashhhleyyy <ash@ashhhleyyy.dev>
Co-authored-by: Kory Anderson <100381096+Keeeeeeeen@users.noreply.github.com>
Co-authored-by: JP5457 <92054647+JP5457@users.noreply.github.com>
Co-authored-by: dizorganised <135864395+dizorganised@users.noreply.github.com>
  • Loading branch information
5 people committed May 15, 2024
1 parent 4304de1 commit b1e3c4e
Show file tree
Hide file tree
Showing 48 changed files with 1,050 additions and 313 deletions.
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

0 comments on commit b1e3c4e

Please sign in to comment.