Skip to content

Commit

Permalink
Fix button styling issue on home page
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Gehani committed Sep 24, 2013
1 parent 6a62878 commit e64d5fe
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 4 deletions.
10 changes: 10 additions & 0 deletions app/assets/javascripts/pins.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@
jQuery ->
$('#pins').imagesLoaded ->
$('#pins').masonry itemSelector: ".box"

# Added Pagination Code here
if $('.pagination').length
$(window).scroll ->
url = $('.pagination .next_page a').attr('href')
if url && $(window).scrollTop() > $(document).height() - $(window).height() - 50
# What to do at the bottom of the page
$('.pagination').text("Fetching more pins...")
$.getScript(url)
$(window).scroll()
5 changes: 3 additions & 2 deletions app/assets/stylesheets/scaffolds.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ pre {
a {
color: #000;
&:visited {
color: #666;
color: #fff;
}
&:hover {
color: #fff;
background-color: #000;
/*
background-color: #000; */
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/styles.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $baseFontFamily: Oxygen;
@import url(http://fonts.googleapis.com/css?family=Oxygen);

/* Change button Color */
$btnPrimaryBackground: purple;
$btnPrimaryBackground: #00BFFF;
$navbarBackgroundHighlight: white;
$navbarBackground: white;

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/pins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def index
respond_to do |format|
format.html # index.html.erb
format.json { render json: @pin }
format.js
end
end

Expand All @@ -21,6 +22,7 @@ def show
respond_to do |format|
format.html # show.html.erb
format.json { render json: @pin }
format.js
end
end

Expand Down
4 changes: 3 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<%= content_tag(:div, msg, class: "alert alert-#{name}") %>
<% end %>
<%= yield %>
<%= render 'layouts/footer' %>
<div class="container">
<%= render 'layouts/footer' %>
</div>
</div>
</body>
</html>
10 changes: 10 additions & 0 deletions app/views/pins/index.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$boxes = $('<%= j render(@pins) %>')

$('#pins').append( $boxes ).imagesLoaded( function(){
$('#pins').masonry( 'reload');
});
<% if @pins.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@pins) %>');
<% else %>
$('.pagination').remove();
<% end %>
10 changes: 10 additions & 0 deletions app/views/pins/show.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$boxes = $('<%= j render(@pins) %>')

$('#pins').append( $boxes ).imagesLoaded( function(){
$('#pins').masonry( 'reload');
});
<% if @pins.next_page %>
$('.pagination').replaceWith('<%= j will_paginate(@pins) %>');
<% else %>
$('.pagination').remove();
<% end %>

0 comments on commit e64d5fe

Please sign in to comment.