Tuesday, 9 May 2017

How do I implement a "Follow"/"Subscribe" feature JS

<div class="container">
  <div class="page-header">
    <h1>Browse</h1>
    <p><small class="text-muted"><i class="glyphicon glyphicon-globe"></i> Read and follow stories in production from around the globe.</small></p>
            <a id="button" class="btn btn-large" class="text-right" href="/browse/new" data-toggle="tooltip" title="Every Story Deserves An Audience"><strong><i class="fa fa-plus"></i> Publish New</strong></a>

  </div>

<div class="row text-center" style="display:flex; flex-wrap: wrap;">
        <% stories.forEach(function(story){ %>
            <div class="col-md-3 col-sm-6">
                <div id="hover" class="thumbnail">
                    <img src="<%= story.image %>">
                    <div class="caption">
                        <h4><strong><%= story.title %></strong></h4>
                        <hr>
                        <p> <%= story.description %></p>
                             <p><a href="/stories/<%= story._id %>" id="button" class="btn" role="button">Read</a> <a href="#" class="btn btn-default" role="button">Follow</a></p>
                    </div>
                </div>
            </div>
        <% }) %>
    </div>
</div>

This is my index that displays thumbnails of user generated posts. I want to implement the "follow" feature. i have the button there. I would like for user to be able to click the follow button, and they are now following this story. every story the user is following will appear in a separate page (library) which will essentially be a replica of this index page, but only displaying the thumbnails for those stories the user is following. ANY HELP will be GREATLY appreciated. Have been stuck for a few days. Thank You.



via nguer092

No comments:

Post a Comment