Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
3fc5651e9d
14 changed files with 353 additions and 102 deletions
|
|
@ -16,9 +16,7 @@ class AlbumsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
aspect = params[:album][:to]
|
aspect = params[:album][:to]
|
||||||
|
|
||||||
data = clean_hash(params[:album])
|
@album = current_user.post(:album, params[:album])
|
||||||
|
|
||||||
@album = current_user.post(:album, data)
|
|
||||||
flash[:notice] = I18n.t 'albums.create.success', :name => @album.name
|
flash[:notice] = I18n.t 'albums.create.success', :name => @album.name
|
||||||
redirect_to :action => :show, :id => @album.id, :aspect => aspect
|
redirect_to :action => :show, :id => @album.id, :aspect => aspect
|
||||||
end
|
end
|
||||||
|
|
@ -53,9 +51,7 @@ class AlbumsController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@album = current_user.find_visible_post_by_id params[:id]
|
@album = current_user.find_visible_post_by_id params[:id]
|
||||||
|
|
||||||
data = clean_hash(params[:album])
|
if current_user.update_post( @album, params[:album] )
|
||||||
|
|
||||||
if current_user.update_post( @album, data )
|
|
||||||
flash[:notice] = I18n.t 'albums.update.success', :name => @album.name
|
flash[:notice] = I18n.t 'albums.update.success', :name => @album.name
|
||||||
respond_with @album
|
respond_with @album
|
||||||
else
|
else
|
||||||
|
|
@ -63,12 +59,4 @@ class AlbumsController < ApplicationController
|
||||||
render :action => :edit
|
render :action => :edit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def clean_hash(params)
|
|
||||||
return {
|
|
||||||
:name => params[:name],
|
|
||||||
:to => params[:to]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class DevUtilitiesController < ApplicationController
|
||||||
|
|
||||||
def set_profile_photo
|
def set_profile_photo
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
album = Album.create(:person => current_user.person, :name => "Profile Photos")
|
album = current_user.post(:album, :name => "Profile Photos", :to => current_user.aspects.first.id)
|
||||||
current_user.raw_visible_posts << album
|
current_user.raw_visible_posts << album
|
||||||
current_user.save
|
current_user.save
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,7 @@ class PhotosController < ApplicationController
|
||||||
|
|
||||||
params[:user_file] = file
|
params[:user_file] = file
|
||||||
|
|
||||||
data = clean_hash(params)
|
@photo = current_user.post(:photo, params)
|
||||||
|
|
||||||
@photo = current_user.post(:photo, data)
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json{render(:layout => false , :json => {"success" => true, "data" => @photo}.to_json )}
|
format.json{render(:layout => false , :json => {"success" => true, "data" => @photo}.to_json )}
|
||||||
|
|
@ -94,9 +92,7 @@ class PhotosController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@photo = current_user.find_visible_post_by_id params[:id]
|
@photo = current_user.find_visible_post_by_id params[:id]
|
||||||
|
|
||||||
data = clean_hash(params)
|
if current_user.update_post( @photo, params[:photo] )
|
||||||
|
|
||||||
if current_user.update_post( @photo, data[:photo] )
|
|
||||||
flash[:notice] = I18n.t 'photos.update.notice'
|
flash[:notice] = I18n.t 'photos.update.notice'
|
||||||
respond_with @photo
|
respond_with @photo
|
||||||
else
|
else
|
||||||
|
|
@ -104,21 +100,4 @@ class PhotosController < ApplicationController
|
||||||
render :action => :edit
|
render :action => :edit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def clean_hash(params)
|
|
||||||
if params[:photo]
|
|
||||||
return {
|
|
||||||
:photo => {
|
|
||||||
:caption => params[:photo][:caption],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return{
|
|
||||||
:album_id => params[:album_id],
|
|
||||||
:user_file => params[:user_file]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ class Album < Post
|
||||||
|
|
||||||
before_destroy :destroy_photos
|
before_destroy :destroy_photos
|
||||||
|
|
||||||
|
attr_accessible :name
|
||||||
|
|
||||||
def self.mine_or_friends(friend_param, current_user)
|
def self.mine_or_friends(friend_param, current_user)
|
||||||
friend_param ? Album.find_all_by_person_id(current_user.friend_ids) : current_user.person.albums
|
friend_param ? Album.find_all_by_person_id(current_user.friend_ids) : current_user.person.albums
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
class PhotoAlbumValidator < ActiveModel::Validator
|
class PhotoAlbumValidator < ActiveModel::Validator
|
||||||
def validate(document)
|
def validate(document)
|
||||||
unless document.album.person_id == document.person_id
|
unless document.album.person_id == document.person_id
|
||||||
document.errors[:base] << "You post photos to that album"
|
document.errors[:base] << "You can't post photos to that album"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,11 @@ class Post
|
||||||
after_destroy :destroy_comments
|
after_destroy :destroy_comments
|
||||||
|
|
||||||
def self.instantiate params
|
def self.instantiate params
|
||||||
self.create params.to_hash
|
new_post = self.new params.to_hash
|
||||||
|
new_post.person = params[:person]
|
||||||
|
new_post.public = params[:public]
|
||||||
|
new_post.save
|
||||||
|
new_post
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_json(opts={})
|
def as_json(opts={})
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
# Localization file for Swedish
|
# Localization file for Swedish
|
||||||
|
#
|
||||||
|
# This file has parts from rails-i18n project at
|
||||||
|
# http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale
|
||||||
|
|
||||||
sv:
|
sv:
|
||||||
activemodel:
|
activemodel:
|
||||||
|
|
@ -14,6 +17,11 @@ sv:
|
||||||
taken: "är redan taget"
|
taken: "är redan taget"
|
||||||
email:
|
email:
|
||||||
taken: "är redan taget"
|
taken: "är redan taget"
|
||||||
|
person:
|
||||||
|
attributes:
|
||||||
|
diaspora_handle:
|
||||||
|
taken: "är redan taget"
|
||||||
|
|
||||||
hello: "Hej världen!"
|
hello: "Hej världen!"
|
||||||
application:
|
application:
|
||||||
helper:
|
helper:
|
||||||
|
|
@ -24,24 +32,24 @@ sv:
|
||||||
home: "hem"
|
home: "hem"
|
||||||
error_messages:
|
error_messages:
|
||||||
helper:
|
helper:
|
||||||
invalid_fields: "Ogiltiga fält"
|
invalid_fields: "Ogiltiga uppgifter"
|
||||||
correct_the_following_errors_and_try_again: "Rätta följande fel och försök igen."
|
correct_the_following_errors_and_try_again: "Rätta följande fel och försök igen."
|
||||||
people:
|
people:
|
||||||
helper:
|
helper:
|
||||||
results_for: " resultat för %{params}"
|
results_for: " resultat för %{params}"
|
||||||
people_on_pod_are_aware_of: " personer på denna pod är medveten om att"
|
people_on_pod_are_aware_of: " personer på denna plats är medvetna om att"
|
||||||
layouts:
|
layouts:
|
||||||
application:
|
application:
|
||||||
edit_profile: "ändra profil"
|
edit_profile: "ändra profil"
|
||||||
logout: "logga ut"
|
logout: "logga ut"
|
||||||
shared:
|
shared:
|
||||||
aspect_nav:
|
aspect_nav:
|
||||||
all_aspects: "Alla Aspekter"
|
all_aspects: "Alla sidor"
|
||||||
manage: "Hantera"
|
manage: "Hantera"
|
||||||
manage_your_aspects: "Hantera dina Aspekter"
|
manage_your_aspects: "Hantera dina sidor"
|
||||||
sub_header:
|
sub_header:
|
||||||
all_aspects: "Alla Aspekter"
|
all_aspects: "Alla sidor"
|
||||||
manage_aspects: "Hantera Aspekter"
|
manage_aspects: "Hantera sidor"
|
||||||
publisher:
|
publisher:
|
||||||
share: "Dela"
|
share: "Dela"
|
||||||
aspect_friends:
|
aspect_friends:
|
||||||
|
|
@ -52,66 +60,66 @@ sv:
|
||||||
you: "du"
|
you: "du"
|
||||||
new_album:
|
new_album:
|
||||||
create: "skapa"
|
create: "skapa"
|
||||||
add_a_new_album: "Lägg till ett nytt Album"
|
add_a_new_album: "Lägg till ett nytt fotoalbum"
|
||||||
show:
|
show:
|
||||||
edit_album: "Ändra Album"
|
edit_album: "Ändra fotoalbum"
|
||||||
albums: "album"
|
albums: "fotoalbum"
|
||||||
updated: "updated"
|
updated: "uppdaterad"
|
||||||
by: "av"
|
by: "av"
|
||||||
edit:
|
edit:
|
||||||
editing: "Ändrar"
|
editing: "Ändrar"
|
||||||
updated: "uppdaterad"
|
updated: "uppdaterad"
|
||||||
are_you_sure: "Är du säker?"
|
are_you_sure: "Är du säker?"
|
||||||
delete_album: "Ta bort album"
|
delete_album: "Ta bort fotoalbum"
|
||||||
cancel: "Avbryt"
|
cancel: "Avbryt"
|
||||||
index:
|
index:
|
||||||
home: "hem"
|
home: "hem"
|
||||||
new_album: "NyttAlbum"
|
new_album: "Nytt fotoalbum"
|
||||||
create:
|
create:
|
||||||
success: "Du har nu skapat albumet %{name}."
|
success: "Du har nu skapat fotoalbumet %{name}."
|
||||||
update:
|
update:
|
||||||
success: "Albumet %{name} ändrades."
|
success: "Fotoalbumet %{name} ändrades."
|
||||||
failure: "Ändringarna av albumet %{name} misslyckades."
|
failure: "Ändringarna av fotoalbumet %{name} misslyckades."
|
||||||
destroy:
|
destroy:
|
||||||
success: "Albumet %{name} är nu borttaget."
|
success: "Fotoalbumet %{name} är nu borttaget."
|
||||||
helper:
|
helper:
|
||||||
friends_albums: "Vänners Album"
|
friends_albums: "Vänners fotoalbum"
|
||||||
your_albums: "Dina Album"
|
your_albums: "Dina fotoalbum"
|
||||||
aspects:
|
aspects:
|
||||||
no_friends_message:
|
no_friends_message:
|
||||||
nobody: "Vi vet att du har vänner, bjud in dem till Diaspora!"
|
nobody: "Vi vet att du har vänner, bjud in dem till Diaspora!"
|
||||||
nobody_in_aspect: "Aspekten '%{aspect_name}' är tom."
|
nobody_in_aspect: "Sidan '%{aspect_name}' är tom."
|
||||||
add_friend: "Lägg till en vän"
|
add_friend: "Lägg till en vän"
|
||||||
add_friend_to: "Lägg till en vän i %{aspect_name}"
|
add_friend_to: "Lägg till en vän i %{aspect_name}"
|
||||||
invite: "Bjud in en vän till Diaspora!"
|
invite: "Bjud in en vän till Diaspora!"
|
||||||
no_posts_message:
|
no_posts_message:
|
||||||
start_talking: "Ingen har sagt något än. Bli först!"
|
start_talking: "Ingen har sagt något än. Bli först!"
|
||||||
manage:
|
manage:
|
||||||
add_a_new_aspect: "Lägg till en ny aspekt"
|
add_a_new_aspect: "Lägg till en ny sida"
|
||||||
add_a_new_friend: "Lägg till en ny vän"
|
add_a_new_friend: "Lägg till en ny vän"
|
||||||
show: "Visa"
|
show: "Visa"
|
||||||
update_aspects: "Uppdatera Aspekter"
|
update_aspects: "Uppdatera sidor"
|
||||||
requests: "Förfrågningar"
|
requests: "Vänförfrågningar"
|
||||||
ignore_remove: "Ignorera/Ta bort"
|
ignore_remove: "Ignorera/Ta bort"
|
||||||
new_aspect:
|
new_aspect:
|
||||||
add_a_new_aspect: "Lägg till ny aspekt"
|
add_a_new_aspect: "Lägg till ny sida"
|
||||||
create: "Skapa"
|
create: "Skapa"
|
||||||
create:
|
create:
|
||||||
success: "Klicka på plustecknet till höger för att välja vilka som kan se din nya aspekt."
|
success: "Klicka på plustecknet till höger för att välja vilka som kan se din nya sida."
|
||||||
failure: "Aspekten kunde inte skapas."
|
failure: "Sidan kunde inte skapas."
|
||||||
destroy:
|
destroy:
|
||||||
success: "%{name} är nu borttagen."
|
success: "%{name} är nu borttagen."
|
||||||
update:
|
update:
|
||||||
success: "Din aspekt, %{name}, är nu ändrad."
|
success: "Din sida %{name} är nu ändrad."
|
||||||
move_friend:
|
move_friend:
|
||||||
failure: "fungerade inte %{inspect}"
|
failure: "fungerade inte %{inspect}"
|
||||||
success: "Personen flyttades till den nya aspekten"
|
success: "Personen flyttades till den nya sidan"
|
||||||
add_to_aspect:
|
add_to_aspect:
|
||||||
failure: "Misslyckades med att lägga personen i den nya aspekten."
|
failure: "Misslyckades med att lägga in personen på den nya sidan."
|
||||||
success: "Personen tillagt i aspekten."
|
success: "Personen tillagt på sidan."
|
||||||
helper:
|
helper:
|
||||||
remove: "ta bort"
|
remove: "ta bort"
|
||||||
aspect_not_empty: "Aspekten är inte tom"
|
aspect_not_empty: "Sidan är inte tom"
|
||||||
users:
|
users:
|
||||||
edit:
|
edit:
|
||||||
editing_profile: "Ändrar profil"
|
editing_profile: "Ändrar profil"
|
||||||
|
|
@ -119,12 +127,12 @@ sv:
|
||||||
cancel: "Avbryt"
|
cancel: "Avbryt"
|
||||||
update_profile: "Uppdatera Profil"
|
update_profile: "Uppdatera Profil"
|
||||||
home: "Hem"
|
home: "Hem"
|
||||||
diaspora_username: "DIASPORA-ID:"
|
diaspora_username: "Diaspora-användarnamn:"
|
||||||
info: "Info"
|
info: "Info"
|
||||||
picture: "Profilbild"
|
picture: "Profilbild"
|
||||||
editing_profile: "Ändrar profil"
|
editing_profile: "Ändrar profil"
|
||||||
albums: "Album"
|
albums: "Album"
|
||||||
you_dont_have_any_photos: "Do har inga foton! Gå till"
|
you_dont_have_any_photos: "Du har inga foton! Gå till"
|
||||||
page_to_upload_some: "sidan för att ladda upp några."
|
page_to_upload_some: "sidan för att ladda upp några."
|
||||||
or: "eller"
|
or: "eller"
|
||||||
destroy: "Ditt konto är nu stängt."
|
destroy: "Ditt konto är nu stängt."
|
||||||
|
|
@ -138,21 +146,21 @@ sv:
|
||||||
prev: "föregående"
|
prev: "föregående"
|
||||||
full_size: "full storlek"
|
full_size: "full storlek"
|
||||||
next: "nästa"
|
next: "nästa"
|
||||||
edit_photo: "Ändra Foto"
|
edit_photo: "Ändra foto"
|
||||||
delete_photo: "Ta bort Foto"
|
delete_photo: "Ta bort foto"
|
||||||
are_you_sure: "Är du säker?"
|
are_you_sure: "Är du säker?"
|
||||||
comments: "kommentarer"
|
comments: "kommentarer"
|
||||||
edit:
|
edit:
|
||||||
editing: "Ändrar"
|
editing: "Ändrar"
|
||||||
are_you_sure: "Är du säker?"
|
are_you_sure: "Är du säker?"
|
||||||
delete_photo: "Ta bort Foto"
|
delete_photo: "Ta bort foto"
|
||||||
photo:
|
photo:
|
||||||
show_comments: "visa kommentarer"
|
show_comments: "visa kommentarer"
|
||||||
posted_a_new_photo_to: "laddade upp ett nytt foto till"
|
posted_a_new_photo_to: "laddade upp ett nytt foto till"
|
||||||
delete: "Ta bort"
|
delete: "Ta bort"
|
||||||
are_you_sure: "Är du säker?"
|
are_you_sure: "Är du säker?"
|
||||||
new:
|
new:
|
||||||
new_photo: "Nytt Foto"
|
new_photo: "Nytt foto"
|
||||||
back_to_list: "Tillbaka till listan"
|
back_to_list: "Tillbaka till listan"
|
||||||
post_it: "skicka!"
|
post_it: "skicka!"
|
||||||
create:
|
create:
|
||||||
|
|
@ -176,7 +184,7 @@ sv:
|
||||||
already_sent: 'Du har redan bjudit in denna person.'
|
already_sent: 'Du har redan bjudit in denna person.'
|
||||||
already_friends: 'Du är redan vän med den här personen'
|
already_friends: 'Du är redan vän med den här personen'
|
||||||
invitation_token_invalid: 'Din inbjudningskod är inte giltig!'
|
invitation_token_invalid: 'Din inbjudningskod är inte giltig!'
|
||||||
updated: 'Ditt lösenord är nu ändrats, och du har loggats in.'
|
updated: 'Ditt lösenord är nu uppdaterat, och du har loggats in.'
|
||||||
|
|
||||||
status_messages:
|
status_messages:
|
||||||
new_status_message:
|
new_status_message:
|
||||||
|
|
@ -199,14 +207,14 @@ sv:
|
||||||
people:
|
people:
|
||||||
person:
|
person:
|
||||||
add_friend: "lägg till vän"
|
add_friend: "lägg till vän"
|
||||||
pending_request: "väntande förfrågan"
|
pending_request: "väntande vänförfrågan"
|
||||||
index:
|
index:
|
||||||
add_friend: "lägg till vän"
|
add_friend: "lägg till vän"
|
||||||
real_name: "verkligt namn"
|
real_name: "verkligt namn"
|
||||||
diaspora_handle: "diaspora-id"
|
diaspora_handle: "diaspora-adress"
|
||||||
thats_you: "det är du!"
|
thats_you: "det är du!"
|
||||||
friend_request_pending: "förfrågan är skickad"
|
friend_request_pending: "vänförfrågan är skickad"
|
||||||
you_have_a_friend_request_from_this_person: "du har en väntande förfrågan från den här personen"
|
you_have_a_friend_request_from_this_person: "du har en väntande vänförfrågan från den här personen"
|
||||||
new:
|
new:
|
||||||
new_person: "Ny Person"
|
new_person: "Ny Person"
|
||||||
back_to_list: "Tillbaka till listan"
|
back_to_list: "Tillbaka till listan"
|
||||||
|
|
@ -220,18 +228,217 @@ sv:
|
||||||
requests:
|
requests:
|
||||||
new_request:
|
new_request:
|
||||||
add_a_new_friend_to: "Lägg till en vän till"
|
add_a_new_friend_to: "Lägg till en vän till"
|
||||||
enter_a_diaspora_username: "Ange ett Diaspora-id:"
|
enter_a_diaspora_username: "Ange ett användarnamn:"
|
||||||
your_diaspora_username_is: "Ditt Diaspora-id är: %{diaspora_handle}"
|
your_diaspora_username_is: "Din Diaspora-adress är: %{diaspora_handle}"
|
||||||
friends_username: "Vännens Diaspora-id"
|
friends_username: "Vännens Diaspora-adress"
|
||||||
destroy:
|
destroy:
|
||||||
success: "Ni är nu vänner."
|
success: "Ni är nu vänner."
|
||||||
error: "Var god välj en aspekt!"
|
error: "Var god välj en aspekt!"
|
||||||
ignore: "Ignorerade förfrågan."
|
ignore: "Ignorerade vänförfrågan."
|
||||||
create:
|
create:
|
||||||
error: "Ingen diaspora seed med detta id hittades!"
|
error: "Inget diaspora-frö med denna adress hittades!"
|
||||||
invalid_identity: "Detta id har ett ogiltigt format"
|
invalid_identity: "Denna adress har ett ogiltigt format"
|
||||||
error_server: "Problem att kontaka den andra servern. Är det möjligt att den inte finns?"
|
error_server: "Problem att kontaka den andra servern. Är det möjligt att den inte finns?"
|
||||||
yourself: "Du kan inte fråga dig själv!"
|
yourself: "Du kan inte lägga till dig själv!"
|
||||||
already_friends: "Du är redan vän med %{destination_url}!"
|
already_friends: "Du är redan vän med %{destination_url}!"
|
||||||
success: "En förfrågan har skickats till %{destination_url}."
|
success: "En vänförfrågan har skickats till %{destination_url}."
|
||||||
horribly_wrong: "Nu gick något rejält fel här."
|
horribly_wrong: "Nu gick något rejält fel här."
|
||||||
|
|
||||||
|
# The following is from the rails-i18n project at http://github.com/svenfuchs/rails-i18n
|
||||||
|
|
||||||
|
# Swedish translation.
|
||||||
|
# By Johan Lundström (johanlunds@gmail.com) with parts taken from http://github.com/daniel/swe_rails.
|
||||||
|
# With contributions by:
|
||||||
|
# * Sven Dahlstrand (sven.dahlstrand@gmail.com)
|
||||||
|
# * Henrik Nyh (henrik@nyh.se)
|
||||||
|
|
||||||
|
number:
|
||||||
|
# Used in number_with_delimiter()
|
||||||
|
# These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
|
||||||
|
format:
|
||||||
|
# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
|
||||||
|
separator: ","
|
||||||
|
# Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three)
|
||||||
|
delimiter: " "
|
||||||
|
# Number of decimals after the separator (the number 1 with a precision of 2 gives: 1.00)
|
||||||
|
precision: 2
|
||||||
|
|
||||||
|
# Used in number_to_currency()
|
||||||
|
currency:
|
||||||
|
format:
|
||||||
|
# Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
|
||||||
|
format: "%n %u"
|
||||||
|
unit: "kr"
|
||||||
|
|
||||||
|
# Used in number_to_human_size()
|
||||||
|
human:
|
||||||
|
format:
|
||||||
|
# These three are to override number.format and are optional
|
||||||
|
# separator:
|
||||||
|
# delimiter: ""
|
||||||
|
precision: 1
|
||||||
|
storage_units:
|
||||||
|
# Storage units output formatting.
|
||||||
|
# %u is the storage unit, %n is the number (default: 2 MB)
|
||||||
|
format: "%n %u"
|
||||||
|
units:
|
||||||
|
byte:
|
||||||
|
one: "Byte"
|
||||||
|
other: "Bytes"
|
||||||
|
kb: "KB"
|
||||||
|
mb: "MB"
|
||||||
|
gb: "GB"
|
||||||
|
tb: "TB"
|
||||||
|
|
||||||
|
# Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words()
|
||||||
|
datetime:
|
||||||
|
distance_in_words:
|
||||||
|
half_a_minute: "en halv minut"
|
||||||
|
less_than_x_seconds:
|
||||||
|
one: "mindre än en sekund"
|
||||||
|
other: "mindre än %{count} sekunder"
|
||||||
|
x_seconds:
|
||||||
|
one: "en sekund"
|
||||||
|
other: "%{count} sekunder"
|
||||||
|
less_than_x_minutes:
|
||||||
|
one: "mindre än en minut"
|
||||||
|
other: "mindre än %{count} minuter"
|
||||||
|
x_minutes:
|
||||||
|
one: "en minut"
|
||||||
|
other: "%{count} minuter"
|
||||||
|
about_x_hours:
|
||||||
|
one: "ungefär en timme"
|
||||||
|
other: "ungefär %{count} timmar"
|
||||||
|
x_days:
|
||||||
|
one: "en dag"
|
||||||
|
other: "%{count} dagar"
|
||||||
|
about_x_months:
|
||||||
|
one: "ungefär en månad"
|
||||||
|
other: "ungefär %{count} månader"
|
||||||
|
x_months:
|
||||||
|
one: "en månad"
|
||||||
|
other: "%{count} månader"
|
||||||
|
about_x_years:
|
||||||
|
one: "ungefär ett år"
|
||||||
|
other: "ungefär %{count} år"
|
||||||
|
over_x_years:
|
||||||
|
one: "mer än ett år"
|
||||||
|
other: "mer än %{count} år"
|
||||||
|
almost_x_years:
|
||||||
|
one: "nästan ett år"
|
||||||
|
other: "nästan %{count} år"
|
||||||
|
prompts:
|
||||||
|
year: "År"
|
||||||
|
month: "Månad"
|
||||||
|
day: "Dag"
|
||||||
|
hour: "Timme"
|
||||||
|
minute: "Minut"
|
||||||
|
second: "Sekund"
|
||||||
|
|
||||||
|
activemodel:
|
||||||
|
errors:
|
||||||
|
template:
|
||||||
|
header:
|
||||||
|
one: "Ett fel förhindrade denna %{model} från att sparas"
|
||||||
|
other: "%{count} fel förhindrade denna %{model} från att sparas"
|
||||||
|
# The variable :count is also available
|
||||||
|
body: "Det var problem med följande fält:"
|
||||||
|
|
||||||
|
activerecord:
|
||||||
|
errors:
|
||||||
|
# model.errors.full_messages format.
|
||||||
|
format: "%{attribute} %{message}"
|
||||||
|
|
||||||
|
template:
|
||||||
|
header:
|
||||||
|
one: "Ett fel förhindrade denna %{model} från att sparas"
|
||||||
|
other: "%{count} fel förhindrade denna %{model} från att sparas"
|
||||||
|
body: "Det var problem med följande fält:"
|
||||||
|
|
||||||
|
# The values :model, :attribute and :value are always available for interpolation
|
||||||
|
# The value :count is available when applicable. Can be used for pluralization.
|
||||||
|
messages:
|
||||||
|
inclusion: "finns inte i listan"
|
||||||
|
exclusion: "är reserverat"
|
||||||
|
invalid: "är ogiltigt"
|
||||||
|
confirmation: "stämmer inte överens"
|
||||||
|
accepted: "måste vara accepterad"
|
||||||
|
empty: "får ej vara tom"
|
||||||
|
blank: "måste anges"
|
||||||
|
too_long: "är för lång (maximum är %{count} tecken)"
|
||||||
|
too_short: "är för kort (minimum är %{count} tecken)"
|
||||||
|
wrong_length: "har fel längd (ska vara %{count} tecken)"
|
||||||
|
taken: "har redan tagits"
|
||||||
|
not_a_number: "är inte ett nummer"
|
||||||
|
greater_than: "måste vara större än %{count}"
|
||||||
|
greater_than_or_equal_to: "måste vara större än eller lika med %{count}"
|
||||||
|
equal_to: "måste vara samma som"
|
||||||
|
less_than: "måste vara mindre än %{count}"
|
||||||
|
less_than_or_equal_to: "måste vara mindre än eller lika med %{count}"
|
||||||
|
odd: "måste vara udda"
|
||||||
|
even: "måste vara jämnt"
|
||||||
|
record_invalid: "Ett fel uppstod: %{errors}"
|
||||||
|
# Append your own errors here or at the model/attributes scope.
|
||||||
|
|
||||||
|
# You can define own errors for models or model attributes.
|
||||||
|
# The values :model, :attribute and :value are always available for interpolation.
|
||||||
|
#
|
||||||
|
# For example,
|
||||||
|
# models:
|
||||||
|
# user:
|
||||||
|
# blank: "This is a custom blank message for %{model}: %{attribute}"
|
||||||
|
# attributes:
|
||||||
|
# login:
|
||||||
|
# blank: "This is a custom blank message for User login"
|
||||||
|
# Will define custom blank validation message for User model and
|
||||||
|
# custom blank validation message for login attribute of User model.
|
||||||
|
# models:
|
||||||
|
|
||||||
|
# Translate model names. Used in Model.human_name().
|
||||||
|
#models:
|
||||||
|
# For example,
|
||||||
|
# user: "Dude"
|
||||||
|
# will translate User model name to "Dude"
|
||||||
|
|
||||||
|
# Translate model attribute names. Used in Model.human_attribute_name(attribute).
|
||||||
|
#attributes:
|
||||||
|
# For example,
|
||||||
|
# user:
|
||||||
|
# login: "Handle"
|
||||||
|
# will translate User attribute "login" as "Handle"
|
||||||
|
|
||||||
|
date:
|
||||||
|
formats:
|
||||||
|
# Use the strftime parameters for formats.
|
||||||
|
# When no format has been given, it uses default.
|
||||||
|
# You can provide other formats here if you like!
|
||||||
|
default: "%Y-%m-%d"
|
||||||
|
short: "%e %b"
|
||||||
|
long: "%e %B %Y"
|
||||||
|
|
||||||
|
day_names: [söndag, måndag, tisdag, onsdag, torsdag, fredag, lördag]
|
||||||
|
abbr_day_names: [sön, mån, tis, ons, tor, fre, lör]
|
||||||
|
|
||||||
|
# Don't forget the nil at the beginning; there's no such thing as a 0th month
|
||||||
|
month_names: [~, januari, februari, mars, april, maj, juni, juli, augusti, september, oktober, november, december]
|
||||||
|
abbr_month_names: [~, jan, feb, mar, apr, maj, jun, jul, aug, sep, okt, nov, dec]
|
||||||
|
# Used in date_select and datime_select.
|
||||||
|
order: [ :day, :month, :year ]
|
||||||
|
|
||||||
|
time:
|
||||||
|
formats:
|
||||||
|
default: "%a, %e %b %Y %H:%M:%S %z"
|
||||||
|
short: "%e %b %H:%M"
|
||||||
|
long: "%e %B %Y %H:%M"
|
||||||
|
am: ""
|
||||||
|
pm: ""
|
||||||
|
|
||||||
|
# Used in array.to_sentence.
|
||||||
|
support:
|
||||||
|
array:
|
||||||
|
words_connector: ", "
|
||||||
|
two_words_connector: " och "
|
||||||
|
last_word_connector: " och "
|
||||||
|
select:
|
||||||
|
# default value for :prompt => true in FormOptionsHelper
|
||||||
|
prompt: "Välj"
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- This file lives in public/404.html -->
|
<!-- This file lives in public/404.html -->
|
||||||
<div class="dialog">
|
<img src="images/404.png"/>
|
||||||
<h1>The page you were looking for doesn't exist.</h1>
|
|
||||||
<p>You should try going outside.</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
BIN
public/images/404.png
Normal file
BIN
public/images/404.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -13,11 +13,6 @@ describe AlbumsController do
|
||||||
sign_in :user, @user
|
sign_in :user, @user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should update the name of an album" do
|
|
||||||
put :update, :id => @album.id, :album => { :name => "new_name"}
|
|
||||||
@album.reload.name.should eql("new_name")
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
it 'all aspects' do
|
it 'all aspects' do
|
||||||
params = {"album" => {"name" => "Sunsets","to" => "all"}}
|
params = {"album" => {"name" => "Sunsets","to" => "all"}}
|
||||||
|
|
@ -28,4 +23,19 @@ describe AlbumsController do
|
||||||
post :create, params
|
post :create, params
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#update" do
|
||||||
|
it "should update the name of an album" do
|
||||||
|
put :update, :id => @album.id, :album => { :name => "new_name"}
|
||||||
|
@album.reload.name.should eql("new_name")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "doesn't overwrite random attributes" do
|
||||||
|
new_user = Factory.create :user
|
||||||
|
params = {:name => "Bruisers", :person_id => new_user.person.id}
|
||||||
|
put('update', :id => @album.id, "album" => params)
|
||||||
|
@album.reload.person_id.should == @user.person.id
|
||||||
|
@album.name.should == 'Bruisers'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ describe DevUtilitiesController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@tom = Factory.create(:user, :email => "tom@tom.joindiaspora.org")
|
@tom = Factory.create(:user_with_aspect, :email => "tom@tom.joindiaspora.org")
|
||||||
sign_in :user, @tom
|
sign_in :user, @tom
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
38
spec/controllers/photos_controller_spec.rb
Normal file
38
spec/controllers/photos_controller_spec.rb
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe PhotosController do
|
||||||
|
render_views
|
||||||
|
before do
|
||||||
|
@user = Factory.create(:user)
|
||||||
|
@aspect = @user.aspect(:name => "lame-os")
|
||||||
|
@album = @user.post :album, :to => @aspect.id, :name => 'things on fire'
|
||||||
|
@fixture_filename = 'button.png'
|
||||||
|
@fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', @fixture_filename)
|
||||||
|
image = File.open(@fixture_name)
|
||||||
|
#@photo = Photo.instantiate(
|
||||||
|
# :person => @user.person, :album => @album, :user_file => image)
|
||||||
|
@photo = @user.post(:photo, :album_id => @album.id, :user_file => image, :to => @aspect.id)
|
||||||
|
sign_in :user, @user
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#create' do
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#update" do
|
||||||
|
it "should update the caption of a photo" do
|
||||||
|
put :update, :id => @photo.id, :photo => { :caption => "now with lasers!"}
|
||||||
|
@photo.reload.caption.should == "now with lasers!"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "doesn't overwrite random attributes" do
|
||||||
|
new_user = Factory.create :user
|
||||||
|
params = { :caption => "now with lasers!", :person_id => new_user.id}
|
||||||
|
put :update, :id => @photo.id, :photo => params
|
||||||
|
@photo.reload.person_id.should == @user.person.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -39,13 +39,14 @@ describe Photo do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'must have an album' do
|
it 'must have an album' do
|
||||||
photo = Photo.new(:person => @user.person)
|
photo = Photo.new()
|
||||||
|
photo.person = @user.person
|
||||||
photo.image = File.open(@fixture_name)
|
photo.image = File.open(@fixture_name)
|
||||||
photo.save
|
photo.save
|
||||||
photo.valid?.should be false
|
photo.valid?.should be false
|
||||||
photo.album = Album.create(:name => "foo", :person => @user.person)
|
photo.album = @album
|
||||||
photo.save
|
photo.save
|
||||||
Photo.first.album.name.should == 'foo'
|
photo.reload.album.name.should == 'foo'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have a caption' do
|
it 'should have a caption' do
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,30 @@ describe User do
|
||||||
user.encryption_key.should_not be nil
|
user.encryption_key.should_not be nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'overwriting people' do
|
||||||
|
it 'does not overwrite old users with factory' do
|
||||||
|
new_user = Factory.create(:user, :id => user.id)
|
||||||
|
new_user.persisted?.should be_true
|
||||||
|
new_user.id.should_not == user.id
|
||||||
|
end
|
||||||
|
it 'does not overwrite old users with create' do
|
||||||
|
params = {:username => "ohai",
|
||||||
|
:email => "ohai@example.com",
|
||||||
|
:password => "password",
|
||||||
|
:password_confirmation => "password",
|
||||||
|
:person =>
|
||||||
|
{:profile =>
|
||||||
|
{:first_name => "O",
|
||||||
|
:last_name => "Hai"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params[:id] = user.id
|
||||||
|
new_user = User.build(params)
|
||||||
|
new_user.save
|
||||||
|
new_user.persisted?.should be_true
|
||||||
|
new_user.id.should_not == user.id
|
||||||
|
end
|
||||||
|
end
|
||||||
describe "validation" do
|
describe "validation" do
|
||||||
describe "of associated person" do
|
describe "of associated person" do
|
||||||
it "fails if person is not valid" do
|
it "fails if person is not valid" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue