Skip to content

Instantly share code, notes, and snippets.

@tubbo tubbo/index.html.erb forked from mfifth/index.html.erb
Last active Oct 5, 2016

Embed
What would you like to do?
<div class='main-content'>
<h2 class='greeting'>Free hi-res stock images for both personal & commercial use.</h2>
<ul class='optionsnavi'>
<li class='dropdown'>
<button class='dropbtn'>
Sort By <i class="fa fa-sort-desc" aria-hidden="true"></i>
</button>
<div id='myDropdown' class='dropdown-content'>
<%= link_to "Latest", :sort => "created_at asc" %>
<%= link_to "Oldest", :sort => "created_at desc" %>
</div>
</li>
<li class='sizetoggle'>
<button type='button' class='single-img'>
<i class="fa fa-bars fa-2x active" aria-hidden="true"></i>
</button>
<button type='button' class='multi-img'>
<i class="fa fa-th-large fa-2x inactive" aria-hidden="true"></i>
</button>
</li>
</ul>
<div class='photo_section single'>
<% @pictures.each do |picture| %>
<div class='imageauthor'>
<%= image_tag picture.image_url.url, class: "fullimg" %>
<ul class='aboutsection'>
<li>Photo by <%= link_to "#{picture.user.first_name} #{picture.user.last_name}",
user_path(picture.user) %> / <%= link_to "Download", root_path %>
<span class= "likefunction" id="picture_<%= picture.id %>">
<% if current_user.voted_for?(picture) %>
<%= button_to unlike_picture_path(picture), method: :delete, remote: true, class: "likethisphoto" do %>
<span class='likescount'><%= picture.get_likes.count %></span>
<i class="fa fa-heart-o" aria-hidden="true"></i>
<% end %>
<% else %>
<%= button_to like_picture_path(picture), method: :put, remote: true, class: "likethisphoto" do %>
<span class='likescount'><%= picture.get_likes.count %></span>
<i class="fa fa-heart-o" aria-hidden="true"></i>
<% end %>
<% end %>
</span>
</li>
</p>
</div>
<% end %>
</div>
$('.likethisphoto').on('ajax:success', function(response) {
$(this).closest('.likefunction').html(response);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.