Show apology message instead of raw binary files

This commit is contained in:
James Allen 2017-12-22 16:28:36 +00:00
parent 8b9f3268b1
commit 692182c784
3 changed files with 18 additions and 3 deletions

View file

@ -165,7 +165,7 @@ div#history(ng-show="ui.view == 'history'")
.diff-panel.full-size(ng-controller="HistoryDiffController")
.diff(
ng-show="!!history.diff && !history.diff.loading && !history.diff.deleted && !history.diff.error"
ng-if="!!history.diff && !history.diff.loading && !history.diff.deleted && !history.diff.error && !history.diff.binary"
)
.toolbar.toolbar-alt
span.name
@ -197,6 +197,13 @@ div#history(ng-show="ui.view == 'history'")
resize-on="layout:main:resize",
navigate-highlights="true"
)
.diff.diff-binary(ng-show="history.diff.binary")
.toolbar.toolbar-alt
span.name
strong {{history.diff.pathname}}
.alert.alert-info We're still working on showing image and binary changes, sorry. Stay tuned!
.diff-deleted.text-centered(
ng-show="history.diff.deleted && !history.diff.restoreDeletedSuccess"
)

View file

@ -111,7 +111,8 @@ define [
.then (response) =>
{ data } = response
diff.loading = false
{text, highlights} = @_parseDiff(data)
{text, highlights, binary} = @_parseDiff(data.diff)
diff.binary = binary
diff.text = text
diff.highlights = highlights
.catch () ->
@ -119,11 +120,13 @@ define [
diff.error = true
_parseDiff: (diff) ->
if diff.binary
return { binary: true }
row = 0
column = 0
highlights = []
text = ""
for entry, i in diff.diff or []
for entry, i in diff or []
content = entry.u or entry.i or entry.d
content ||= ""
text += content

View file

@ -73,6 +73,11 @@
padding: @line-height-computed / 2;
margin-right: @line-height-computed / 4;
}
&-binary {
.alert {
margin: @line-height-computed / 2;
}
}
}
aside.change-list {