From 692182c78498e482ad1cc2dc328f003253758d60 Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 22 Dec 2017 16:28:36 +0000 Subject: [PATCH] Show apology message instead of raw binary files --- services/web/app/views/project/editor/history.pug | 9 ++++++++- .../public/coffee/ide/history/HistoryV2Manager.coffee | 7 +++++-- services/web/public/stylesheets/app/editor/history.less | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/project/editor/history.pug b/services/web/app/views/project/editor/history.pug index 6dd453adf7..4b2eab7162 100644 --- a/services/web/app/views/project/editor/history.pug +++ b/services/web/app/views/project/editor/history.pug @@ -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" ) diff --git a/services/web/public/coffee/ide/history/HistoryV2Manager.coffee b/services/web/public/coffee/ide/history/HistoryV2Manager.coffee index 6df78be408..923cbd7cf0 100644 --- a/services/web/public/coffee/ide/history/HistoryV2Manager.coffee +++ b/services/web/public/coffee/ide/history/HistoryV2Manager.coffee @@ -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 diff --git a/services/web/public/stylesheets/app/editor/history.less b/services/web/public/stylesheets/app/editor/history.less index 84080acffa..68616f6100 100644 --- a/services/web/public/stylesheets/app/editor/history.less +++ b/services/web/public/stylesheets/app/editor/history.less @@ -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 {