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

This commit is contained in:
ilya 2010-09-17 23:02:45 -07:00
commit 01e3bdaa29
9 changed files with 207 additions and 67 deletions

View file

@ -36,7 +36,7 @@ After you have Ruby installed on your system, you will need to get RubyGems, the
- [RubyGems](http://rubygems.org/) - Source for Ruby gems. - [RubyGems](http://rubygems.org/) - Source for Ruby gems.
- [Bundler](http://gembundler.com/) - Gem management tool for Ruby projects. - [Bundler](http://gembundler.com/) - Gem management tool for Ruby projects.
**We suggest using a package management system to download these dependencies. Trust us, it's going to make your life a lot easier. If you're using Mac OS X, you can use [homebrew](http://mxcl.github.com/homebrew/); if you're using Ubuntu, just use [Synaptic](http://www.nongnu.org/synaptic/) (it comes pre-installed); if you're using Fedora simply use [yum](http://yum.baseurl.org/). The instructions below assume you have these installed.** **We suggest using a package management system to download these dependencies. Trust us, it's going to make your life a lot easier. If you're using Mac OS X, you can use [homebrew](http://mxcl.github.com/homebrew/); if you're using Ubuntu, just use [Synaptic](http://www.nongnu.org/synaptic/) (it comes pre-installed); if you're using Fedora simply use [yum](http://yum.baseurl.org/). The instructions below assume you have these installed.**
### Build Tools ### Build Tools
@ -56,6 +56,8 @@ To install Ruby 1.8.7 on **Ubuntu**, run the following command:
sudo apt-get install ruby-full sudo apt-get install ruby-full
Please note that you need to have Universe enabled in your /etc/apt/sources.list file to install ruby using apt-get.
At this time Fedora does not have Ruby 1.8.7. As a workaround it is possible to use [rvm](http://rvm.beginrescueend.com/) with a locally compiled Ruby installation. A semi automated method for doing this is available. It is highly recommended that you review the script before running it so you understand what will occur. The script can be executed by running the following command: At this time Fedora does not have Ruby 1.8.7. As a workaround it is possible to use [rvm](http://rvm.beginrescueend.com/) with a locally compiled Ruby installation. A semi automated method for doing this is available. It is highly recommended that you review the script before running it so you understand what will occur. The script can be executed by running the following command:
./script/bootstrap-fedora-diaspora.sh ./script/bootstrap-fedora-diaspora.sh
@ -71,7 +73,7 @@ To install MongoDB on **Ubuntu**, add the official MongoDB repository from this
http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages
For Lucid, add the following line to your /etc/apt/sources.list: For Lucid, add the following line to your /etc/apt/sources.list (for other distros, see http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages):
deb http://downloads.mongodb.org/distros/ubuntu 10.4 10gen deb http://downloads.mongodb.org/distros/ubuntu 10.4 10gen
@ -89,7 +91,7 @@ If you're running a 32-bit system, run `wget http://fastdl.mongodb.org/linux/mon
# create the required data directory # create the required data directory
sudo mkdir -p /data/db sudo mkdir -p /data/db
sudo chmod -Rv 777 /data/ sudo chmod -Rv 777 /data/
To install MongoDB on a x86_64 **Fedora** system, add the official MongoDB repository from MongoDB (http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages) into /etc/yum.repos.d/10gen.repo: To install MongoDB on a x86_64 **Fedora** system, add the official MongoDB repository from MongoDB (http://www.mongodb.org/display/DOCS/CentOS+and+Fedora+Packages) into /etc/yum.repos.d/10gen.repo:
@ -117,6 +119,8 @@ If you're running a 32-bit system, run `wget http://fastdl.mongodb.org/linux/mon
To install MongoDB on **Mac OS X**, run the following: To install MongoDB on **Mac OS X**, run the following:
brew install mongo brew install mongo
sudo mkdir -p /data/db
sudo chmod -Rv 777 /data/
### OpenSSL ### OpenSSL
@ -139,11 +143,11 @@ To install ImageMagick on **Mac OS X**, run the following:
### Git ### Git
To install Git on **Ubuntu**, run the following: To install Git on **Ubuntu**, run the following:
sudo apt-get install git-core sudo apt-get install git-core
To install Git on **Fedora**, run the following: To install Git on **Fedora**, run the following:
sudo yum install git sudo yum install git
@ -233,5 +237,5 @@ Diaspora is free software: you can redistribute it and/or modify it under the te
Diaspora is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. Diaspora is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Diaspora. If not, see <http://www.gnu.org/licenses/>. You should have received a copy of the GNU Affero General Public License along with Diaspora. If not, see <http://www.gnu.org/licenses/>.

View file

@ -18,7 +18,7 @@ class Post
key :person_id, ObjectId key :person_id, ObjectId
key :user_refs, Integer, :default => 0 key :user_refs, Integer, :default => 0
many :comments, :class_name => 'Comment', :foreign_key => :post_id many :comments, :class_name => 'Comment', :foreign_key => :post_id, :order => 'created_at ASC'
belongs_to :person, :class_name => 'Person' belongs_to :person, :class_name => 'Person'
timestamps! timestamps!

View file

@ -9,7 +9,7 @@
element: document.getElementById('file-upload'), element: document.getElementById('file-upload'),
params: {'album_id' : "#{@album.id}"}, params: {'album_id' : "#{@album.id}"},
allowedExtensions: ['jpg', 'jpeg', 'png'], allowedExtensions: ['jpg', 'jpeg', 'png'],
action: "/photos" action: "#{photos_path}"
}); });
} }
window.onload = createUploader; window.onload = createUploader;

View file

@ -0,0 +1,8 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
I18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
I18n.default_locale = :en

View file

@ -0,0 +1,42 @@
es:
errors:
messages:
not_found: 'no encontrado'
already_confirmed: 'ya ha sido confirmada'
not_locked: 'no está bloqueada'
devise:
failure:
unauthenticated: 'Necesitas acceder a tu cuenta o registrarte antes de continuar.'
unconfirmed: 'Necesitas confirmar tu cuenta antes de continuar.'
locked: 'Tu cuenta esta bloqueada.'
invalid: 'Contraseña o Email incorrecto.'
invalid_token: 'Token de autenticación incorrecto.'
timeout: 'Tu sesión ha expirado, por favor accede de nuevo para continuar.'
inactive: 'Tu cuenta no ha sido activada.'
sessions:
signed_in: 'Has ingresado correctamente.'
signed_out: 'Has salido correctamente.'
passwords:
send_instructions: 'Recibirás un email con instrucciones para cambiar tu contraseña en poco minutos.'
updated: 'Tu contraseña ha sido modificada. Ya has accedido a tu cuenta.'
confirmations:
send_instructions: 'Recibirás un email con instrucciones para confirmar tu cuenta en poco minutos.'
confirmed: 'Tu cuenta ha sido confirmada. Ya has accedido a tu cuenta.'
registrations:
signed_up: 'Te has registrado correctamente. Si está disponible, te habremos enviado un email de confirmación.'
updated: 'Has actualizado tu cuenta correctamente.'
destroyed: '!Adiós! Tu cuenta ha sido cancelada. Esperamos verte pronto.'
unlocks:
send_instructions: 'Recibirás un email con instrucciones para desbloquear tu cuenta en pocos minutos.'
unlocked: 'Tu cuenta ha sido desbloqueada. Ya has accedido a tu cuenta.'
oauth_callbacks:
success: 'Has sido autorizado satisfactoriamente de la cuenta %{kind}.'
failure: 'No has sido autorizado en la cuenta %{kind} porque "%{reason}".'
mailer:
confirmation_instructions:
subject: 'Instrucciones de confirmación'
reset_password_instructions:
subject: 'Instrucciones para cambiar tu contraseña'
unlock_instructions:
subject: 'Instrucciones para desbloquear tu cuenta'

View file

@ -0,0 +1,41 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
lt:
errors:
messages:
not_found: "nerasta"
already_confirmed: "jau patvirtinta"
not_locked: "nebuvo užrakinta"
devise:
failure:
unauthenticated: 'Norint tęsti, reikia prisijungti arba susikurti paskyrą.'
unconfirmed: 'Norint prisijungti, reikia patvirtinti savo paskyrą.'
locked: 'Jūsų paskyra yra užrakinta.'
invalid: 'Neteisingas el. pašto adresas arba slaptažodis.'
invalid_token: 'Neteisingas prisijungimo raktas.'
timeout: 'Sesija baigėsi. Norint tęsti, reikia prisijungti iš naujo.'
inactive: 'Paskyra dar neaktyvuota.'
sessions:
signed_in: 'Sėkmingai prisijungta.'
signed_out: 'Sėkmingai atsijungta.'
passwords:
send_instructions: 'Netrukus gausite el. laišką su nurodymais slaptažodžiui atstatyti.'
updated: 'Slaptažodis pakeistas sėkmingai. Jūs esate prisijungęs.'
confirmations:
send_instructions: 'Netrukus gausite el. laišką su nurodymais paskyros patvirtinimui.'
confirmed: 'Paskyra patvirtinta. Prisijungėte.'
registrations:
signed_up: 'Prisijungta sėkmingai. Jei nustatyta, patvirtinimas išsiųstas į jūsų el. paštą.'
updated: 'Paskyra atnaujinta sėkmingai.'
destroyed: 'Paskyra sėkmingai atšaukta. Iki pasimatymo!'
unlocks:
send_instructions: 'Netrukus gausite el. laišką su nurodymais paskyros atrakinimui.'
unlocked: 'Paskyra atrakinta. Prisijungėte.'
mailer:
confirmation_instructions: 'Nurodymai patvirtinimui'
reset_password_instructions: 'Nurodymai slaptažodžio atstatymui'
unlock_instructions: 'Nurodymai paskyros atrakinimui'

10
config/locales/lt.yml Normal file
View file

@ -0,0 +1,10 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# Sample localization file for Lithuanian. Add more files in this directory for other locales.
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
lt:
hello: "Sveikas pasauli"

View file

@ -3,41 +3,54 @@
* the COPYRIGHT file. * the COPYRIGHT file.
*/ */
function decrementRequestsCounter() {
$('#move_friends_link').live( 'click', function(){ var $new_requests = $(".new_requests"),
$.post('/aspects/move_friends', request_html = $new_requests.html(),
{ 'moves' : $('#aspect_list').data() }, old_request_count = request_html.match(/\d+/);
function(){ $('#aspect_title').html("Groups edited successfully!");});
$(".person").css('background-color','none');
$('#aspect_list').removeData();
$(".person").attr('from_aspect_id', function(){return $(this).parent().attr('id')})
});
function decrementRequestsCounter(){
var old_request_count = $(".new_requests").html().match(/\d+/);
if( old_request_count == 1 ) { if( old_request_count == 1 ) {
$(".new_requests").html( $new_requests.html(
$(".new_requests").html().replace(/ \(\d+\)/,'')); request_html.replace(/ \(\d+\)/,'')
);
} else { } else {
$(".new_requests").html( $new_requests.html(
$(".new_requests").html().replace(/\d+/,old_request_count-1)); request_html.replace(/\d+/,old_request_count-1)
);
} }
} }
$(function() { $(function() {
$("ul .person").draggable({
revert: true
$('#move_friends_link').live( 'click', function(){
$.post(
'/aspects/move_friends',
{ 'moves' : $('#aspect_list').data() },
function() {
$('#aspect_title').html("Groups edited successfully!");
}
);
// should the following logic be moved into the $.post() callback?
$("#aspect_list").removeData();
$(".person")
.css('background-color','none')
.attr('from_aspect_id', function() {
return $(this).parent().attr('id')
});
}); });
$("ul .requested_person").draggable({ $("ul .person .requested_person").draggable({
revert: true revert: true
}); });
// Moved class to logic above - unnec duplicate logic
//$("ul .requested_person").draggable({
// revert: true
//});
$(".aspect ul").droppable({ $(".aspect ul").droppable({
hoverClass: 'active', hoverClass: 'active',
drop: function(event, ui) { drop: function(event, ui) {
@ -52,16 +65,23 @@ $(function() {
} }
}); });
}else { } else {
var move = {}; var $aspect_list = $('#aspect_list'),
move[ 'friend_id' ] = ui.draggable[0].id move = {};
move[ 'to' ] = $(this)[0].id;
move[ 'from' ] = ui.draggable[0].getAttribute('from_aspect_id'); // This is poor implementation
move[ 'friend_id' ] = ui.draggable[0].id; // ui.draggable.attr('id')
move[ 'to' ] = $(this)[0].id;// $(this).attr('id');
move[ 'from' ] = ui.draggable[0].getAttribute('from_aspect_id'); // ui.draggable.attr('from_aspect_id')
// if created custom attr's - should be using `data-foo`
if (move['to'] == move['from']){ if (move['to'] == move['from']){
$('#aspect_list').data( ui.draggable[0].id, []); $aspect_list.data( ui.draggable[0].id, []);
ui.draggable.css('background-color','#eee'); ui.draggable.css('background-color','#eee');
} else { } else {
$('#aspect_list').data( ui.draggable[0].id, move); $aspect_list.data( ui.draggable[0].id, move);
ui.draggable.css('background-color','orange'); ui.draggable.css('background-color','orange');
} }
} }
@ -76,44 +96,51 @@ $(function() {
if ($(ui.draggable[0]).hasClass('requested_person')){ if ($(ui.draggable[0]).hasClass('requested_person')){
$.ajax({ $.ajax({
type: "DELETE", type: "DELETE",
url: "/requests/" + ui.draggable[0].getAttribute('request_id') url: "/requests/" + ui.draggable.attr('request_id'),
success: function () {
decrementRequestsCounter();
}
}); });
decrementRequestsCounter();
$(ui.draggable[0]).fadeOut('slow') } else {
}else{
$.ajax({ $.ajax({
type: "DELETE", type: "DELETE",
url: "/people/" + ui.draggable[0].id url: "/people/" + ui.draggable.attr('id'),
success: function () {
alert("Removed Friend, proably want an undo countdown.")
}
}); });
alert("Removed Friend, proably want an undo countdown.")
$(ui.draggable[0]).fadeOut('slow')
} }
$(ui.draggable[0]).fadeOut('slow'); // ui.draggable.fadeOut('slow')
} }
}); });
});
$(".aspect h1").live( 'focus', function() {
var $this = $(this); $(".aspect h1").live( 'focus', function() {
var id = $this.closest("li").children("ul").attr("id");
var link = "/aspects/"+ id;
$this.keypress(function(e) { var $this = $(this),
if (e.which == 13) { id = $this.closest("li").children("ul").attr("id"),
e.preventDefault(); link = "/aspects/"+ id;
$this.blur();
//save changes $this.keypress(function(e) {
$.ajax({ if (e.which == 13) {
type: "PUT", e.preventDefault();
url: link, $this.blur();
data: {"aspect" : {"name" : $this.text() }}
//save changes
$.ajax({
type: "PUT",
url: link,
data: {"aspect" : {"name" : $this.text() }}
});
}
//update all other aspect links
$this.keyup(function(e) {
$("#aspect_nav a[href='"+link+"']").text($this.text());
}); });
}
//update all other aspect links
$this.keyup(function(e) {
$("#aspect_nav a[href='"+link+"']").text($this.text());
}); });
}); });
}); });

View file

@ -1,5 +1,13 @@
#!/bin/bash #!/bin/bash
mkdir -p -v log/thin/ # Check if Mongo is running
bundle exec ruby ./script/websocket_server.rb&
bundle exec thin start $@ if ! ps ax | grep -v grep | grep mongod >/dev/null
then
echo "Mongod not started"
else
mkdir -p -v log/thin/
bundle exec ruby ./script/websocket_server.rb&
bundle exec thin start $@
fi