LSmith97 / Mingo

A social media website
0 stars 2 forks source link

GLOWS #23

Open jhsu79 opened 1 year ago

jhsu79 commented 1 year ago

GLOW One piece of code that we were proud of was our use of partials to repeat the post container whenever we wanted to display posts. While we recognize that there may be other places where we could dry up the code, we were proud of doing so here.

Another piece of functionality that we were excited about was the ability to access all user posts simply by one click on the user's name. We did forget to demo the functionality in our presentation.

Lastly, we were all extremely proud of our ability to collaborate seamlessly together and exceed our expectations and goals on a daily basis.


<%- include('../partials/header') %>

<%- include('../partials/posts') %>

<%- include('../partials/footer') %>
<% posts.forEach(function(p){ %>
    <div class= 'post-container'>
         <div class="title-line">
             <a href="/posts/<%=p._id%>"><h2><%= p.title  %></h2></a>
             <p class="review-user"><img alt="avatar" src="<%= p.userAvatar %>" referrerpolicy="no-referrer" ><a href="/users/<%= p.user %>"><%= p.userName %></a></p>
             <% if (p.isEdited) { %> 
                 <p class="edited">edited <%= p.updatedAt.toLocaleString()  %></p>
             <% } else { %>
                 <p class="edited">posted <%= p.createdAt.toLocaleString() %></p>
             <% } %>           

         </div>
         <p><%= p.body  %></p>
         <div class="comment-line">
            <a href="/posts/<%=p._id%>"><img class="comment-icon" src="//i.imgur.com/OpBsUpR.png" alt="comment-icon"></a>
            <a href="/posts/<%=p._id%>"><%=p.comments.length%> Comments</a>
         </div>
     </div>
 <%})%>
maker-jws commented 1 year ago

As mentioned in the presentation you are already starting to think about the nature of your model data and how it might impact the content displayed in the view. Your use of partials led to easier to maintain code and a degree of flexibility a static template could not deliver. Great work! Very advanced stuff team! If you are already considering breaking down complex, repetitive UI into partials - you will love React.