diff --git a/data/about.json b/data/about.json new file mode 100644 index 0000000..243aca2 --- /dev/null +++ b/data/about.json @@ -0,0 +1,5 @@ +[ + "para 1", + "para 2", + "etc." +] diff --git a/data/faq.json b/data/faq.json new file mode 100644 index 0000000..227e51e --- /dev/null +++ b/data/faq.json @@ -0,0 +1,6 @@ +[ + { + "question":"What's a 'yeet'?", + "answer":"Well you see, Billy..." + } +] diff --git a/data/posts.json b/data/posts.json new file mode 100644 index 0000000..4a297e2 --- /dev/null +++ b/data/posts.json @@ -0,0 +1,13 @@ +[ + { + "title": "yeet", + "author": "tem", + "date": 1538830250255, + "tags": [ + "yeet", + "yeetbix", + "the yeet movement" + ], + "content": "#Title\nText\n- List item 1\n- List item 2" + } +] diff --git a/index.html b/index.html index 64edd75..bd4498f 100644 --- a/index.html +++ b/index.html @@ -1,45 +1,26 @@ - + - {{heading}} + {{title}} +
-
- -
+
- -
-
- Footer
+ +
diff --git a/scripts/app.js b/scripts/app.js index f0b6640..e4f52e1 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -1,15 +1,14 @@ var app = angular.module("app", ["ngRoute"]); app.config( - function ($routeProvider, $locationProvider) + function ($routeProvider) { $routeProvider .when("/", {templateUrl: "views/blog.html", controller: "blog"}) .when("/create", {templateUrl: "views/create.html", controller: "create"}) .when("/about", {templateUrl: "views/about.html", controller: "about"}) .when("/faq", {templateUrl: "views/faq.html", controller: "faq"}) - .otherwise("

yeey

"); - // $locationProvider.html5mode({enabled: true, requireBase: false}); + .otherwise({templateUrl: "404.html"}); } ); @@ -100,54 +99,35 @@ app.controller("faq", ] ); -app.controller("navbar", - [ - "$scope", - "$location", - function($scope, $location) - { - $scope.setNews = function() - { - $location.path('/'); - $scope.newsButton = "current"; - $scope.createButton = ""; - $scope.aboutButton = ""; - $scope.loginButton = ""; - } - $scope.setContentCreation = function() - { - $location.path('/content'); - $scope.newsButton = ""; - $scope.createButton = "current"; - $scope.aboutButton = ""; - $scope.loginButton = ""; - } - $scope.setAbout = function() - { - $location.path('/about'); - $scope.newsButton = ""; - $scope.createButton = ""; - $scope.aboutButton = "current"; - $scope.loginButton = ""; - } - $scope.setLogin = function() - { - $location.path('/login'); - $scope.newsButton = ""; - $scope.createButton = ""; - $scope.aboutButton = ""; - $scope.loginButton = "current"; - } - } - ] -); +app.controller("navButtons", ["$scope", "$location", + function($scope, $location) + { + // Set the current relative path + // Helpful to set the navButtons appropriately when refreshing + $scope.current = $location.path(); -app.controller("header", + // Changes location to the given target and sets the current path + $scope.navClick = (target) => + { + $location.path(target); + $scope.current = target; + } + + // Applies the 'current' class if the target matches the current path + $scope.isCurrent = (target) => + { + return $scope.current == target ? "current" : ""; + } + } +]); + +// -specific functionality +app.controller("head", [ "$scope", function($scope) { - $scope.heading = "Lemonblog"; + $scope.title = "Lemonblog"; } ] ); diff --git a/server.js b/server.js index 8bcee99..3f167df 100644 --- a/server.js +++ b/server.js @@ -6,10 +6,10 @@ var app = express(); app.use(express.static("./")); // Serve static files from root app.use(express.json()); // Parse JSON in requests -app.use("/", (req, res, next) => // Finally send a 404 page -{ - res.status(404).sendFile("404.html", {"root": "./"}); -}); +// app.use("/", (req, res, next) => // Finally send a 404 page +// { +// res.status(404).sendFile("404.html", {"root": "./"}); +// }); // Root route, respond with with index.html app.get("/", function(req, res) { diff --git a/styles/default.css b/styles/default.css index bd28391..6e9568a 100644 --- a/styles/default.css +++ b/styles/default.css @@ -11,6 +11,7 @@ body, position: relative; + height: 100%; /* y tho */ margin: 0; /* Override the default page border */ padding: 0; @@ -104,6 +105,7 @@ a padding-right: 10px; padding-left: 10px; + transition: box-shadow .2s ease; text-align: center; color: #fff; @@ -112,8 +114,11 @@ a .navButtons a.current { color: #000; - background-color: #fff; - box-shadow: inset 0 -10px 0 0 #000; /* Box shadow hack to get an inset border */ + box-shadow: inset 0 60px 0 0 #fff; /* Box shadow hack to get an inset border */ +} +.navButtons a:hover:not(.current) +{ + box-shadow: inset 0 10px 0 0 #fff; } .footerContainer diff --git a/views/about.html b/views/about.html new file mode 100644 index 0000000..f708132 --- /dev/null +++ b/views/about.html @@ -0,0 +1,2 @@ +

This is some about text

+

This will be replaced in the near future with something a touch more meaningful. In the meantime, though, enjoy some Lorem Ipsum courtesy of https://lipsum.com.

diff --git a/views/footer.html b/views/footer.html new file mode 100644 index 0000000..f33f44e --- /dev/null +++ b/views/footer.html @@ -0,0 +1,3 @@ +
+ Footer +
diff --git a/views/header.html b/views/header.html new file mode 100644 index 0000000..b6b9e66 --- /dev/null +++ b/views/header.html @@ -0,0 +1,13 @@ +
+
+ + + Lemonblog + + + adds zest to your day + + + +
+
diff --git a/views/navbuttons.html b/views/navbuttons.html new file mode 100644 index 0000000..8cf8a30 --- /dev/null +++ b/views/navbuttons.html @@ -0,0 +1,5 @@ + diff --git a/views/sidebar.html b/views/sidebar.html new file mode 100644 index 0000000..470720c --- /dev/null +++ b/views/sidebar.html @@ -0,0 +1,3 @@ +