added translations to templates; mock out the locale file in jasmine
This commit is contained in:
parent
a92401f157
commit
933299e31c
15 changed files with 138 additions and 58 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<div class="right controls">
|
||||
<!-- need access to post -->
|
||||
<% if(author.id === current_user.id) { %>
|
||||
<a href="#" class="delete comment_delete" title="Delete">
|
||||
<a href="#" class="delete comment_delete" title="<%= Diaspora.I18n.t('delete') %>">
|
||||
<img alt="Deletelabel" src="/images/deletelabel.png" />
|
||||
<a/>
|
||||
<% } %>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<ul class="show_comments <%= comments_count <= 3 ? 'hidden' : '' %>">
|
||||
<li>
|
||||
<a href="/posts/<%= id %>/comments" class="toggle_post_comments">
|
||||
Show <%= comments_count - 3 %> more comments
|
||||
<%= Diaspora.I18n.t('stream.more_comments', {count : comments_count - 3}) %>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -18,11 +18,11 @@
|
|||
</a>
|
||||
|
||||
<p>
|
||||
<label for="comment_text_on_<%= id %>">Comment</label>
|
||||
<label for="comment_text_on_<%= id %>"><%= Diaspora.I18n.t('stream.comment') %></label>
|
||||
<textarea class="comment_box" id="comment_text_on_<%= id %>" name="text" rows="2" />
|
||||
</p>
|
||||
<div class="submit_button">
|
||||
<input class="button creation" id="comment_submit_<%= id %>" name="commit" type="submit" value="Comment" />
|
||||
<input class="button creation" id="comment_submit_<%= id %>" name="commit" type="submit" value="<%= Diaspora.I18n.t('stream.comment') %>" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
<span class="post_scope">
|
||||
<%= public ? "Public" : "Limited" %>
|
||||
<%= public ? Diaspora.I18n.t("stream.public") : Diaspora.I18n.t("stream.limited") %>
|
||||
</span>
|
||||
–
|
||||
|
||||
<a href="#" class="like_action" rel='nofollow'>
|
||||
<%= user_like ? "Unlike" : "Like" %>
|
||||
<%= user_like ? Diaspora.I18n.t("stream.unlike") : Diaspora.I18n.t("stream.like") %>
|
||||
</a>
|
||||
·
|
||||
|
||||
<% if(public && author.id != current_user.id && (post_type == "Reshare" ? root : true)) { %>
|
||||
<a href="#" class="reshare_action" rel='nofollow'>
|
||||
Reshare
|
||||
<%= Diaspora.I18n.t("stream.reshare") %>
|
||||
</a>
|
||||
·
|
||||
<% } %>
|
||||
|
||||
<a href="#" class="focus_comment_textarea" rel="nofollow">
|
||||
Comment
|
||||
<%= Diaspora.I18n.t("stream.comment") %>
|
||||
</a>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<header>
|
||||
<div class="container" style="position:relative;">
|
||||
|
||||
<a href="/stream">
|
||||
|
|
@ -7,47 +6,59 @@
|
|||
|
||||
<div id="global_search">
|
||||
<form accept-charset="UTF-8" action="/people" class="search_form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
|
||||
<input id="q" name="q" placeholder="Find people or #tags" results="5" type="search" autocomplete="off" class="ac_input">
|
||||
<input id="q" name="q" placeholder="<%= Diaspora.I18n.t('header.search') %>" results="5" type="search" autocomplete="off" class="ac_input">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="nav_badges">
|
||||
<div class="badge" id="home_badge">
|
||||
<a href="/stream" title="Home"><img alt="Home" src="/images/icons/home_grey.png">
|
||||
<a href="/stream" title="<%= Diaspora.I18n.t('header.home') %>"><img alt="Home" src="/images/icons/home_grey.png">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="badge" id="notification_badge">
|
||||
<a href="/notifications" title="No new notifications">
|
||||
<img alt="No new notifications" id="notification-flag" src="/images/icons/notifications_grey.png">
|
||||
<a href="/notifications" title="<%= Diaspora.I18n.t('header.notifications') %>">
|
||||
<img alt="<%= Diaspora.I18n.t('header.notifications') %>" id="notification-flag" src="/images/icons/notifications_grey.png">
|
||||
<div class="badge_count hidden">
|
||||
0
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="badge" id="message_inbox_badge">
|
||||
<a href="/conversations" title="No new messages"><img alt="No new messages" src="/images/icons/mail_grey.png">
|
||||
<a href="/conversations" title="<%= Diaspora.I18n.t('header.messages') %>">
|
||||
<img alt="<%= Diaspora.I18n.t('header.messages') %>" src="/images/icons/mail_grey.png">
|
||||
<div class="badge_count hidden">
|
||||
0
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="notification_dropdown">
|
||||
<div class="header">
|
||||
<div class="right">
|
||||
<a href="/notifications/read_all">Mark All as Read</a>
|
||||
<a href="/notifications/read_all">
|
||||
<%= Diaspora.I18n.t("header.mark_all_as_read") %>
|
||||
</a>
|
||||
|
|
||||
<a href="/notifications" id="view_all_notifications">View all</a>
|
||||
<a href="/notifications" id="view_all_notifications">
|
||||
<%= Diaspora.I18n.t("header.view_all") %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<h4>
|
||||
Recent notifications
|
||||
<%= Diaspora.I18n.t("header.recent_notifications") %>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="notifications">
|
||||
<div class="ajax_loader">
|
||||
<img alt="Ajax-loader" src="/images/ajax-loader.gif">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="hovercard_container">
|
||||
<div id="hovercard">
|
||||
<img class="avatar">
|
||||
|
|
@ -63,6 +74,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="dropdown" id="user_menu">
|
||||
<li>
|
||||
<div class="right">
|
||||
|
|
@ -71,11 +83,12 @@
|
|||
<img alt="<%= current_user.name %>" class="avatar" data-person_id="<%= current_user.id %>" src="<%= current_user.avatar.small %>" title="<%= current_user.name %>" />
|
||||
<a href="#"><%= current_user.name %></a>
|
||||
</li>
|
||||
<li><a href="/people/<%= current_user.id %>">Profile</a></li>
|
||||
<li><a href="/contacts">Contacts</a></li>
|
||||
<li><a href="/user/edit">Settings</a></li>
|
||||
<li><a href="/users/sign_out">Log out</a></li>
|
||||
<li><a href="/people/<%= current_user.id %>"><%= Diaspora.I18n.t("header.profile") %></a></li>
|
||||
<li><a href="/contacts"><%= Diaspora.I18n.t("header.contacts") %></a></li>
|
||||
<li><a href="/user/edit"><%= Diaspora.I18n.t("header.settings") %></a></li>
|
||||
<li><a href="/users/sign_out"><%= Diaspora.I18n.t("header.log_out") %></a></li>
|
||||
</ul>
|
||||
|
||||
<div id="lightbox">
|
||||
<div id="lightbox-content">
|
||||
<a href="#" id="lightbox-close-link">[x] close</a>
|
||||
|
|
@ -84,5 +97,5 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="lightbox-backdrop"></div>
|
||||
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<% if(likes_count > 0) { %>
|
||||
<img alt="Heart" src="/images/icons/heart.png" />
|
||||
<a href="#" class="expand_likes">
|
||||
<%= likes_count %> Like
|
||||
<%= Diaspora.I18n.t('stream.likes', {count: likes_count}) %>
|
||||
</a>
|
||||
<% } %>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<% if(root.reshares_count) { %>
|
||||
-
|
||||
<%= root.reshares_count %> reshares
|
||||
<%= Diaspora.I18n.t("stream.reshares", {count : root.reshares_count}) %>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<% } else { %>
|
||||
<p>
|
||||
Original post deleted by author.
|
||||
<%= Diaspora.I18n.t('stream.original_post_deleted') %>
|
||||
</p>
|
||||
<% } %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<div class="right controls">
|
||||
<% if(author.id != current_user.id) { %>
|
||||
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "Ignore" />
|
||||
<img src="/images/icons/ignoreuser.png" alt="Ignoreuser" class="block_user control_icon" title= "<%= Diaspora.I18n.t('ignore') %>" />
|
||||
<% } else { %>
|
||||
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="Delete" />
|
||||
<img src="/images/deletelabel.png" class="delete control_icon remove_post" title="<%= Diaspora.I18n.t('delete') %>" />
|
||||
<% } %>
|
||||
|
||||
</div>
|
||||
|
|
@ -29,17 +29,17 @@
|
|||
|
||||
<% if(reshares_count) { %>
|
||||
-
|
||||
<%= reshares_count %> reshares
|
||||
<%= Diaspora.I18n.t("stream.reshares", {count : reshares_count}) %>
|
||||
<% } %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<% if(text !== null && text.match(/#nsfw/)) { %>
|
||||
<% if(text !== null && text.match(/#nsfw/i)) { %>
|
||||
<div class="shield_wrapper">
|
||||
<div class="shield">
|
||||
This post has been flagged as NSFW by its author.
|
||||
<%= Diaspora.I18n.t('stream.nsfw') %>
|
||||
<a href="#">
|
||||
show
|
||||
<%= Diaspora.I18n.t('stream.show') %>
|
||||
</a>
|
||||
</div>
|
||||
<% } %>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
en:
|
||||
javascripts:
|
||||
confirm_dialog: "Are you sure?"
|
||||
delete: "Delete"
|
||||
ignore: "Ignore"
|
||||
timeago:
|
||||
prefixAgo: ""
|
||||
prefixFromNow: ""
|
||||
|
|
@ -32,8 +34,6 @@ en:
|
|||
public: "Public - your post will be visible to everyone and found by search engines"
|
||||
infinite_scroll:
|
||||
no_more: "No more posts."
|
||||
web_sockets:
|
||||
disconnected: "The websocket is closed; posts will no longer be streamed live."
|
||||
aspect_dropdown:
|
||||
add_to_aspect: "Add contact"
|
||||
select_aspects: "Select aspects"
|
||||
|
|
@ -44,7 +44,6 @@ en:
|
|||
toggle:
|
||||
zero: "Select aspects"
|
||||
one: "In <%= count %> aspect"
|
||||
two: "In <%= count %> aspects"
|
||||
few: "In <%= count %> aspects"
|
||||
many: "In <%= count %> aspects"
|
||||
other: "In <%= count %> aspects"
|
||||
|
|
@ -69,3 +68,52 @@ en:
|
|||
looking_good: "OMG, you look awesome!"
|
||||
tags:
|
||||
wasnt_that_interesting: "OK, I suppose #<%= tagName %> wasn't all that interesting..."
|
||||
|
||||
stream:
|
||||
public: "Public"
|
||||
limited: "Limited"
|
||||
like: "Like"
|
||||
unlike: "Unlike"
|
||||
reshare: "Reshare"
|
||||
comment: "Comment"
|
||||
original_post_deleted: "Original post deleted by author."
|
||||
nsfw: "This post has been flagged NSFW by its author."
|
||||
show: "Show"
|
||||
|
||||
likes:
|
||||
zero: "<%= count %> Likes"
|
||||
one: "<%= count %> Like"
|
||||
few: "<%= count %> Likes"
|
||||
many: "<%= count %> Likes"
|
||||
other: "<%= count %> Likes"
|
||||
|
||||
reshares:
|
||||
zero: "<%= count %> Reshares"
|
||||
one: "<%= count %> Reshare"
|
||||
few: "<%= count %> Reshares"
|
||||
many: "<%= count %> Reshares"
|
||||
other: "<%= count %> Reshares"
|
||||
|
||||
more_comments:
|
||||
zero: "Show <%= count %> more comments"
|
||||
one: "Show <%= count %> more comment"
|
||||
few: "Show <%= count %> more comments"
|
||||
many: "Show <%= count %> more comments"
|
||||
other: "Show <%= count %> more comments"
|
||||
|
||||
header:
|
||||
home: "Home"
|
||||
profile: "Profile"
|
||||
contacts: "Contacts"
|
||||
settings: "Settings"
|
||||
log_out: "Log out"
|
||||
|
||||
notifications: "Notifications"
|
||||
messages: "Messages"
|
||||
|
||||
search: "Find people or #tags"
|
||||
|
||||
recent_notifications: "Recent Notifications"
|
||||
mark_all_as_read: "Mark all as read"
|
||||
view_all: "View all"
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Feature: Notifications
|
|||
And I add the person to my "Besties" aspect
|
||||
And I go to the destroy user session page
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I follow "notification" in the header
|
||||
And I follow "Notifications" in the header
|
||||
And I wait for the ajax to finish
|
||||
Then the notification dropdown should be visible
|
||||
Then I should see "started sharing with you"
|
||||
|
|
@ -32,10 +32,10 @@ Feature: Notifications
|
|||
And I wait for the ajax to finish
|
||||
And I go to the destroy user session page
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I follow "notification" in the header
|
||||
And I wait for the ajax to finish
|
||||
And I follow "Notifications" in the header
|
||||
#And I wait for the ajax to finish
|
||||
Then the notification dropdown should be visible
|
||||
And I wait for the ajax to finish
|
||||
#And I wait for the ajax to finish
|
||||
Then I should see "reshared your post"
|
||||
And I should have 1 email delivery
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ Feature: Notifications
|
|||
And I wait for the ajax to finish
|
||||
And I go to the destroy user session page
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I follow "notification" in the header
|
||||
And I follow "Notifications" in the header
|
||||
And I wait for the ajax to finish
|
||||
Then the notification dropdown should be visible
|
||||
And I wait for the ajax to finish
|
||||
|
|
@ -67,7 +67,7 @@ Feature: Notifications
|
|||
And I wait for the ajax to finish
|
||||
And I go to the destroy user session page
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I follow "notification" in the header
|
||||
And I follow "Notifications" in the header
|
||||
And I wait for the ajax to finish
|
||||
Then the notification dropdown should be visible
|
||||
And I wait for the ajax to finish
|
||||
|
|
@ -78,7 +78,7 @@ Feature: Notifications
|
|||
Given a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
And Alice has a post mentioning Bob
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I follow "notification" in the header
|
||||
And I follow "Notifications" in the header
|
||||
And I wait for the ajax to finish
|
||||
Then the notification dropdown should be visible
|
||||
And I wait for the ajax to finish
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ app.views.Header = app.views.Base.extend({
|
|||
|
||||
template_name : "#header-template",
|
||||
|
||||
tagName : "header",
|
||||
|
||||
events : {
|
||||
"click ul.dropdown li:first-child" : "toggleDropdown"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ app.views.LikesInfo = app.views.StreamObject.extend({
|
|||
|
||||
template_name : "#likes-info-template",
|
||||
|
||||
className : "likes_container",
|
||||
className : "likes_container"
|
||||
|
||||
events: { }
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ app.views.StreamObject = app.views.Base.extend({
|
|||
|
||||
destroyModel: function(evt){
|
||||
if(evt){ evt.preventDefault(); }
|
||||
if(!confirm("Are you sure?")) { return }
|
||||
if(!confirm(Diaspora.I18n.t("confirm_dialog"))) { return }
|
||||
|
||||
this.model.destroy();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,13 @@ describe("app.views.Feedback", function(){
|
|||
beforeEach(function(){
|
||||
window.current_user = app.user({id : -1, name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
|
||||
|
||||
Diaspora.I18n.loadLocale({stream : {
|
||||
'like' : "Like",
|
||||
'unlike' : "Unlike",
|
||||
'public' : "Public",
|
||||
'limited' : "Limted"
|
||||
}})
|
||||
|
||||
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
||||
|
||||
this.post = new app.models.Post(posts[0]);
|
||||
|
|
@ -25,7 +32,7 @@ describe("app.views.Feedback", function(){
|
|||
|
||||
context("when the user likes the post", function(){
|
||||
it("the like action should be 'Unlike'", function(){
|
||||
expect(this.link().text()).toContain('Unlike');
|
||||
expect(this.link().text()).toContain(Diaspora.I18n.t('stream.unlike'))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -37,17 +44,17 @@ describe("app.views.Feedback", function(){
|
|||
})
|
||||
|
||||
it("the like action should be 'Like'", function(){
|
||||
expect(this.link().text()).toContain('Like');
|
||||
expect(this.link().text()).toContain(Diaspora.I18n.t('stream.like'))
|
||||
})
|
||||
|
||||
it("allows for unliking a just-liked post", function(){
|
||||
expect(this.link().text()).toContain('Like');
|
||||
expect(this.link().text()).toContain(Diaspora.I18n.t('stream.like'))
|
||||
|
||||
this.link().click();
|
||||
expect(this.link().text()).toContain('Unlike');
|
||||
expect(this.link().text()).toContain(Diaspora.I18n.t('stream.unlike'))
|
||||
|
||||
this.link().click();
|
||||
expect(this.link().text()).toContain('Like');
|
||||
expect(this.link().text()).toContain(Diaspora.I18n.t('stream.like'))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -59,7 +66,7 @@ describe("app.views.Feedback", function(){
|
|||
})
|
||||
|
||||
it("shows 'Public'", function(){
|
||||
expect($(this.view.el).html()).toContain('Public')
|
||||
expect($(this.view.el).html()).toContain(Diaspora.I18n.t('stream.public'))
|
||||
})
|
||||
|
||||
it("shows a reshare_action link", function(){
|
||||
|
|
@ -82,7 +89,7 @@ describe("app.views.Feedback", function(){
|
|||
})
|
||||
|
||||
it("shows 'Limited'", function(){
|
||||
expect($(this.view.el).html()).toContain('Limited')
|
||||
expect($(this.view.el).html()).toContain(Diaspora.I18n.t('stream.limited'))
|
||||
})
|
||||
|
||||
it("does not show a reshare_action link", function(){
|
||||
|
|
|
|||
|
|
@ -2,6 +2,13 @@ describe("app.views.LikesInfo", function(){
|
|||
beforeEach(function(){
|
||||
window.current_user = app.user({id : -1, name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
|
||||
|
||||
Diaspora.I18n.loadLocale({stream : {
|
||||
likes : {
|
||||
zero : "<%= count %> Likes",
|
||||
one : "<%= count %> Like"}
|
||||
}
|
||||
})
|
||||
|
||||
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
||||
this.post = new app.models.Post(posts[0]); // post with a like
|
||||
this.view = new app.views.LikesInfo({model: this.post});
|
||||
|
|
@ -11,7 +18,7 @@ describe("app.views.LikesInfo", function(){
|
|||
it("displays a the like count if it is above zero", function() {
|
||||
this.view.render();
|
||||
|
||||
expect($(this.view.el).text()).toContain(this.view.model.get("likes_count"))
|
||||
expect($(this.view.el).text()).toContain(Diaspora.I18n.t('stream.likes', {count : this.view.model.get("likes_count")}))
|
||||
})
|
||||
|
||||
it("does not display the like count if it is zero", function() {
|
||||
|
|
|
|||
|
|
@ -2,10 +2,16 @@ describe("app.views.Post", function(){
|
|||
|
||||
describe("#render", function(){
|
||||
beforeEach(function(){
|
||||
// should be jasmine helper
|
||||
window.current_user = app.user({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
|
||||
|
||||
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"][0];
|
||||
Diaspora.I18n.loadLocale({stream : {
|
||||
reshares : {
|
||||
one : "<%= count %> reshare",
|
||||
few : "<%= count %> reshares"
|
||||
}
|
||||
}})
|
||||
|
||||
var posts = $.parseJSON(spec.readFixture("multi_stream_json"))["posts"];
|
||||
|
||||
this.collection = new app.collections.Stream(posts);
|
||||
this.statusMessage = this.collection.models[0];
|
||||
|
|
@ -14,17 +20,15 @@ describe("app.views.Post", function(){
|
|||
it("displays a reshare count", function(){
|
||||
this.statusMessage.set({reshares_count : 2})
|
||||
var view = new app.views.Post({model : this.statusMessage}).render();
|
||||
var statusElement = $(view.el)
|
||||
|
||||
expect(statusElement.html()).toContain("2 reshares")
|
||||
expect(view.$(".post_initial_info").html()).toContain(Diaspora.I18n.t('stream.reshares', {count: 2}))
|
||||
})
|
||||
|
||||
it("does not display a reshare count for 'zero'", function(){
|
||||
this.statusMessage.set({reshares_count : 0})
|
||||
var view = new app.views.Post({model : this.statusMessage}).render();
|
||||
var statusElement = $(view.el)
|
||||
|
||||
expect(statusElement.html()).not.toContain("0 reshares")
|
||||
expect(view.$(".post_initial_info").html()).not.toContain("0 Reshares")
|
||||
})
|
||||
|
||||
context("user not signed in", function(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue