Pulling in changes from master

This commit is contained in:
Raphael 2011-01-17 11:41:15 -08:00
commit 36781481bb
66 changed files with 924 additions and 115 deletions

View file

@ -33,6 +33,8 @@
- unless @landing_page
= include_javascripts :main
- if ["cz", "da", "de", "el", "es", "fr", "he", "hu", "id", "it", "ja", "ko", "nl", "pl", "pt", "ro", "ru", "sv", "zh-CN"].include?(I18n.locale.to_s)
= javascript_include_tag "vendor/timeago_locale/jquery.timeago.#{I18n.locale.to_s}.js"
- if current_user
= include_javascripts :flash_socket #unless modern_browser?

View file

@ -1,4 +1,4 @@
#author_info
#author_info.show
= person_image_link(person)
.from
%h4

View file

@ -31,7 +31,7 @@
= render 'status_messages/status_message', :post => post, :photos => photos
.info
%span.time= link_to(how_long_ago(post), status_message_path(post))
%span.timeago= link_to(how_long_ago(post), status_message_path(post))
= link_to t('comments.new_comment.comment').downcase, '#', :class => 'focus_comment_textarea'
= render "comments/comments", :post_id => post.id, :comment_hashes => comments, :condensed => true, :commenting_disabled => defined?(@commenting_disabled)

View file

@ -14,9 +14,12 @@ javascripts:
- public/javascripts/vendor/jquery.infinitescroll.min.js
- public/javascripts/vendor/timeago.js
- public/javascripts/vendor/fileuploader.js
- public/javascripts/vendor/Mustache.js
- public/javascripts/view.js
- public/javascripts/stream.js
- public/javascripts/application.js
- public/javascripts/diaspora.js
- public/javascripts/widgets/alert.js
mobile:
- public/javascripts/vendor/jquery144.min.js

View file

@ -60,6 +60,7 @@ ar:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ ca:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ cs:
add_existing: "Přidat existující kontakt"
confirm_remove_aspect: "Opravdu chcete odstranit tento aspekt?"
remove_aspect: "Odstranit tento aspekt"
rename: "přejmenovat"
rename_aspect: "Přejmenovat aspekt"
helper:
are_you_sure: "Opravdu chcete odstranit tento aspekt?"

View file

@ -60,6 +60,7 @@ cy:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ da:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Er du sikker på at du vil fjerne dette aspekt?"

View file

@ -60,6 +60,7 @@ de:
add_existing: "Ein bereits bestehendes Konto hinzufügen"
confirm_remove_aspect: "Bist du dir sicher, dass du diesen Aspekt löschen möchtest?"
remove_aspect: "Aspekt löschen"
rename: "umbenennen"
rename_aspect: "Aspekt umbenennen"
helper:
are_you_sure: "Möchtest du diesen Aspekt wirklich löschen?"

View file

@ -4,11 +4,11 @@
el:
_aspect: "Aspect"
_aspects: "Aspects"
_aspect: "Πτυχή"
_aspects: "Πτυχές"
_comments: "Σχόλια"
_contact: "Contact"
_contacts: "Contacts"
_contact: "Επαφή"
_contacts: "Επαφές"
_home: "Αρχική"
_photos: "φωτογραφίες"
_services: "Υπηρεσίες"
@ -57,17 +57,18 @@ el:
destroy:
success: "Ο χρήστης %{name} αφαιρέθηκε επιτυχώς."
edit:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename_aspect: "Rename aspect"
add_existing: "Προσθέστε μια υπάρχουσα επαφή"
confirm_remove_aspect: "Είστε σίγουρος/η πως θέλετε να διαγράψετε αυτή την πτυχή;"
remove_aspect: "Διαγραφή αυτής της πτυχής"
rename: "μετονομασία"
rename_aspect: "Μετονομασία πτυχής"
helper:
are_you_sure: "Είστε σίγουρος/η πως θέλετε να διαγράψετε αυτή την πτυχή;"
aspect_not_empty: "Η πτυχή δεν είναι άδεια"
remove: "αφαίρεση"
index:
handle_explanation: "Αυτό είναι το αναγνωριστικό σας στο Diaspora. Όπως και με μια διεύθυνση ηλεκτρονικού ταχυδρομείου, μπορείτε να το δώσετε σε άλλους για να μπορέσουν να σας βρουν."
no_contacts: "No contacts"
no_contacts: "Καμία επαφή"
manage:
add_a_new_aspect: "Προσθέστε μια νέα πτυχή"
add_a_new_contact: "Προσθήκη νέας επαφής"
@ -178,7 +179,7 @@ el:
next: "επόμενο"
no_new_notifications: "καμία νέα ειδοποίηση"
notifications:
also_commented: "also commented on"
also_commented: "επίσης σχολίασε στο"
comment_on_post: "σχολίασε τη"
deleted: "διαγράφηκε"
index:
@ -188,13 +189,13 @@ el:
request_accepted: "δέχτηκε το αίτημα σας για διαμοιρασμό. "
notifier:
also_commented:
commented: "has also commented on %{post_author}'s post:"
sign_in: "Sign in to view it."
subject: "%{name} has also commented."
commented: "σχολίασε επίσης τη δημοσίευση του χρήστη %{post_author} :"
sign_in: "Συνδεθείτε για να το δείτε."
subject: "Ο χρήστης %{name} επίσης σχολίασε."
comment_on_post:
commented: "has commented on your post!"
sign_in: "Sign in to view it."
subject: "%{name} has commented on your post."
commented: "σχολίασε τη δημισίευση σας!"
sign_in: "Συνδεθείτε για να το δείτε."
subject: "Ο χρήστης %{name} σχολίασε τη δημοσίευση σας."
diaspora: "ρομπότ για τα email του δικτύου Diaspora"
hello: "Γειά σου %{name}!"
love: "αγάπη,"

View file

@ -4,11 +4,11 @@
en_shaw:
_aspect: "Aspect"
_aspects: "Aspects"
_aspect: "𐑨𐑕𐑐𐑧𐑒𐑑"
_aspects: "𐑨𐑕𐑐𐑧𐑒𐑑𐑕"
_comments: "𐑒𐑪𐑥𐑩𐑯𐑑𐑕"
_contact: "Contact"
_contacts: "Contacts"
_contact: "𐑒𐑪𐑯𐑑𐑨𐑒𐑑"
_contacts: "𐑒𐑪𐑯𐑑𐑨𐑒𐑑𐑕"
_home: "Home"
_photos: "𐑓𐑴𐑑𐑴𐑟"
_services: "Services"
@ -57,17 +57,18 @@ en_shaw:
destroy:
success: "%{name} 𐑢𐑪𐑟 𐑕𐑩𐑒𐑕𐑧𐑕𐑓𐑫𐑤𐑦 𐑮𐑦𐑥𐑵𐑝𐑛."
edit:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename_aspect: "Rename aspect"
add_existing: "𐑨𐑛 𐑩𐑯 𐑧𐑜𐑟𐑦𐑕𐑑𐑦𐑙 𐑒𐑪𐑯𐑑𐑨𐑒𐑑"
confirm_remove_aspect: "𐑸 𐑿 𐑖𐑻 𐑿 𐑢𐑳𐑯𐑑 𐑑 𐑛𐑦𐑤𐑰𐑑 𐑞𐑦𐑕 𐑨𐑕𐑐𐑧𐑒𐑑?"
remove_aspect: "𐑛𐑦𐑤𐑰𐑑 𐑞𐑦𐑕 𐑨𐑕𐑐𐑧𐑒𐑑"
rename: "𐑮𐑦𐑯𐑱𐑥"
rename_aspect: "𐑮𐑦𐑯𐑱𐑥 𐑨𐑕𐑐𐑧𐑒𐑑"
helper:
are_you_sure: "𐑸 𐑿 𐑖𐑻 𐑿 𐑢𐑳𐑯𐑑 𐑑 𐑛𐑦𐑤𐑰𐑑 𐑞𐑦𐑕 𐑨𐑕𐑐𐑧𐑒𐑑?"
aspect_not_empty: "𐑨𐑕𐑐𐑧𐑒𐑑 𐑯𐑪𐑑 𐑧𐑥𐑐𐑑𐑦"
remove: "𐑮𐑦𐑥𐑵𐑝"
index:
handle_explanation: "𐑞𐑦𐑕 𐑦𐑟 𐑿𐑼 ·𐑛𐑦𐑨𐑕𐑐𐑹𐑩 𐑣𐑨𐑯𐑛𐑩𐑤. 𐑤𐑲𐑒 𐑩𐑯 𐑦-𐑥𐑱𐑤 𐑩𐑛𐑮𐑧𐑕, 𐑿 𐑒 𐑜𐑦𐑝 𐑞𐑦𐑕 𐑑 𐑐𐑰𐑐𐑩𐑤 𐑑 𐑮𐑰𐑗 𐑿."
no_contacts: "No contacts"
no_contacts: "𐑯𐑴 𐑒𐑪𐑯𐑑𐑨𐑒𐑑𐑕"
manage:
add_a_new_aspect: "𐑨𐑛 𐑯𐑿 𐑨𐑕𐑐𐑧𐑒𐑑"
add_a_new_contact: "𐑨𐑛 𐑩 𐑯𐑿 𐑒𐑪𐑯𐑑𐑨𐑒𐑑"

View file

@ -60,6 +60,7 @@ eo:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ es-CL:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "¿Estás seguro que quieres eliminar este aspecto?"

View file

@ -60,6 +60,7 @@ es:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "¿Estás seguro de que quieres eliminar este aspecto?"

View file

@ -5,7 +5,7 @@
fi:
_aspect: "Näkymä"
_aspects: "Näkymät"
_aspects: "Näkymää"
_comments: "Kommentit"
_contact: "Kontakti"
_contacts: "Kontaktit"
@ -60,6 +60,7 @@ fi:
add_existing: "Lisää olemassa oleva kontakti"
confirm_remove_aspect: "Oletko varma että haluat poistaa tämän näkymän?"
remove_aspect: "Poista näkymä"
rename: "nimeä uudelleen"
rename_aspect: "Nimeä näkymä uudelleen"
helper:
are_you_sure: "Haluatko varmasti poistaa tämän näkymän?"

View file

@ -57,17 +57,18 @@ fr:
destroy:
success: "%{name} a été supprimé avec succès."
edit:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename_aspect: "Rename aspect"
add_existing: "Ajouter un contact existant"
confirm_remove_aspect: "Voulez-vous vraiment supprimer cet aspect ?"
remove_aspect: "Supprimer cet aspect"
rename: "renommer"
rename_aspect: "Renommer l'aspect"
helper:
are_you_sure: "Voulez-vous vraiment supprimer cet aspect ?"
aspect_not_empty: "Laspect nest pas vide"
remove: "supprimer"
index:
handle_explanation: "Ceci est votre handle diaspora. Comme une adresse de courrier électronique, vous pouvez le communiquer à d'autres personnes pour leur permettre de vous joindre."
no_contacts: "No contacts"
no_contacts: "Aucun contact"
manage:
add_a_new_aspect: "Ajouter un nouvel aspect"
add_a_new_contact: "Ajouter un nouveau contact"

View file

@ -60,6 +60,7 @@ ga:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ gl-ES:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -4,11 +4,11 @@
he:
_aspect: "Aspect"
_aspects: "Aspects"
_aspect: "היבט"
_aspects: "היבטים"
_comments: "תגובות"
_contact: "Contact"
_contacts: "Contacts"
_contact: "איש קשר"
_contacts: "אנשי קשר"
_home: "בית"
_photos: "תמונות"
_services: "שירותים"
@ -57,17 +57,18 @@ he:
destroy:
success: "%{name} הוסר בהצלחה."
edit:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename_aspect: "Rename aspect"
add_existing: "הוספת איש קשר קיים"
confirm_remove_aspect: "האם אכן ברצונך למחוק את ההיבט?"
remove_aspect: "מחיקת היבט זה"
rename: "שינוי שם"
rename_aspect: "שינוי שם ההיבט"
helper:
are_you_sure: "האם אכן ברצונך למחוק היבט זה?"
aspect_not_empty: "ההיבט אינו ריק"
remove: "הסרה"
index:
handle_explanation: "זהו שם המשתמש שלך בדיאספורה. כמו כתובת דואר אלקטרוני, ניתן לחלוק אותו עם אנשים כדי שיגיעו אליך."
no_contacts: "No contacts"
no_contacts: "אין אנשי קשר"
manage:
add_a_new_aspect: "הוספת היבט חדש"
add_a_new_contact: "הוספת איש קשר חדש"
@ -178,7 +179,7 @@ he:
next: "הבאה"
no_new_notifications: "אין התרעות חדשות"
notifications:
also_commented: "also commented on"
also_commented: "גם כן הגיב/ה על"
comment_on_post: "הגיב/ה על ה"
deleted: "נמחקה"
index:
@ -188,13 +189,13 @@ he:
request_accepted: "קיבל/ה את בקשת השיתוף שלך."
notifier:
also_commented:
commented: "has also commented on %{post_author}'s post:"
sign_in: "Sign in to view it."
subject: "%{name} has also commented."
commented: "גם כן הגיב/ה על הרשומה של %{post_author}:"
sign_in: "יש להיכנס כדי לצפות בזה."
subject: "%{name} גם כן הגיב/ה."
comment_on_post:
commented: "has commented on your post!"
sign_in: "Sign in to view it."
subject: "%{name} has commented on your post."
commented: "הגיב/ה על הרשומה שלך!"
sign_in: "יש להיכנס כדי לצפות בזה."
subject: "%{name} הגיב/ה על הרשומה שלך."
diaspora: "רובוט הדוא״ל של דיאספורה"
hello: "שלום %{name}!"
love: "באהבה,"

View file

@ -60,6 +60,7 @@ hu:
add_existing: "Létező kapcsolat hozzáadása"
confirm_remove_aspect: "Biztos, hogy törölni akarod a csoportot?"
remove_aspect: "Csoport törlése"
rename: "átnevezés"
rename_aspect: "Csoport átnevezése"
helper:
are_you_sure: "Biztos, hogy törlöd a csoportot?"
@ -134,8 +135,8 @@ hu:
share_what_you_want: "Oszd meg amit akarsz, azzal akivel akarod!"
simplicity: "Egyszerűség"
simplicity_explanation: "A Diaspora könnyűvé és érthetővé teszi a megosztást - és ez a biztonságra is vonatkozik. Nem kell hosszú beállító oldalakon átvergődnöd, hogy biztonságban tudd a profilodat."
tagline_first_half: "Ossz meg amit akarsz,"
tagline_second_half: "azzal akivel akarod."
tagline_first_half: "Megoszthatod,"
tagline_second_half: "akivel akarod."
invitations:
check_token:
not_found: "Meghívó token nem található"

View file

@ -60,6 +60,7 @@ id:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ it:
add_existing: "Aggiungi un contatto esistente"
confirm_remove_aspect: "Sei sicuro di voler eliminare questo aspetto?"
remove_aspect: "Elimina questo aspetto"
rename: "rename"
rename_aspect: "Rinomina aspetto"
helper:
are_you_sure: "Sei sicuro di voler eliminare questo aspetto?"

View file

@ -60,6 +60,7 @@ lt:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ mk:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ nb:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -5,10 +5,10 @@
nl:
_aspect: "Aspect"
_aspects: "Aspects"
_aspects: "Aspecten"
_comments: "Reacties"
_contact: "Contact"
_contacts: "Contacts"
_contacts: "Contacten"
_home: "Home"
_photos: "foto's"
_services: "Services"
@ -57,17 +57,18 @@ nl:
destroy:
success: "%{name} is met succes verwijderd."
edit:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename_aspect: "Rename aspect"
add_existing: "Voeg een bestaand contact toe"
confirm_remove_aspect: "Weet je zeker dat je dit aspect wilt verwijderen?"
remove_aspect: "Verwijder dit aspect"
rename: "hernoem"
rename_aspect: "Hernoem aspect"
helper:
are_you_sure: "Weet je zeker dat je dit aspect wilt verwijderen?"
aspect_not_empty: "Aspect niet leeg"
remove: "verwijderen"
index:
handle_explanation: "Dit is jouw Diaspora handle. Deze kun je aan mensen geven zodat ze je kunnen bereiken, net als een e-mailadres."
no_contacts: "No contacts"
no_contacts: "Geen contacten"
manage:
add_a_new_aspect: "Voeg een nieuw aspect toe"
add_a_new_contact: "Voeg contact toe"

View file

@ -60,6 +60,7 @@ pl:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ pt-BR:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ pt-PT:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ ro:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ ru:
add_existing: "Добавить существующий контакт"
confirm_remove_aspect: "Вы уверены, что хотите удалить этот аспект?"
remove_aspect: "Удалить этот аспект"
rename: "rename"
rename_aspect: "Переименовать аспект"
helper:
are_you_sure: "Вы уверены в том, что хотите удалить этот аспект?"

View file

@ -60,6 +60,7 @@ sk:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -60,6 +60,7 @@ sl:
add_existing: "Dodaj obstoječ kontakt"
confirm_remove_aspect: "Ste prepričani, da bi radi izbrisali ta vidik?"
remove_aspect: "Izbriši ta vidik"
rename: "rename"
rename_aspect: "Preimenuj vidik"
helper:
are_you_sure: "Ste prepričani, da želite izbrisati skupino?"

View file

@ -60,6 +60,7 @@ sv:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Är du säker på att du vill tabort den här sidan?"

View file

@ -60,6 +60,7 @@ tr:
add_existing: "Add an existing contact"
confirm_remove_aspect: "Are you sure you want to delete this aspect?"
remove_aspect: "Delete this aspect"
rename: "rename"
rename_aspect: "Rename aspect"
helper:
are_you_sure: "Are you sure you want to delete this aspect?"

View file

@ -93,7 +93,7 @@ var AspectEdit = {
var person_id = person.attr('data-guid');
if( $(".person[data-guid='"+ person_id +"']").length == 1) {
AspectEdit.alertUser("You cannot remove the person from the last aspect");
Diaspora.widgets.alert.alert("Error removing contact", "You cannot remove the person from the last aspect");
} else {
if (!person.hasClass('request')) {
@ -113,11 +113,12 @@ var AspectEdit = {
},
changeName: function() {
var $this = $(this);
var id = $this.closest(".aspect").attr("data-guid");
var link = "/aspects/" + id;
var $this = $(this),
id = $this.closest(".aspect").attr("data-guid"),
link = "/aspects/" + id;
$this.keypress(function(e) {
$this.keyup(function() {
if (e.which == 13) {
e.preventDefault();
$this.blur();
@ -133,10 +134,9 @@ var AspectEdit = {
}
});
}
//update all other aspect links
$this.keyup(function(e) {
$("#aspect_nav a[href='" + link + "']").text($this.text());
});
$("#aspect_nav li[data-guid='" + id + "'] a").text($this.text());
});
},
@ -162,10 +162,6 @@ var AspectEdit = {
AspectEdit.deletePersonFromAspect(person);
}
}
},
alertUser: function(message) {
alert(message);
}
};

View file

@ -46,7 +46,7 @@ $(document).ready(function() {
});
$('.added').live('ajax:failure', function(data, html, xhr) {
alert("#{t('.cannot_remove')}");
Diaspora.widgets.alert.alert("#{t('.cannot_remove')}");
$(this).fadeTo(200,1);
});

View file

@ -4,20 +4,30 @@
*/
var Diaspora = Diaspora || {};
Diaspora.widgets = Diaspora.widgets || {
pageWidgets: {},
add: function(widgetId, widget) {
this.pageWidgets[widgetId] = widget;
},
remove: function(widgetId) {
delete this.pageWidgets[widgetId];
},
Diaspora.widgetCollection = function() {
this.ready = false;
this.collection = {};
};
init: function() {
for (var widgetId in this.pageWidgets) {
this.pageWidgets[widgetId].start();
Diaspora.widgetCollection.prototype.add = function(widgetId, widget) {
this[widgetId] = this.collection[widgetId] = new widget();
if(this.ready) {
this.collection[widgetId].start();
}
};
Diaspora.widgetCollection.prototype.remove = function(widgetId) {
delete this.collection[widgetId];
};
Diaspora.widgetCollection.prototype.init = function() {
this.ready = true;
for(var widgetId in this.collection) {
this.collection[widgetId].start();
}
}
};
Diaspora.widgets = Diaspora.widgets || new Diaspora.widgetCollection();
$(Diaspora.widgets.init);

View file

@ -19,7 +19,7 @@ $(document).ready(function() {
});
$('.edit_photo').bind('ajax:failure', function(data, json, xhr) {
alert('Failed to delete photo. Are you sure you own this?');
Diaspora.widgets.alert.alert("Failed to delete photo.", "Are you sure you own this?");
$("#show_photo").find("img").fadeTo(200,1);
$("#photo_spinner").hide();
});
@ -47,7 +47,7 @@ $(document).ready(function() {
$('.make_profile_photo').bind('ajax:failure', function(data, json, xhr) {
var person_id = $(this).closest(".photo_options").attr('data-actor_person');
alert("Failed to update profile photo!");
Diaspora.widgets.alert.alert("Failed to update profile photo!");
$("img[data-person_id='" + person_id + "']").fadeTo(200, 1);
});

View file

@ -142,7 +142,7 @@ var Stream = {
});
$(".new_status_message").bind('ajax:failure', function(data, html, xhr) {
alert('failed to post message!');
Diaspora.widgets.alert.alert('Failed to post message!');
});
$(".new_comment").live('ajax:success', function(data, json, xhr) {
@ -150,7 +150,7 @@ var Stream = {
WebSocketReceiver.processComment(json.post_id, json.comment_id, json.html, false);
});
$(".new_comment").live('ajax:failure', function(data, html, xhr) {
alert('failed to post message!');
Diaspora.widgets.alert.alert('Failed to post message!');
});
$(".stream").find(".delete").live('ajax:success', function(data, html, xhr) {

332
public/javascripts/vendor/Mustache.js vendored Normal file
View file

@ -0,0 +1,332 @@
/*
mustache.js Logic-less templates in JavaScript
See http://mustache.github.com/ for more info.
*/
(function() {
var Mustache = function() {
var Renderer = function() {
};
Renderer.prototype = {
otag: "{{",
ctag: "}}",
pragmas: {},
buffer: [],
pragmas_implemented: {
"IMPLICIT-ITERATOR": true
},
context: {},
render: function(template, context, partials, in_recursion) {
// reset buffer & set context
if (!in_recursion) {
this.context = context;
this.buffer = []; // TODO: make this non-lazy
}
// fail fast
if (!this.includes("", template)) {
if (in_recursion) {
return template;
} else {
this.send(template);
return;
}
}
template = this.render_pragmas(template);
var html = this.render_section(template, context, partials);
if (in_recursion) {
return this.render_tags(html, context, partials, in_recursion);
}
this.render_tags(html, context, partials, in_recursion);
},
/*
Sends parsed lines
*/
send: function(line) {
if (line != "") {
this.buffer.push(line);
}
},
/*
Looks for %PRAGMAS
*/
render_pragmas: function(template) {
// no pragmas
if (!this.includes("%", template)) {
return template;
}
var that = this;
var regex = new RegExp(this.otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" +
this.ctag);
return template.replace(regex, function(match, pragma, options) {
if (!that.pragmas_implemented[pragma]) {
throw({message:
"This implementation of mustache doesn't understand the '" +
pragma + "' pragma"});
}
that.pragmas[pragma] = {};
if (options) {
var opts = options.split("=");
that.pragmas[pragma][opts[0]] = opts[1];
}
return "";
// ignore unknown pragmas silently
});
},
/*
Tries to find a partial in the curent scope and render it
*/
render_partial: function(name, context, partials) {
name = this.trim(name);
if (!partials || partials[name] === undefined) {
throw({message: "unknown_partial '" + name + "'"});
}
if (typeof(context[name]) != "object") {
return this.render(partials[name], context, partials, true);
}
return this.render(partials[name], context[name], partials, true);
},
/*
Renders inverted (^) and normal (#) sections
*/
render_section: function(template, context, partials) {
if (!this.includes("#", template) && !this.includes("^", template)) {
return template;
}
var that = this;
// CSW - Added "+?" so it finds the tighest bound, not the widest
var regex = new RegExp(this.otag + "(\\^|\\#)\\s*(.+)\\s*" + this.ctag +
"\n*([\\s\\S]+?)" + this.otag + "\\/\\s*\\2\\s*" + this.ctag +
"\\s*", "mg");
// for each {{#foo}}{{/foo}} section do...
return template.replace(regex, function(match, type, name, content) {
var value = that.find(name, context);
if (type == "^") { // inverted section
if (!value || that.is_array(value) && value.length === 0) {
// false or empty list, render it
return that.render(content, context, partials, true);
} else {
return "";
}
} else if (type == "#") { // normal section
if (that.is_array(value)) { // Enumerable, Let's loop!
return that.map(value,
function(row) {
return that.render(content, that.create_context(row),
partials, true);
}).join("");
} else if (that.is_object(value)) { // Object, Use it as subcontext!
return that.render(content, that.create_context(value),
partials, true);
} else if (typeof value === "function") {
// higher order section
return value.call(context, content, function(text) {
return that.render(text, context, partials, true);
});
} else if (value) { // boolean section
return that.render(content, context, partials, true);
} else {
return "";
}
}
});
},
/*
Replace {{foo}} and friends with values from our view
*/
render_tags: function(template, context, partials, in_recursion) {
// tit for tat
var that = this;
var new_regex = function() {
return new RegExp(that.otag + "(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?" +
that.ctag + "+", "g");
};
var regex = new_regex();
var tag_replace_callback = function(match, operator, name) {
switch (operator) {
case "!": // ignore comments
return "";
case "=": // set new delimiters, rebuild the replace regexp
that.set_delimiters(name);
regex = new_regex();
return "";
case ">": // render partial
return that.render_partial(name, context, partials);
case "{": // the triple mustache is unescaped
return that.find(name, context);
default: // escape the value
return that.escape(that.find(name, context));
}
};
var lines = template.split("\n");
for (var i = 0; i < lines.length; i++) {
lines[i] = lines[i].replace(regex, tag_replace_callback, this);
if (!in_recursion) {
this.send(lines[i]);
}
}
if (in_recursion) {
return lines.join("\n");
}
},
set_delimiters: function(delimiters) {
var dels = delimiters.split(" ");
this.otag = this.escape_regex(dels[0]);
this.ctag = this.escape_regex(dels[1]);
},
escape_regex: function(text) {
// thank you Simon Willison
if (!arguments.callee.sRE) {
var specials = [
'/', '.', '*', '+', '?', '|',
'(', ')', '[', ']', '{', '}', '\\'
];
arguments.callee.sRE = new RegExp(
'(\\' + specials.join('|\\') + ')', 'g'
);
}
return text.replace(arguments.callee.sRE, '\\$1');
},
/*
find `name` in current `context`. That is find me a value
from the view object
*/
find: function(name, context) {
name = this.trim(name);
// Checks whether a value is thruthy or false or 0
function is_kinda_truthy(bool) {
return bool === false || bool === 0 || bool;
}
var value;
if (is_kinda_truthy(context[name])) {
value = context[name];
} else if (is_kinda_truthy(this.context[name])) {
value = this.context[name];
}
if (typeof value === "function") {
return value.apply(context);
}
if (value !== undefined) {
return value;
}
// silently ignore unkown variables
return "";
},
// Utility methods
/* includes tag */
includes: function(needle, haystack) {
return haystack.indexOf(this.otag + needle) != -1;
},
/*
Does away with nasty characters
*/
escape: function(s) {
s = String(s === null ? "" : s);
return s.replace(/&(?!\w+;)|["'<>\\]/g, function(s) {
switch (s) {
case "&": return "&amp;";
case "\\": return "\\\\";
case '"': return '&quot;';
case "'": return '&#39;';
case "<": return "&lt;";
case ">": return "&gt;";
default: return s;
}
});
},
// by @langalex, support for arrays of strings
create_context: function(_context) {
if (this.is_object(_context)) {
return _context;
} else {
var iterator = ".";
if (this.pragmas["IMPLICIT-ITERATOR"]) {
iterator = this.pragmas["IMPLICIT-ITERATOR"].iterator;
}
var ctx = {};
ctx[iterator] = _context;
return ctx;
}
},
is_object: function(a) {
return a && typeof a == "object";
},
is_array: function(a) {
return Object.prototype.toString.call(a) === '[object Array]';
},
/*
Gets rid of leading and trailing whitespace
*/
trim: function(s) {
return s.replace(/^\s*|\s*$/g, "");
},
/*
Why, why, why? Because IE. Cry, cry cry.
*/
map: function(array, fn) {
if (typeof array.map == "function") {
return array.map(fn);
} else {
var r = [];
var l = array.length;
for (var i = 0; i < l; i++) {
r.push(fn(array[i]));
}
return r;
}
}
};
return({
name: "mustache.js",
version: "0.3.1-dev",
/*
Turns a template and view into HTML
*/
to_html: function(template, view, partials, send_fun) {
var renderer = new Renderer();
if (send_fun) {
renderer.send = send_fun;
}
renderer.render(template, view, partials);
if (!send_fun) {
return renderer.buffer.join("\n");
}
}
});
}();
$.mustache = function(template, view, partials, send_fun) {
return Mustache.to_html(template, view, partials, send_fun);
};
})();

View file

@ -0,0 +1,18 @@
// Czech
jQuery.timeago.settings.strings = {
prefixAgo: "před",
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: null,
seconds: "méně než minutou",
minute: "minutou",
minutes: "%d minutami",
hour: "hodinou",
hours: "%d hodinami",
day: "1 dnem",
days: "%d dny",
month: "1 měsícem",
months: "%d měsíci",
year: "1 rokem",
years: "%d roky"
};

View file

@ -0,0 +1,18 @@
// Danish
jQuery.timeago.settings.strings = {
prefixAgo: "for",
prefixFromNow: "om",
suffixAgo: "siden",
suffixFromNow: "",
seconds: "mindre end et minut",
minute: "ca. et minut",
minutes: "%d minutter",
hour: "ca. en time",
hours: "ca. %d timer",
day: "en dag",
days: "%d dage",
month: "ca. en måned",
months: "%d måneder",
year: "ca. et år",
years: "%d år"
};

View file

@ -0,0 +1,19 @@
// German
jQuery.timeago.settings.strings = {
prefixAgo: "vor",
prefixFromNow: "in",
suffixAgo: "",
suffixFromNow: "",
seconds: "wenigen Sekunden",
minute: "etwa einer Minute",
minutes: "%d Minuten",
hour: "etwa einer Stunde",
hours: "%d Stunden",
day: "etwa einem Tag",
days: "%d Tagen",
month: "etwa einem Monat",
months: "%d Monaten",
year: "etwa einem Jahr",
years: "%d Jahren"
};

View file

@ -0,0 +1,18 @@
// Greek
jQuery.timeago.settings.strings = {
prefixAgo: "πριν",
prefixFromNow: "σε",
suffixAgo: "",
suffixFromNow: "",
seconds: "λιγότερο από ένα λεπτό",
minute: "περίπου ένα λεπτό",
minutes: "%d λεπτά",
hour: "περίπου μία ώρα",
hours: "περίπου %d ώρες",
day: "μία μέρα",
days: "%d μέρες",
month: "περίπου ένα μήνα",
months: "%d μήνες",
year: "περίπου ένα χρόνο",
years: "%d χρόνια"
};

View file

@ -0,0 +1,18 @@
// Spanish
jQuery.timeago.settings.strings = {
prefixAgo: "hace",
prefixFromNow: "dentro de",
suffixAgo: "",
suffixFromNow: "",
seconds: "menos de un minuto",
minute: "un minuto",
minutes: "unos %d minutos",
hour: "una hora",
hours: "%d horas",
day: "un día",
days: "%d días",
month: "un mes",
months: "%d meses",
year: "un año",
years: "%d años"
};

View file

@ -0,0 +1,17 @@
// French
jQuery.timeago.settings.strings = {
// environ ~= about, it's optional
prefixAgo: "il y a",
prefixFromNow: "d'ici",
seconds: "moins d'une minute",
minute: "environ une minute",
minutes: "environ %d minutes",
hour: "environ une heure",
hours: "environ %d heures",
day: "environ un jour",
days: "environ %d jours",
month: "environ un mois",
months: "environ %d mois",
year: "un an",
years: "%d ans"
};

View file

@ -0,0 +1,18 @@
// Hebrew
jQuery.timeago.settings.strings = {
prefixAgo: "לפני",
prefixFromNow: "מעכשיו",
suffixAgo: "",
suffixFromNow: "",
seconds: "פחות מדקה",
minute: "דקה",
minutes: "%d דקות",
hour: "שעה",
hours: "%d שעות",
day: "יום",
days: "%d ימים",
month: "חודש",
months: "%d חודשים",
year: "שנה",
years: "%d שנים"
};

View file

@ -0,0 +1,18 @@
// Hungarian
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: null,
suffixFromNow: null,
seconds: "kevesebb mint egy perce",
minute: "körülbelül egy perce",
minutes: "%d perce",
hour: "körülbelül egy órája",
hours: "körülbelül %d órája",
day: "körülbelül egy napja",
days: "%d napja",
month: "körülbelül egy hónapja",
months: "%d hónapja",
year: "körülbelül egy éve",
years: "%d éve"
};

View file

@ -0,0 +1,18 @@
// Indonesian
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "yang lalu",
suffixFromNow: "dari sekarang",
seconds: "kurang dari semenit",
minute: "sekitar satu menit",
minutes: "%d menit",
hour: "sekitar sejam",
hours: "sekitar %d jam",
day: "sehari",
days: "%d hari",
month: "sekitar sebulan",
months: "%d tahun",
year: "sekitar setahun",
years: "%d tahun"
};

View file

@ -0,0 +1,16 @@
// Italian
jQuery.timeago.settings.strings = {
suffixAgo: "fa",
suffixFromNow: "da ora",
seconds: "meno di un minuto",
minute: "circa un minuto",
minutes: "%d minuti",
hour: "circa un'ora",
hours: "circa %d ore",
day: "un giorno",
days: "%d giorni",
month: "circa un mese",
months: "%d mesi",
year: "circa un anno",
years: "%d anni"
};

View file

@ -0,0 +1,18 @@
// Japanese
jQuery.timeago.settings.strings = {
prefixAgo: "",
prefixFromNow: "今から",
suffixAgo: "前",
suffixFromNow: "後",
seconds: "ほんの数秒",
minute: "約一分",
minutes: "%d 分",
hour: "大体一時間",
hours: "大体 %d 時間位",
day: "一日",
days: "%d 日ほど",
month: "大体一ヶ月",
months: "%d ヶ月ほど",
year: "丁度一年(虎舞流w)",
years: "%d 年"
};

View file

@ -0,0 +1,16 @@
// Korean
jQuery.timeago.settings.strings = {
suffixAgo: "전",
suffixFromNow: "후",
seconds: "1분 이내",
minute: "1분",
minutes: "%d분",
hour: "1시간",
hours: "%d시간",
day: "하루",
days: "%d일",
month: "한달",
months: "%d달",
year: "1년",
years: "%d년"
};

View file

@ -0,0 +1,16 @@
// Dutch
jQuery.timeago.settings.strings = {
suffixAgo: "geleden",
suffixFromNow: "vanaf nu",
seconds: "iets minder dan een minute",
minute: "ongeveer een minuut",
minutes: "%d minuten",
hour: "ongeveer een uur",
hours: "ongeveer %d uren",
day: "een dag",
days: "%d dagen",
month: "ongeveer een maand",
months: "%d maanden",
year: "ongeveer een jaar",
years: "%d jaar"
};

View file

@ -0,0 +1,31 @@
// Polish
(function() {
function numpf(n, s, t) {
// s - 2-4, 22-24, 32-34 ...
// t - 5-21, 25-31, ...
var n10 = n % 10;
if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;
} else {
return t;
}
}
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: "za",
suffixAgo: "temu",
suffixFromNow: null,
seconds: "mniej niż minutę",
minute: "minutę",
minutes: function(value) { return numpf(value, "%d minuty", "%d minut"); },
hour: "godzinę",
hours: function(value) { return numpf(value, "%d godziny", "%d godzin"); },
day: "dzień",
days: "%d dni",
month: "miesiąc",
months: function(value) { return numpf(value, "%d miesiące", "%d miesięcy"); },
year: "rok",
years: function(value) { return numpf(value, "%d lata", "%d lat"); }
};
})();

View file

@ -0,0 +1,16 @@
// Portuguese
jQuery.timeago.settings.strings = {
suffixAgo: "atrás",
suffixFromNow: "a partir de agora",
seconds: "menos de um minuto",
minute: "cerca de um minuto",
minutes: "%d minutos",
hour: "cerca de uma hora",
hours: "cerca de %d horas",
day: "um dia",
days: "%d dias",
month: "cerca de um mês",
months: "%d meses",
year: "cerca de um ano",
years: "%d anos"
};

View file

@ -0,0 +1,18 @@
// Romanian
$.timeago.settings.strings = {
prefixAgo: "acum",
prefixFromNow: "in timp de",
suffixAgo: "",
suffixFromNow: "",
seconds: "mai putin de un minut",
minute: "un minut",
minutes: "%d minute",
hour: "o ora",
hours: "%d ore",
day: "o zi",
days: "%d zile",
month: "o luna",
months: "%d luni",
year: "un an",
years: "%d ani"
};

View file

@ -0,0 +1,34 @@
// Russian
(function() {
function numpf(n, f, s, t) {
// f - 1, 21, 31, ...
// s - 2-4, 22-24, 32-34 ...
// t - 5-20, 25-30, ...
var n10 = n % 10;
if ( (n10 == 1) && ( (n == 1) || (n > 20) ) ) {
return f;
} else if ( (n10 > 1) && (n10 < 5) && ( (n > 20) || (n < 10) ) ) {
return s;
} else {
return t;
}
}
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: "через",
suffixAgo: "назад",
suffixFromNow: null,
seconds: "меньше минуты",
minute: "минуту",
minutes: function(value) { return numpf(value, "%d минута", "%d минуты", "%d минут"); },
hour: "час",
hours: function(value) { return numpf(value, "%d час", "%d часа", "%d часов"); },
day: "день",
days: function(value) { return numpf(value, "%d день", "%d дня", "%d дней"); },
month: "месяц",
months: function(value) { return numpf(value, "%d месяц", "%d месяца", "%d месяцев"); },
year: "год",
years: function(value) { return numpf(value, "%d год", "%d года", "%d лет"); }
};
})();

View file

@ -0,0 +1,18 @@
// Swedish
jQuery.timeago.settings.strings = {
prefixAgo: "för",
prefixFromNow: "om",
suffixAgo: "sedan",
suffixFromNow: "",
seconds: "mindre än en minut",
minute: "ungefär en minut",
minutes: "%d minuter",
hour: "ungefär en timme",
hours: "ungefär %d timmar",
day: "en dag",
days: "%d dagar",
month: "ungefär en månad",
months: "%d månader",
year: "ungefär ett år",
years: "%d år"
};

View file

@ -0,0 +1,19 @@
// Simplified Chinese
jQuery.timeago.settings.strings = {
prefixAgo: null,
prefixFromNow: "从现在开始",
suffixAgo: "之前",
suffixFromNow: null,
seconds: "不到 1 分钟",
minute: "大约 1 分钟",
minutes: "%d 分钟",
hour: "大约 1 小时",
hours: "大约 %d 小时",
day: "1 天",
days: "%d 天",
month: "大约 1 个月",
months: "%d 月",
year: "大约 1 年",
years: "%d 年",
numbers: []
}

View file

@ -0,0 +1,34 @@
Diaspora.widgets.add("alert", function() {
this.start = function() {
$(document).bind("close.facebox", function() {
if ($("#diaspora_alert").length) {
$("#diaspora_alert").detach();
}
});
};
this.faceboxTemplate = '<div id="diaspora_alert">' +
'<div class="span-12 last">' +
'<div id="facebox_header">' +
'<h4>' +
'{{title}}' +
'</h4>' +
'</div>' +
'{{content}}' +
'</div>' +
'</div>';
this.alert = function(title, content) {
var template = $.mustache(this.faceboxTemplate, {
title: title,
content: content
});
$(template).appendTo(document.body);
$.facebox({
div: "#diaspora_alert"
});
}
});

View file

@ -292,9 +292,18 @@ header
.from
:padding 0
h3
h3,
h4
:display inline-block
&.show
a
:margin
:right 1em
h4
:margin 0
:padding 0
.stream_element
:position relative
:word-wrap break-word
@ -374,14 +383,19 @@ header
:color #22AAE0
&:active
:color #005D9C
.time
.time,
.timeago
a
:color #bbb
:font
:weight bold
:margin
:right 5px
:font-size small
:font
:size smaller
:text
:decoration none
:border none
.right .reshare_pane .reshare_button a.inactive
:color #ccc

View file

@ -215,9 +215,9 @@ describe("AspectEdit", function() {
spyOn($, 'ajax');
});
it("doesn't let you remove the person from the last aspect they're in", function() {
spyOn(AspectEdit, 'alertUser');
spyOn(Diaspora.widgets.alert, 'alert');
AspectEdit.deletePersonFromAspect($('li.person'));
expect(AspectEdit.alertUser).toHaveBeenCalled();
expect(Diaspora.widgets.alert.alert).toHaveBeenCalled();
expect($.ajax).not.toHaveBeenCalled();
});
});

View file

@ -4,30 +4,51 @@
*/
describe("Diaspora", function() {
describe("widgets", function() {
beforeEach(function() {
Diaspora.widgets.pageWidgets = {};
});
describe("add", function() {
it("adds a widget to the list of pageWidgets", function() {
expect(Diaspora.widgets.pageWidgets["nameOfWidget"]).not.toBeDefined();
Diaspora.widgets.add("nameOfWidget", {});
expect(Diaspora.widgets.pageWidgets["nameOfWidget"]).toBeDefined();
describe("widgetCollection", function() {
describe("prototype", function() {
beforeEach(function() {
window.widgets = new Diaspora.widgetCollection();
});
});
describe("remove", function() {
it("removes a widget from the list of pageWidgets", function() {
Diaspora.widgets.add("nameOfWidget", {});
expect(Diaspora.widgets.pageWidgets["nameOfWidget"]).toBeDefined();
Diaspora.widgets.remove("nameOfWidget");
expect(Diaspora.widgets.pageWidgets["nameOfWidget"]).not.toBeDefined();
describe("add", function() {
it("adds a widget to the collection", function() {
expect(window.widgets.collection["nameOfWidget"]).not.toBeDefined();
window.widgets.add("nameOfWidget", function() { });
expect(window.widgets.collection["nameOfWidget"]).toBeDefined();
});
it("sets a shortcut by referencing the object on Diaspora.widgetCollection", function() {
expect(window.widgets.sup).toBeFalsy();
window.widgets.add("sup", function() { });
expect(window.widgets.sup).toEqual(window.widgets.collection.sup);
});
});
describe("remove", function() {
it("removes a widget from the collection", function() {
window.widgets.add("nameOfWidget", function() { });
expect(window.widgets.collection["nameOfWidget"]).toBeDefined();
window.widgets.remove("nameOfWidget");
expect(window.widgets.collection["nameOfWidget"]).not.toBeDefined();
});
});
describe("init", function() {
it("calls the start method on all of the widgets present", function() {
window.widgets.add("nameOfWidget", function() {
this.start = function() { }
});
spyOn(window.widgets.collection["nameOfWidget"], "start");
window.widgets.init();
expect(window.widgets.collection["nameOfWidget"].start).toHaveBeenCalled();
});
it("changes the ready property to true", function() {
expect(window.widgets.ready).toBeFalsy();
window.widgets.init();
expect(window.widgets.ready).toBeTruthy();
});
});
});
describe("init", function() {
Diaspora.widgets.add("nameOfWidget", {start:$.noop});
spyOn(Diaspora.widgets.pageWidgets["nameOfWidget"], "start");
Diaspora.widgets.init();
expect(Diaspora.widgets.pageWidgets["nameOfWidget"].start).toHaveBeenCalled();
});
});
});

View file

@ -19,6 +19,7 @@ src_files:
- public/javascripts/vendor/timeago.js
- public/javascripts/vendor/facebox.js
- public/javascripts/diaspora.js
- public/javascripts/widgets/alert.js
- public/javascripts/mobile.js
- public/javascripts/aspect-edit.js
- public/javascripts/aspect-contacts.js