Просмотр исходного кода

Show apology message instead of raw binary files

James Allen 8 лет назад
Родитель
Сommit
692182c784

+ 8 - 1
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"
 		)

+ 5 - 2
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

+ 5 - 0
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 {