Journey into Game Development and Freelance Web Development
I have added Comments to Blog Posts! Anyone can add a comment currently to any blog post. That may change in the future if it becomes an issue, but for now it's fine. Development of the comments didn't take too long, but I had to get re-acquainted with AJAX for returning a Partial View. Normally, when I do an AJAX call, it's just something simple where I'm doing a file upload or delete. But for blog comments, I wanted a way to load all the comments of a specific blog post when the comments section is clicked. The way the blog section works is it loads up to 5 blog posts at a time and when that data is returned, it also returns the count of the comments of each blog post and displays that on a button that a user can then click to expand the comment section and make their own comment. Even with just 5 blog posts on the page, I didn't want to return all the comment data for each entry since I was not planning on paging comments. So, using partial views and AJAX was the first solution that popped into my head. Since I was using AJAX in a way I wasn't used to, I had to play around with it some to figure out what it is I had to do. There were several examples I looked at that didn't quite do what I was going for, and eventually I got enough of a sample to figure out what it is I wanted to do, and how to do it. I ended up making a Modal popup with main body of it set up to render the partial view one the AJAX call returned. I added the Modal markup in the section of the View where I show each blog entry, but now as I'm typing this up, it can probably live outside of it since only 1 Modal needs to be around at any one time (adding that to the backlog). The Modal has a section for the partial view to display the comments as well as input fields for a user to add their own comment. The rest was just javascript/jquery to manipulate UI elements and then simpler AJAX to add/delete comments. Right now, I am the only one who can delete comments, so hopefully the comments section doesn't get too rowdy. Now that the first iteration of the blog is done, I can start on making my own invoice generator.
I finally got around to adding some new functionality to the website. In one of my other projects, I had created a helper class to send emails both synchronously and asynchronously, so I just copied that over to this project and added the appropriate web.config changes and boom, I can now call a function to send emails as needed. Of course, the first thing I implemented that uses this functionality is the ability to subscribe to my blog. This functionality sends an email to the email address entered with a validation code embedded in a link (the link also contains the email address just for additional confirmation). If the link is clicked, it takes you to a page on my website that checks the validation code with the subscribed email and then sets that email address to validated. Now, whenever a new blog post is made, the website will send an email to all validated subscribers notifying them that a new blog entry has been posted. It will send the blog title, blog author, and the date the entry was published. Implementing this has been fairly easy, just a few hours of work and testing. I am happy with the initial implementation but would be curious how it performs under load when it has to send out more than a few emails at a time. I also added a changelog page to give a high level view of what I changed on the site, as well as the date it was updated. I think the next thing I'm going to implement is the ability to comment on blog posts. Though I still haven't decided on anonymous posts or having actual users...
I spent the last two days implementing my own blogging framework using the same technologies used to build this website, though before there was no database and now there is. It was a fun little exercise. I'm happy with the initial implementation and it's got enough basics to be deployed and used (by me, initially). Initial features include: functionality for a logged in user to make a blog post (currently I'm the only user), allow a user to delete any post they have made, navigate through all the blog posts, page by page, filter blog posts via author or via tag. Upcoming features: edit a post, subscribe to the blog (get email alerts when a new post is made), make comments on a post, list view of blog posts that just list title and date. I'm sure as I start to use this more, I'll come up with more features that I'd like to have. Or I guess I can look at what other blogging tools do. I'll probably migrate my previous blog posts from another site that documented my game dev experiences just so I can have it all in one place. Feel free to shoot me an email with any comments you have on the blog design itself or the website or the contents of a blog entry.