mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 04:56:40 +08:00
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:
commit
572a87d5d8
@ -41,6 +41,11 @@ Discourse.HistoryView = Discourse.View.extend({
|
|||||||
this.set('postLeft', null);
|
this.set('postLeft', null);
|
||||||
this.set('postRight', null);
|
this.set('postRight', null);
|
||||||
return this.get('originalPost').loadVersions(function(result) {
|
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('loading', false);
|
||||||
_this.set('versionLeft', result.first());
|
_this.set('versionLeft', result.first());
|
||||||
_this.set('versionRight', result.last());
|
_this.set('versionRight', result.last());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class VersionSerializer < ApplicationSerializer
|
class VersionSerializer < ApplicationSerializer
|
||||||
|
|
||||||
attributes :number, :display_username, :created_at, :description
|
attributes :number, :display_username, :created_at
|
||||||
|
|
||||||
def number
|
def number
|
||||||
object[:number]
|
object[:number]
|
||||||
@ -14,8 +14,4 @@ class VersionSerializer < ApplicationSerializer
|
|||||||
object[:created_at]
|
object[:created_at]
|
||||||
end
|
end
|
||||||
|
|
||||||
def description
|
|
||||||
"v#{object[:number]} - #{FreedomPatches::Rails4.time_ago_in_words(object[:created_at])} ago by #{object[:display_username]}"
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -629,6 +629,7 @@ en:
|
|||||||
top_contributors: "Participants"
|
top_contributors: "Participants"
|
||||||
category_title: "Category"
|
category_title: "Category"
|
||||||
history: "History"
|
history: "History"
|
||||||
|
changed_by: "by {{author}}"
|
||||||
|
|
||||||
categories_list: "Categories List"
|
categories_list: "Categories List"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user