Finished Article History

This commit is contained in:
Ruben Vereecken 2014-03-11 19:33:27 +01:00
parent af73e5a594
commit 8709cdc472
6 changed files with 11 additions and 4 deletions
app
locale
templates/editor
article
level
views

View file

@ -264,7 +264,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
body: "Body"
version: "Version"
commit_msg: "Commit Message"
version_history: "Version History"
history: "History"
version_history_for: "Version History for: "
results: "Results"
description: "Description"

View file

@ -264,7 +264,7 @@ module.exports = nativeDescription: "Nederlands", englishDescription: "Dutch", t
body: "Inhoud"
version: "Versie"
commit_msg: "Commit Bericht"
version_history: "Versie geschiedenis"
history: "Geschiedenis"
version_history_for: "Versie geschiedenis voor: "
results: "Resultaten"
description: "Beschrijving"

View file

@ -10,6 +10,7 @@ block content
li.active
| #{article.attributes.name}
button(data-i18n="general.history").btn.btn-primary#history-button History
button(data-toggle="coco-modal", data-target="modal/revert", data-i18n="revert.revert", disabled=authorized === true ? undefined : "true").btn.btn-primary#revert-button Revert
button(data-i18n="article.edit_btn_preview", disabled=authorized === true ? undefined : "true").btn.btn-primary#preview-button Preview
button(data-toggle="coco-modal", data-target="modal/save_version", data-i18n="common.save", disabled=authorized === true ? undefined : "true").btn.btn-primary#save-button Save

View file

@ -42,7 +42,7 @@ block outer_content
b.caret
ul.dropdown-menu
li#version-history-button
a(href='#') Version History
a(href='#', data-i18n="general.version_history") Version History
li
a(href='https://github.com/codecombat/codecombat/wiki/Artisan-Home') Wiki
li

View file

@ -1,4 +1,5 @@
View = require 'views/kinds/RootView'
VersionHistoryView = require './versions_view'
template = require 'templates/editor/article/edit'
Article = require 'models/Article'
@ -9,6 +10,7 @@ module.exports = class ArticleEditView extends View
events:
'click #preview-button': 'openPreview'
'click #history-button': 'showVersionHistory'
subscriptions:
'save-new-version': 'saveNewArticle'
@ -84,3 +86,8 @@ module.exports = class ArticleEditView extends View
modal.modal('hide')
url = "/editor/article/#{newArticle.get('slug') or newArticle.id}"
document.location.href = url
showVersionHistory: (e) ->
versionHistoryView = new VersionHistoryView level:@article, @articleID
@openModalView versionHistoryView
Backbone.Mediator.publish 'level:view-switched', e

View file

@ -38,5 +38,4 @@ module.exports = class VersionsModalView extends ModalView
context = super(context)
context.page = @page
context.dataList = (m.attributes for m in @collection.models) if @collection
console.debug context
context