Giter Site home page Giter Site logo

yelp-camp-refactored's Introduction

YelpCamp

Refactored by Ian Schoonover

yelp-camp-refactored's People

Contributors

nax3t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yelp-camp-refactored's Issues

Missing Functions

Hi,

I couldn't find setPassword, logIn and other functions in the package?
Am I missing or overlooking something?

Installation of mongodb

Sir I'll be grateful if you post installing process of mongoDB on another cloude ide other than c9 and codeanywhere plz plz

Mixed responsibilities between ownership (campgrounds or comments) and admin role

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.

search.js

how does search.js file include html?

Shouldn't it be search.ejs?

Delete Comments when a campground is deleted

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?

Error with Ejs: Cannot read equals of undefined

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.