Merge pull request #447 from kubabrecka/history_date_i18n

move date formatting from server side to javascript, so we can reuse Sugar's i18n
This commit is contained in:
Robin Ward 2013-03-13 06:57:42 -07:00
commit 572a87d5d8
3 changed files with 7 additions and 5 deletions

View File

@ -41,6 +41,11 @@ Discourse.HistoryView = Discourse.View.extend({
this.set('postLeft', null);
this.set('postRight', null);
return this.get('originalPost').loadVersions(function(result) {
result.each(function(item) {
item.description = "v" + item.number + " - " + Date.create(item.created_at).relative() + " - " +
Em.String.i18n("changed_by", { author: item.display_username });
});
_this.set('loading', false);
_this.set('versionLeft', result.first());
_this.set('versionRight', result.last());

View File

@ -1,6 +1,6 @@
class VersionSerializer < ApplicationSerializer
attributes :number, :display_username, :created_at, :description
attributes :number, :display_username, :created_at
def number
object[:number]
@ -14,8 +14,4 @@ class VersionSerializer < ApplicationSerializer
object[:created_at]
end
def description
"v#{object[:number]} - #{FreedomPatches::Rails4.time_ago_in_words(object[:created_at])} ago by #{object[:display_username]}"
end
end

View File

@ -629,6 +629,7 @@ en:
top_contributors: "Participants"
category_title: "Category"
history: "History"
changed_by: "by {{author}}"
categories_list: "Categories List"