Merge pull request #307 from taigaio/bug/1972/tasks-should-retain-all-history-in-their-full-view

Tasks should retain all history in their full view
stable
Jesús Espino 2015-02-03 13:06:12 +01:00
commit 10a717107f
2 changed files with 41 additions and 7 deletions

View File

@ -51,6 +51,13 @@ class HistoryController extends taiga.Controller
delete historyResult.values_diff.description_html delete historyResult.values_diff.description_html
delete historyResult.values_diff.description_diff delete historyResult.values_diff.description_diff
# If block note was modified take only the blocked_note_html field
if historyResult.values_diff.blocked_note_diff?
historyResult.values_diff.blocked_note = historyResult.values_diff.blocked_note_diff
delete historyResult.values_diff.blocked_note_html
delete historyResult.values_diff.blocked_note_diff
@scope.history = history @scope.history = history
@scope.comments = _.filter(history, (item) -> item.comment != "") @scope.comments = _.filter(history, (item) -> item.comment != "")
@ -66,6 +73,7 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm) ->
templateChangePoints = $template.get("common/history/history-change-points.html", true) templateChangePoints = $template.get("common/history/history-change-points.html", true)
templateChangeGeneric = $template.get("common/history/history-change-generic.html", true) templateChangeGeneric = $template.get("common/history/history-change-generic.html", true)
templateChangeAttachment = $template.get("common/history/history-change-attachment.html", true) templateChangeAttachment = $template.get("common/history/history-change-attachment.html", true)
templateChangeList = $template.get("common/history/history-change-list.html", true)
templateDeletedComment = $template.get("common/history/history-deleted-comment.html", true) templateDeletedComment = $template.get("common/history/history-deleted-comment.html", true)
templateActivity = $template.get("common/history/history-activity.html", true) templateActivity = $template.get("common/history/history-activity.html", true)
templateBaseEntries = $template.get("common/history/history-base-entries.html", true) templateBaseEntries = $template.get("common/history/history-base-entries.html", true)
@ -103,6 +111,9 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm) ->
# Attachment # Attachment
is_deprecated: "is deprecated" is_deprecated: "is deprecated"
blocked_note: "blocked note"
is_blocked: "is blocked"
} # TODO i18n } # TODO i18n
return humanizedFieldNames[field] or field return humanizedFieldNames[field] or field
@ -121,18 +132,18 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm) ->
formatChange = (change) -> formatChange = (change) ->
if _.isArray(change) if _.isArray(change)
if change.length == 0 if change.length == 0
return "nil" return "empty"
return change.join(", ") return change.join(", ")
if change == "" if change == ""
return "nil" return "empty"
if not change? or change == false
return "no"
if change == true if change == true
return "yes" return "yes"
if change == false
return "no"
return change return change
# Render into string (operations without mutability) # Render into string (operations without mutability)
@ -164,12 +175,18 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm) ->
renderChangeEntry = (field, value) -> renderChangeEntry = (field, value) ->
if field == "description" if field == "description"
# TODO: i18n return templateChangeDiff({name: getHumanizedFieldName("description"), diff: value[1]})
return templateChangeDiff({name: "description", diff: value[1]}) else if field == "blocked_note"
return templateChangeDiff({name: getHumanizedFieldName("blocked_note"), diff: value[1]})
else if field == "points" else if field == "points"
return templateChangePoints({points: value}) return templateChangePoints({points: value})
else if field == "attachments" else if field == "attachments"
return renderAttachmentEntry(value) return renderAttachmentEntry(value)
else if field in ["tags", "watchers"]
name = getHumanizedFieldName(field)
removed = _.difference(value[0], value[1])
added = _.difference(value[1], value[0])
return templateChangeList({name:name, removed:removed, added: added})
else if field == "assigned_to" else if field == "assigned_to"
name = getHumanizedFieldName(field) name = getHumanizedFieldName(field)
from = formatChange(value[0] or "Unassigned") from = formatChange(value[0] or "Unassigned")

View File

@ -0,0 +1,17 @@
.change-entry
.activity-changed
span <%- name %>
.activity-fromto
<% if (removed.length > 0) { %>
p
strong removed
br
span <%- removed %>
<% } %>
<% if (added.length > 0) { %>
p
strong added
br
span <%- added %>
<% } %>