mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 10:42:45 +08:00
BUGFIX: revision numbers were unbound in revision history UI
This commit is contained in:
parent
119d766cb5
commit
2b5e4c3919
|
@ -10,6 +10,7 @@
|
|||
Discourse.HistoryController = Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||
loading: false,
|
||||
viewMode: "side_by_side",
|
||||
revisionsTextKey: "post.revisions.controls.comparing_previous_to_current_out_of_total",
|
||||
|
||||
refresh: function(postId, postVersion) {
|
||||
this.set("loading", true);
|
||||
|
@ -38,6 +39,8 @@ Discourse.HistoryController = Discourse.ObjectController.extend(Discourse.ModalF
|
|||
var viewMode = this.get("viewMode");
|
||||
var changes = this.get("category_changes");
|
||||
|
||||
if (changes === null) { return; }
|
||||
|
||||
var prevCategory = Discourse.Category.findById(changes.previous_category_id);
|
||||
var curCategory = Discourse.Category.findById(changes.current_category_id);
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ Discourse.Post.reopenClass({
|
|||
|
||||
loadRevision: function(postId, version) {
|
||||
return Discourse.ajax("/posts/" + postId + "/revisions/" + version + ".json").then(function (result) {
|
||||
return Discourse.Post.create(result);
|
||||
return Em.Object.create(result);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div id="revision-controls">
|
||||
{{#if displayGoToFirst}}<button class="btn standard" title="{{i18n post.revisions.controls.first}}" {{bind-attr disabled=loading}} {{action loadFirstVersion}}><i class="fa fa-fast-backward"></i></button>{{/if}}
|
||||
{{#if displayGoToPrevious}}<button class="btn standard" title="{{i18n post.revisions.controls.previous}}" {{bind-attr disabled=loading}} {{action loadPreviousVersion}}><i class="fa fa-backward"></i></button>{{/if}}
|
||||
{{#if displayRevisions}}{{{i18n post.revisions.controls.comparing_previous_to_current_out_of_total previous=previousVersion current=version total=revisions_count}}}{{/if}}
|
||||
{{#if displayRevisions}}{{{boundI18n revisionsTextKey previousBinding="previousVersion" currentBinding="version" totalBinding="revisions_count"}}}{{/if}}
|
||||
{{#if displayGoToNext}}<button class="btn standard" title="{{i18n post.revisions.controls.next}}" {{bind-attr disabled=loading}} {{action loadNextVersion}}><i class="fa fa-forward"></i></button>{{/if}}
|
||||
{{#if displayGoToLast}}<button class="btn standard" title="{{i18n post.revisions.controls.last}}" {{bind-attr disabled=loading}} {{action loadLastVersion}}><i class="fa fa-fast-forward"></i></button>{{/if}}
|
||||
</div>
|
||||
|
@ -17,7 +17,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="revision-details">
|
||||
{{i18n post.revisions.details.edited_by}} {{avatar this imageSize="small"}} {{username}} <span class="date">{{unboundDate path="created_at" leaveAgo="true"}}</span> {{#if edit_reason}} — <span class="edit-reason">{{edit_reason}}</span>{{/if}}
|
||||
{{i18n post.revisions.details.edited_by}} {{avatar this imageSize="small"}} {{username}} <span class="date">{{date created_at}}</span> {{#if edit_reason}} — <span class="edit-reason">{{edit_reason}}</span>{{/if}}
|
||||
</div>
|
||||
<div id="revisions">
|
||||
{{#if title_changes}}
|
||||
|
|
|
@ -40,7 +40,7 @@ class PostRevisionSerializer < ApplicationSerializer
|
|||
end
|
||||
|
||||
def edit_reason
|
||||
object.lookup("edit_reason",1)
|
||||
object.lookup("edit_reason", 1)
|
||||
end
|
||||
|
||||
def user
|
||||
|
|
Loading…
Reference in New Issue
Block a user