Tuesday, January 19, 2016

Week 2 - Reddit Clone - Bootstrap Sass, Acts as votable, Simple form

Click here to open in a new window
Today I finished Mackenzie Childs Reddit Clone app from his 12 in 12 challenge.  That's build 12 apps in 12 weeks to teach yourself Ruby On Rails.

After the blog app I finished yesterday, this app didn't seem that different.  This is a Reddit type app that looks a lot like a blog but users add web links with a title.  The site also has the ability to vote on each link.  The highest rated link is shown first in the index.

This is due to the acts as votable gem.

<% @links.order(cached_votes_up: :desc).each do |link| %>
  <div class="link row clearfix">
    <h2>
      <%= link_to link.title, link %>
      <small class="author">Submitted <%= time_ago_in_words(link.created_at) %> by <%= link.user.name %></small>
   

    <div class="btn-group">
      <a class="btn btn-default btn-sm" href="<%= link.url %>">Visit Link</a>
      <%= link_to like_link_path(link), method: :put, class: "btn btn-default btn-sm" do %>
        <span class="glyphicon glyphicon-chevron-up"></span>Upvote<%= link.get_upvotes.size %>
      <% end %>
      <%= link_to dislike_link_path(link), method: :put, class: "btn btn-default btn-sm" do %>
        <span class="glyphicon glyphicon-chevron-down"></span>Downvote<%= link.get_downvotes.size %>
      <% end %>
    </div>
  </div>
<% end %>

One thing I have had a hard time with is css.  While doing this app and the blog app, I have learned so much more about css and sass.  Bootstrap-sass is a gem I use and its great for organizing the rules. It helps me to see how the rules are applied.

I was able to load this app with a seed file as well which makes the app look great right out the box. Visit here

Well its week one and I have already finished two apps and I have published them on Heroku.  Take a look, leave a comment below and check out my github page for more apps.  Follow this blog as I take the journey from novice to working web developer.  Lets see if I can finish these 12 apps in 6 weeks.

Features I would like to add:
1. Social media shareability
2. Display who submitted the comment
3. Posting pictures & gifs, videos.
4. Rich text formating
5. Search function
6. Social media shareability

Kenyacode

No comments:

Post a Comment