Explorar o código

Toggle the dots at the end of bib preview, based on size of payload.

Shane Kilkelly %!s(int64=10) %!d(string=hai) anos
pai
achega
9a6876d237

+ 1 - 1
services/web/app/views/project/editor/binary-file.jade

@@ -28,7 +28,7 @@ div.binary-file.full-size(
 			div.scroll-container
 				p
 					| {{ bibtexPreview.data }}
-				p
+				p(ng-show="bibtexPreview.shouldShowDots")
 					| ...
 	
 	p.no-preview(

+ 5 - 0
services/web/public/coffee/ide/binary-files/controllers/BinaryFileController.coffee

@@ -7,6 +7,7 @@ define [
 
 		$scope.bibtexPreview =
 			loading: false
+			shouldShowDots: false
 			error: false
 			data: null
 
@@ -31,11 +32,15 @@ define [
 		$scope.loadBibtexFilePreview = () ->
 			url = "/project/#{project_id}/file/#{$scope.openFile.id}?range=0-#{TWO_MEGABYTES}"
 			$scope.bibtexPreview.loading = true
+			$scope.bibtexPreview.shouldShowDots = false
 			$scope.$apply()
 			$http.get(url)
 				.success (data) ->
 					$scope.bibtexPreview.loading = false
 					$scope.bibtexPreview.error = false
+					# show dots when payload is closs to cutoff
+					if data.length >= (TWO_MEGABYTES - 200)
+						$scope.bibtexPreview.shouldShowDots = true
 					try
 						# remove last partial line
 						data = data.replace(/\n.*$/, '')