Fix db seed, refactor aspect-filters a bunch, fix stream_element a little

This commit is contained in:
Raphael Sofaer 2011-04-13 18:13:26 -07:00
parent 9969dbd109
commit 4870ffb944
3 changed files with 33 additions and 31 deletions

View file

@ -33,7 +33,7 @@
%span.aspect_badges %span.aspect_badges
= aspect_badges(aspects_with_post(all_aspects, post), :link => true) = aspect_badges(aspects_with_post(all_aspects, post), :link => true)
%span.timeago.time %span.timeago
= link_to(how_long_ago(post), status_message_path(post)) = link_to(how_long_ago(post), status_message_path(post))
- unless (defined?(@commenting_disabled) && @commenting_disabled) - unless (defined?(@commenting_disabled) && @commenting_disabled)

View file

@ -34,8 +34,8 @@ time_interval = 1000
(1..25).each do |n| (1..25).each do |n|
[alice, bob, eve].each do |u| [alice, bob, eve].each do |u|
post = u.post :status_message, :text => "#{u.username} - #{n} - #seeded", :to => u.aspects.first.id post = u.post :status_message, :text => "#{u.username} - #{n} - #seeded", :to => u.aspects.first.id
post.created_at = post.created_at + time_interval post.created_at = post.created_at - time_interval
post.updated_at = post.updated_at + time_interval post.updated_at = post.updated_at - time_interval
post.save post.save
time_interval += 1000 time_interval += 1000
end end

View file

@ -27,33 +27,29 @@ var AspectFilters = {
}); });
}, },
interceptAspectLinks: function(){ interceptAspectLinks: function(){
$("a.hard_aspect_link").live("click", function(e){ $("a.hard_aspect_link").live("click", AspectFilters.aspectLinkClicked);
},
aspectLinkClicked: function(e){
var link = $(this); var link = $(this);
if( !link.hasClass('aspect_selector') ){
e.preventDefault(); e.preventDefault();
AspectFilters.requests++; if( !link.hasClass('aspect_selector') ){
AspectFilters.switchToAspect(link);
var guid = $(this).attr('data-guid');
// select correct aspect in filter list & deselect others
$("#aspect_nav li").each(function(){
var $this = $(this);
if( $this.attr('data-guid') == guid){
$this.addClass('selected');
} else {
$this.removeClass('selected');
}
});
// loading animation
$("#aspect_stream_container").fadeTo(200, 0.4);
$("#aspect_contact_pictures").fadeTo(200, 0.4);
AspectFilters.performAjax( $(this).attr('href'));
} }
$('html, body').animate({scrollTop:0}, 'fast'); $('html, body').animate({scrollTop:0}, 'fast');
}); },
switchToAspect: function(aspectLi){
AspectFilters.requests++;
var guid = aspectLi.attr('data-guid');
// select correct aspect in filter list & deselect others
$("#aspect_nav li").removeClass('selected');
link.addClass('selected');
AspectFilters.fadeOut();
AspectFilters.performAjax( aspectLi.attr('href'));
}, },
interceptAspectNavLinks: function(){ interceptAspectNavLinks: function(){
$("#aspect_nav a.aspect_selector").click(function(e){ $("#aspect_nav a.aspect_selector").click(function(e){
@ -62,8 +58,7 @@ var AspectFilters = {
AspectFilters.requests++; AspectFilters.requests++;
// loading animation // loading animation
$("#aspect_stream_container").fadeTo(100, 0.4); AspectFilters.fadeOut();
$("#aspect_contact_pictures").fadeTo(100, 0.4);
// filtering ////////////////////// // filtering //////////////////////
var $this = $(this), var $this = $(this),
@ -139,8 +134,8 @@ var AspectFilters = {
//pass photos //pass photos
$('#photodropzone img').each(function(){ $('#photodropzone img').each(function(){
var img = $(this); var img = $(this);
guid = img.attr('data-id'); var guid = img.attr('data-id');
url = img.attr('src'); var url = img.attr('src');
photos[guid] = url; photos[guid] = url;
}); });
@ -181,12 +176,19 @@ var AspectFilters = {
// fade contents back in // fade contents back in
if(AspectFilters.requests == 0){ if(AspectFilters.requests == 0){
$("#aspect_stream_container").fadeTo(100, 1); AspectFilters.fadeIn();
$("#aspect_contact_pictures").fadeTo(100, 1);
AspectFilters.performAspectUpdate(); AspectFilters.performAspectUpdate();
} }
} }
}); });
},
fadeIn: function(){
$("#aspect_stream_container").fadeTo(100, 1);
$("#aspect_contact_pictures").fadeTo(100, 1);
},
fadeOut: function(){
$("#aspect_stream_container").fadeTo(100, 0.4);
$("#aspect_contact_pictures").fadeTo(100, 0.4);
} }
} }
$(document).ready(function(){ $(document).ready(function(){