nax3t / yelp-camp-refactored Goto Github PK
View Code? Open in Web Editor NEWRefactor of YelpCamp project with Express JS
Refactor of YelpCamp project with Express JS
Hi,
I couldn't find setPassword, logIn and other functions in the package?
Am I missing or overlooking something?
Sir I'll be grateful if you post installing process of mongoDB on another cloude ide other than c9 and codeanywhere plz plz
I've just watched the youtube tutorial on adding admin role and I wanted to know if there's a more elaborate solution to separate the concerns between owning a campground (or comment) and being an admin role.
The solution presented, where you check is the user is an admin in the middleware to check user's campground ownership and comment ownership, works and is a nice fix but I think it violates a bit what that middleware is supposed to do, which is just checking who owns the campground or comment. Besides, image that I wanted an admin to just delete the campground but not editing it, this solution wouldn't work.
So, my question is: what's a more elaborate way to keep a clear separation of concerns between checking for ownership and checking for admin role? I tried to make my own middleware to check for admin role but then I don't know how can I make both middleware work in the same rate.
how does search.js file include html?
Shouldn't it be search.ejs?
Error is:
var lat = data.results[0].geometry.location.lat;
^
TypeError: Cannot read property 'geometry' of undefined
Hi
I was hoping you would be able to show how to ensure the comments attached to a campgrounds are deleted if the campground is deleted.
I also noticed the Info 1, info 2, and info 3 buttons are still doing nothing. Was the intention for these to serve a purpose?
The equals
method in the show template is throwing an error: cannot read 'equals' of undefined
. I have the same file as you but I am not sure what's happening.
</div>
<div class="col-md-9">
<div class="thumbnail">
<img class="img-responsive" src="<%= campground.image %>">
<div class="caption-full">
<h4 class="pull-right">
$<%= campground.cost %>/night
</h4>
<h4><a><%=campground.name%></a></h4>
<p><%= campground.description %></p>
<p>
<em>Submitted by: <%= campground.author.username %>, <%= moment(campground.createdAt).fromNow() %></em>
</p>
<% if(currentUser && campground.author.id.equals(currentUser._id) || currentUser && currentUser.isAdmin){ %>
<a class="btn btn-warning" href="/campgrounds/<%= campground._id %>/edit">Edit</a>
<form action="/campgrounds/<%= campground._id %>?_method=DELETE" method="POST" class="delete-form">
<button class="btn btn-danger">Delete</button>
</form>
<% } %>
</div>
</div>
<div class="well">
<div class="text-right">
<a class="btn btn-success" href="/campgrounds/<%= campground._id %>/comments/new">Add New Comment</a>
</div>
<hr>
<% campground.comments.forEach(function(comment){ %>
<div class="row">
<div class="col-md-12">
<strong><%= comment.author.username %></strong>
<span class="pull-right"><%= moment(comment.createdAt).fromNow() %></span>
<div>
<%= comment.text %>
<% if(currentUser && comment.author.id.equals(currentUser._id) || currentUser && currentUser.isAdmin){ %>
<div class="pull-right">
<a href="/campgrounds/<%=campground._id%>/comments/<%=comment._id%>/edit" class="btn btn-xs btn-warning">EDIT</a>
<form class="delete-form" action="/campgrounds/<%=campground._id%>/comments/<%=comment._id%>?_method=DELETE" method="POST">
<button class="btn btn-xs btn-danger">DELETE</button>
</form>
</div>
<% } %>
<hr>
</div>
</div>
</div>
<% }) %>
</div>
</div>
</div>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.