Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up filter method

Added no results message
  • Loading branch information...
commit af700cbb0b76c810b019ee459ebec7155345371c 1 parent 60f3051
@nicinabox nicinabox authored
View
2  app/controllers/accounts_controller.rb
@@ -8,7 +8,7 @@ def show
end
def filter
- accounts = Account.select('id, username').where ['username like ?', '%'+params[:query]+'%']
+ accounts = Account.select('id, username').where ["username LIKE ?", "%#{params[:query]}%"]
render :json => accounts
end
end
View
1  app/views/accounts/index.html.erb
@@ -9,4 +9,5 @@
<section id="accounts" class="hidden">
<%= render :partial => 'account', :collection => @accounts %>
<div class="clear"></div>
+ <h1 class="no_results">We couldn't find a developer by that name :(</h1>
</section>
View
9 app/views/layouts/application.html.erb
@@ -24,7 +24,14 @@
<div id="footer-padding"></div>
</div>
<footer id="site-footer">
- &copy; <%= Time.now.strftime('%Y') %> Ruby Committers? MIT License? Who knows?
+ <section class="wrapper">
+ <div class="copyright">
+ &copy; <%= Time.now.strftime('%Y') %> Ruby Committers? MIT License? Who knows?
+ </div>
+ <div class="credits">
+ Designed <span class="amp">&amp;</span> developed by <a href="http://nicianbox.com">Nic Aitch</a> <span class="amp">&amp;</span> <a href="http://joesak.com">Joe Sak</a>
+ </div>
+ </section>
</footer>
<%= javascript_include_tag 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',
'https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js',
View
11 public/javascripts/application.js
@@ -16,7 +16,7 @@ $(document).ready(function(){
options = {
columnWidth: 300,
// only apply masonry layout to visible elements
- itemSelector: '.account:not(.kill)',
+ itemSelector: '.account:not(.kill), .no_results',
animate: true,
animationOptions: {
duration: speed,
@@ -38,17 +38,22 @@ $(document).ready(function(){
$('.stay_alive').removeClass('kill').fadeIn(speed);
$('.account').not('.stay_alive').addClass('kill').fadeOut(speed);
-
- $wall.masonry(options);
if ($('#filter .results').is(':empty')) {
$('#filter .results').hide();
}
$('#filter .results').html(data.length == 1 ? data.length+" result" : data.length+" results").fadeIn('fast');
+ if (data.length == 0) {
+ $('.no_results').fadeIn('fast');
+ } else {
+ $('.no_results').fadeOut('fast');
+ }
+ $wall.masonry(options);
});
} else {
$('#filter .results').fadeOut('fast', function(){$(this).empty()});
$('.account').removeClass('kill').fadeIn(speed);
+ $('.no_results').fadeOut('fast');
$wall.masonry(options);
}
});
View
30 public/stylesheets/site.css
@@ -250,6 +250,10 @@ input::-webkit-input-placeholder {
-moz-box-shadow: 0px 0px 6px #aba;
-webkit-box-shadow: 0px 0px 6px #aba;
}
+#accounts .no_results {
+ display: none;
+ font-size: 20px;
+}
#accounts .account{
width:290px;
float:left;
@@ -313,12 +317,34 @@ body.lights_down #account .account{
#site-footer {
clear: both;
position: relative;
- height: 50px;
+ height: 80px;
margin-top: 40px;
+ border-top: 3px solid #666;
background:#333;
- color:#fff;
+ color: #aaa;
padding:10px;
}
+.wrapper {
+ width: 960px;
+ margin: 0 auto;
+}
+span.amp {
+ font-family:Baskerville,"Goudy Old Style","Palatino","Book Antiqua",serif;
+ font-size:110%;
+ font-style:italic;
+}
+#site-footer .amp {
+ color: #ddd;
+}
+#site-footer a {
+ color: white;
+}
+#site-footer .copyright {
+ float: left;
+}
+#site-footer .credits {
+ float: right;
+}
/* =SINGLE ACCOUNT
--------------------------*/
Please sign in to comment.
Something went wrong with that request. Please try again.