Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
60b7c30a8a
10 changed files with 133 additions and 119 deletions
|
|
@ -2,6 +2,7 @@ class PhotosController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
render :nothing => true
|
||||||
begin
|
begin
|
||||||
@photo = current_user.post(:photo, params)
|
@photo = current_user.post(:photo, params)
|
||||||
|
|
||||||
|
|
@ -21,6 +22,8 @@ class PhotosController < ApplicationController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@photo = Photo.new
|
@photo = Photo.new
|
||||||
|
@album = current_user.album_by_id(params[:album_id])
|
||||||
|
render :partial => "new_photo"
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ class User
|
||||||
options.delete(:group_id)
|
options.delete(:group_id)
|
||||||
|
|
||||||
model_class = class_name.to_s.camelize.constantize
|
model_class = class_name.to_s.camelize.constantize
|
||||||
|
|
||||||
post = model_class.instantiate(options)
|
post = model_class.instantiate(options)
|
||||||
post.creator_signature = post.sign_with_key(encryption_key)
|
post.creator_signature = post.sign_with_key(encryption_key)
|
||||||
post.save
|
post.save
|
||||||
|
|
@ -324,6 +325,11 @@ class User
|
||||||
groups.detect{|x| x.id == id }
|
groups.detect{|x| x.id == id }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def album_by_id( id )
|
||||||
|
id = ensure_bson id
|
||||||
|
albums.detect{|x| x.id == id }
|
||||||
|
end
|
||||||
|
|
||||||
def groups_with_person person
|
def groups_with_person person
|
||||||
id = ensure_bson person.id
|
id = ensure_bson person.id
|
||||||
groups.select {|group| group.person_ids.include? id}
|
groups.select {|group| group.person_ids.include? id}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
:javascript
|
||||||
|
$(document).ready(function(){
|
||||||
|
reset_photo_fancybox();
|
||||||
|
});
|
||||||
|
|
||||||
|
.album_id{:id => @album.id, :style => "display:hidden;"}
|
||||||
.back= link_to '⇧ albums', albums_path
|
.back= link_to '⇧ albums', albums_path
|
||||||
%h1.big_text
|
%h1.big_text
|
||||||
|
|
||||||
|
|
@ -11,7 +17,6 @@
|
||||||
|
|
||||||
.yo{:style => "display:none;"}
|
.yo{:style => "display:none;"}
|
||||||
#new_photo_pane
|
#new_photo_pane
|
||||||
= render "photos/new_photo", :photo => @photo, :album => @album
|
|
||||||
|
|
||||||
.sub_header
|
.sub_header
|
||||||
="updated #{how_long_ago(@album)}"
|
="updated #{how_long_ago(@album)}"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
- if user_signed_in?
|
|
||||||
= javascript_include_tag 'FABridge', 'swfobject', 'web_socket'
|
= javascript_include_tag 'FABridge', 'swfobject', 'web_socket'
|
||||||
:javascript
|
:javascript
|
||||||
WebSocket.__swfLocation = "/javascripts/WebSocketMain.swf";
|
WebSocket.__swfLocation = "/javascripts/WebSocketMain.swf";
|
||||||
:javascript
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
function debug(str){ $("#debug").append("<p>" + str); };
|
function debug(str){ $("#debug").append("<p>" + str); };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
|
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
|
||||||
= javascript_include_tag 'jquery142', 'rails', 'google'
|
= javascript_include_tag 'jquery142', 'rails', 'google'
|
||||||
= javascript_include_tag 'tiny_mce/tiny_mce'
|
|
||||||
= javascript_include_tag 'jquery.infieldlabel', 'jquery.cycle/jquery.cycle.min.js'
|
= javascript_include_tag 'jquery.infieldlabel', 'jquery.cycle/jquery.cycle.min.js'
|
||||||
|
|
||||||
= javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack'
|
= javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack'
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#photo_image").html5_upload({
|
$("#photo_image").html5_upload({
|
||||||
// WE INSERT ALBUM_ID PARAM HERE
|
// WE INSERT ALBUM_ID PARAM HERE
|
||||||
url: "/photos?album_id=#{album.id}",
|
url: "/photos?album_id=#{@album.id}",
|
||||||
sendBoundary: window.FormData || $.browser.mozilla,
|
sendBoundary: window.FormData || $.browser.mozilla,
|
||||||
setName: function(text) {
|
setName: function(text) {
|
||||||
$("#progress_report_name").text(text);
|
$("#progress_report_name").text(text);
|
||||||
|
|
@ -12,7 +12,9 @@
|
||||||
$("#add_photo_loader").fadeOut(400);
|
$("#add_photo_loader").fadeOut(400);
|
||||||
|
|
||||||
$("#photo_title_status").text("Done!");
|
$("#photo_title_status").text("Done!");
|
||||||
$("#progress_report").html("Great job!");
|
$("#progress_report").html("Good job me!");
|
||||||
|
|
||||||
|
$("#add_photo_button").addClass("uploading_complete");
|
||||||
},
|
},
|
||||||
onStart: function(event, total){
|
onStart: function(event, total){
|
||||||
$("#add_photo_button").html( "Uploading Photos" );
|
$("#add_photo_button").html( "Uploading Photos" );
|
||||||
|
|
@ -29,10 +31,10 @@
|
||||||
%h1
|
%h1
|
||||||
%span{:id=>"photo_title_status"}
|
%span{:id=>"photo_title_status"}
|
||||||
Add photos to
|
Add photos to
|
||||||
%i= album.name
|
%i= @album.name
|
||||||
= form_for photo, :html => {:multipart => true} do |f|
|
= form_for @photo, :html => {:multipart => true} do |f|
|
||||||
= f.error_messages
|
= f.error_messages
|
||||||
= f.hidden_field :album_id, :value => album.id
|
= f.hidden_field :album_id, :value => @album.id
|
||||||
= f.file_field :image, :multiple => 'multiple'
|
= f.file_field :image, :multiple => 'multiple'
|
||||||
|
|
||||||
#progress_report{ :style => "display:none;text-align:center;" }
|
#progress_report{ :style => "display:none;text-align:center;" }
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,17 @@
|
||||||
development:
|
development:
|
||||||
debug: false
|
debug: false
|
||||||
|
socket_debug : false
|
||||||
socket_port: 8080
|
socket_port: 8080
|
||||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||||
|
|
||||||
test:
|
test:
|
||||||
debug: false
|
debug: false
|
||||||
|
socket_debug : false
|
||||||
socket_port: 8081
|
socket_port: 8081
|
||||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||||
|
|
||||||
production:
|
production:
|
||||||
debug: false
|
debug: false
|
||||||
|
socket_debug : false
|
||||||
socket_port: 8080
|
socket_port: 8080
|
||||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require "lib/diaspora/websocket"
|
||||||
EventMachine::WebSocket.start(
|
EventMachine::WebSocket.start(
|
||||||
:host => "0.0.0.0",
|
:host => "0.0.0.0",
|
||||||
:port => APP_CONFIG[:socket_port],
|
:port => APP_CONFIG[:socket_port],
|
||||||
:debug =>APP_CONFIG[:debug]) do |ws|
|
:debug =>APP_CONFIG[:socket_debug]) do |ws|
|
||||||
ws.onopen {
|
ws.onopen {
|
||||||
|
|
||||||
sid = Diaspora::WebSocket.subscribe(ws.request['Path'].gsub('/',''), ws)
|
sid = Diaspora::WebSocket.subscribe(ws.request['Path'].gsub('/',''), ws)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ Diaspora::Application.routes.draw do
|
||||||
resources :status_messages
|
resources :status_messages
|
||||||
resources :comments
|
resources :comments
|
||||||
resources :requests
|
resources :requests
|
||||||
resources :photos
|
resources :photos, :except => [:index]
|
||||||
resources :albums
|
resources :albums
|
||||||
resources :groups
|
resources :groups
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,4 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
tinyMCE.init({
|
|
||||||
mode : "exact",
|
|
||||||
elements: "blog_editor",
|
|
||||||
theme : "advanced",
|
|
||||||
plugins : "emotions,spellchecker,advhr,insertdatetime,preview",
|
|
||||||
|
|
||||||
// Theme options - button# indicated the row# only
|
|
||||||
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontsizeselect,formatselect",
|
|
||||||
theme_advanced_buttons2 : "cut,copy,paste|,bullist,numlist,|,outdent,indent|,undo,redo,|,link,unlink,anchor,image,|,preview,|,forecolor,backcolor",
|
|
||||||
theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,|,sub,sup,|,charmap,emotions",
|
|
||||||
theme_advanced_toolbar_location : "top",
|
|
||||||
theme_advanced_toolbar_align : "left",
|
|
||||||
//theme_advanced_resizing : true //leave this out as there is an intermittent bug.
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('.comment_set').each(function(index) {
|
$('.comment_set').each(function(index) {
|
||||||
if($(this).children().length > 1) {
|
if($(this).children().length > 1) {
|
||||||
|
|
@ -86,7 +71,14 @@ $(document).ready(function(){
|
||||||
$("#add_album_button").fancybox();
|
$("#add_album_button").fancybox();
|
||||||
$("#add_group_button").fancybox();
|
$("#add_group_button").fancybox();
|
||||||
$("#add_request_button").fancybox({ 'titleShow': false });
|
$("#add_request_button").fancybox({ 'titleShow': false });
|
||||||
$("#add_photo_button").fancybox();
|
$("#add_photo_button").fancybox({
|
||||||
|
'onClosed' : function(){
|
||||||
|
if($("#add_photo_button").hasClass("uploading_complete")){
|
||||||
|
$("#add_photo_button").removeClass("uploading_complete");
|
||||||
|
reset_photo_fancybox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//pane_toggler_button("photo");
|
//pane_toggler_button("photo");
|
||||||
|
|
||||||
|
|
@ -106,6 +98,12 @@ $(document).ready(function(){
|
||||||
|
|
||||||
});//end document ready
|
});//end document ready
|
||||||
|
|
||||||
|
function reset_photo_fancybox(){
|
||||||
|
album_id = $(".album_id")[0].id;
|
||||||
|
ajax = $.get("/photos/new?album_id=" + album_id, function(){
|
||||||
|
$("#new_photo_pane").html(ajax.responseText)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function pane_toggler_button( name ) {
|
function pane_toggler_button( name ) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue