-
-
Save tubbo/3de6753608d869125c8fe25548bfe4d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.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