Merge branch 'master' of github.com:diaspora/diaspora into profiles

This commit is contained in:
danielgrippi 2012-02-24 14:36:18 -08:00
commit 39d31d5888
11 changed files with 132 additions and 71 deletions

View file

@ -82,7 +82,7 @@ gem 'ruby-oembed'
# queue
gem 'resque', '1.19.0'
gem 'resque-ensure-connected', :git => 'https://github.com/socialcast/resque-ensure-connected.git'
gem 'resque-ensure-connected', :git => 'git://github.com/socialcast/resque-ensure-connected.git'
gem 'resque-timeout', '1.0.0'
gem 'SystemTimer', '1.2.3', :platforms => :ruby_18

View file

@ -32,7 +32,7 @@ GIT
sinatra
GIT
remote: https://github.com/socialcast/resque-ensure-connected.git
remote: git://github.com/socialcast/resque-ensure-connected.git
revision: 8ac0f9e4658495097fb333a93db81d54ba9a5311
specs:
resque-ensure-connected (0.2.0)

View file

@ -36,7 +36,7 @@ class AdminsController < ApplicationController
end
def stats
@popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(15).count(:group => :tag, :order => 'count(taggings.id) DESC')
@popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(50).count(:group => :tag, :order => 'count(taggings.id) DESC')
case params[:range]
when "week"

View file

@ -49,8 +49,6 @@
%span.percent_change{:class => (model[:change] > 0 ? "green" : "red")}
= "(#{model[:change]}%)"
%br
%br
%br
%br
%br
@ -65,63 +63,12 @@
%b
#{@posts[:day_before]/@user_count.to_f}
/%h3
/ Posts over time
/#stats_graph{:style => "text-align:right;position:relative;vertical-align:bottom;background-color:#eee;"}
/ = @posts_per_day.inspect
/ /- @posts_per_day.each do |key, val|
/ /.asdo{:style => "display:inline-block;width:35px;vertical-align:bottom;background-color:#666;height:#{(val/@most_posts_within)*200}px;"}
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
.span-24.last
%h2
Misc Stuff
%br
%br
%h3
= for tg in @popular_tags
= link_to tg, tags_path(tg)
%br
%br
.span-12
%h3
New public posts
/.stream
/ /= render 'shared/stream', :posts => @new_public_posts
.span-12.last
%h3
Most Liked
.stream
= render 'shared/stream', :posts => @most_liked_posts
50 Most Popular Tags
- @popular_tags.each do |name,count|
Tag Name:
%b= name
Count:
%b= count
%br

View file

@ -21,7 +21,7 @@
email:
= text_field_tag 'user[email]', params[:user][:email]
invitation identifier
invitation identifier:
= text_field_tag 'user[invitation_identifier]', params[:user][:invitation_identifier]
invitation token:

View file

@ -5,9 +5,9 @@
%br
.span-24.last
%h1
%h2
= "Users per week (Current server date is: #{Time.now.to_date}) "
%ul
- @created_users_by_week.keys.sort.each do |k|
- @created_users_by_week.keys.sort.reverse.each do |k|
%li
= "Week stating on #{k} , #{@created_users_by_week[k]}"
= "Week starting on #{k} , #{@created_users_by_week[k]}"

View file

@ -47,7 +47,7 @@
window.setTimeout(window.close, 2000, true);
});
var contents = "#{params[:title]} - #{params[:url]}";
var contents = "#{escape_javascript params[:title]} - #{escape_javascript params[:url]}";
var notes = "#{escape_javascript params[:notes]}";
if (notes.length > 0){
contents = contents + " - " + notes;

View file

@ -7,7 +7,7 @@ app.views.Photos = Backbone.View.extend({
this.collection = this.model.photos;
this.setupEvents();
//this.setupLightbox(); ERROR: "imageThumb is undefined" ...
this.setupLightbox();
},
setupEvents : function(){
@ -50,6 +50,10 @@ app.views.Photos = Backbone.View.extend({
setupLightbox : function(){
this.lightbox = Diaspora.BaseWidget.instantiate("Lightbox");
this.lightbox.set({
imageParent: '#main_stream',
imageSelector: 'img.photo'
});
$(this.el).delegate("a.photo-link", "click", this.lightbox.lightboxImageClicked);
},

View file

@ -20,6 +20,11 @@ jQuery.fn.center = (function() {
var Lightbox = function() {
var self = this;
self.options = {
imageParent: '.stream_element',
imageSelector: 'img.stream-photo'
};
this.subscribe("widget/ready", function(evt) {
$.extend(self, {
lightbox: $("#lightbox"),
@ -88,9 +93,9 @@ jQuery.fn.center = (function() {
this.lightboxImageClicked = function(evt) {
evt.preventDefault();
var selectedImage = $(this).find("img.stream-photo"),
var selectedImage = $(this).find(self.options.imageSelector),
imageUrl = selectedImage.attr("data-full-photo"),
images = selectedImage.parents('.stream_element').find('img.stream-photo'),
images = selectedImage.parents(self.options.imageParent).find(self.options.imageSelector),
imageThumb;
if( $.browser.msie ) {
@ -147,6 +152,10 @@ jQuery.fn.center = (function() {
self.lightbox.hide();
self.body.removeClass("lightboxed");
};
this.set = function(opts) {
$.extend(self.options, opts);
};
};
Diaspora.Widgets.Lightbox = Lightbox;

View file

@ -1737,6 +1737,9 @@ ul#press_logos
:top 14px
:padding
:bottom 5px
:text-overflow ellipsis
:overflow hidden
:white-space nowrap
a
:color inherit
@ -2725,6 +2728,9 @@ a.toggle_selector
:bottom 10px
h1,h3
:color #fff
:text-overflow ellipsis
:overflow hidden
:white-space nowrap
:background orange
&:hover
#gs-skip-x

View file

@ -0,0 +1,95 @@
/* Copyright (c) 2010-2012, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
describe("Diaspora.Widgets.Lighbox", function() {
var photos;
var createDummyMarkup = function(opts){
var defaults = {
linkClass: 'stream-photo-link',
imageParent: 'stream_element',
imageClass: 'stream-photo'
};
classes = _.extend(defaults, opts);
var output = $('<div/>').addClass(classes.imageParent);
_.each(photos, function(photo){
output.append(
$('<a />')
.attr('href', '#')
.addClass(classes.linkClass)
.append(
$('<img />')
.attr('src', photo.sizes.large)
.addClass(classes.imageClass)
.data({
'small-photo': photo.sizes.small,
'full-photo': photo.sizes.large
})
)
);
});
return output;
};
beforeEach(function(){
$("#jasmine_content").html(
'<div id="lightbox" style="display: none;">TESTCONTENT</div>' +
'<div id="lightbox-imageset"></div>' +
'<div id="lightbox-backdrop"></div>' +
'<div id="lightbox-close-link"></div>'
);
photos = $.parseJSON(spec.readFixture("photos_json"))["photos"];
});
context("opens the lightbox correctly", function() {
var lightbox, page, photoElement;
beforeEach(function() {
$("#jasmine_content").append(createDummyMarkup());
photoElement = $('.stream-photo').first();
lightbox = Diaspora.BaseWidget.instantiate("Lightbox");
$('.stream_element').delegate("a.stream-photo-link", "click", lightbox.lightboxImageClicked);
});
it("shows the lightbox when a photo is clicked", function() {
spyOn(lightbox, 'revealLightbox');
photoElement.trigger('click');
expect(lightbox.revealLightbox).toHaveBeenCalled();
});
});
context("opens lightbox for differently named elements", function(){
var lightbox, page, photoElement;
beforeEach(function() {
$("#jasmine_content").append(createDummyMarkup({
linkClass: 'photo-link',
imageParent: 'main_stream',
imageClass: 'photo'
}));
photoElement = $('.photo').first();
lightbox = Diaspora.BaseWidget.instantiate("Lightbox");
lightbox.set({
imageParent: '.main_stream',
imageSelector: 'img.photo'
});
$('.main_stream').delegate("a.photo-link", "click", lightbox.lightboxImageClicked);
});
it("shows the lightbox when a photo is clicked", function() {
spyOn(lightbox, 'revealLightbox');
photoElement.trigger('click');
expect(lightbox.revealLightbox).toHaveBeenCalled();
});
});
});