From 57b09e1d60017bbb05c5be0851c9f5ef43e0c159 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 28 Nov 2014 16:59:39 +0000 Subject: [PATCH] started making pdf viewer conditional - work in progress --- services/web/.gitignore | 4 ++-- services/web/app/coffee/models/User.coffee | 4 +++- services/web/app/views/project/editor.jade | 6 ++++-- .../web/public/coffee/ide/pdfng/directives/pdfJs.coffee | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/services/web/.gitignore b/services/web/.gitignore index f9bcc5cd9b..86ff84610b 100644 --- a/services/web/.gitignore +++ b/services/web/.gitignore @@ -46,10 +46,10 @@ TpdsWorker.js BackgroundJobsWorker.js public/js/history/versiondetail.js -!public/js/libs/* +!public/js/libs/ public/js/* !public/js/ace/* -!public/js/libs/* +!public/js/libs/ public/js/editor.js public/js/home.js public/js/forms.js diff --git a/services/web/app/coffee/models/User.coffee b/services/web/app/coffee/models/User.coffee index 55e222d16e..783389cb6a 100644 --- a/services/web/app/coffee/models/User.coffee +++ b/services/web/app/coffee/models/User.coffee @@ -35,7 +35,9 @@ UserSchema = new Schema compileTimeout: { type:Number, default: Settings.defaultFeatures.compileTimeout } compileGroup: { type:String, default: Settings.defaultFeatures.compileGroup } } - featureSwitches : {} + featureSwitches : { + pdfng: { type: Boolean } + } referal_id : {type:String, default:() -> uuid.v4().split("-")[0]} refered_users: [ type:ObjectId, ref:'User' ] refered_user_count: { type:Number, default: 0 } diff --git a/services/web/app/views/project/editor.jade b/services/web/app/views/project/editor.jade index 48be8f0dbc..87e67535a6 100644 --- a/services/web/app/views/project/editor.jade +++ b/services/web/app/views/project/editor.jade @@ -112,8 +112,10 @@ block content - locals.suppressDefaultJs = true - - var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js') - - var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath + - var pdfPath = 'libs/pdf.worker.js' + - if (user.featureSwitches && user.featureSwitches.pdfng) { pdfPath = 'libs/pdfjs-1.0.712/pdf.worker.js'; } + - var fingerprintedPath = fingerprint(jsPath+pdfPath) + - var pdfJsWorkerPath = jsPath+pdfPath+'?fingerprint='+fingerprintedPath script(type='text/javascript'). window.pdfJsWorkerPath = "#{pdfJsWorkerPath}"; diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee index 872d68fa5e..41e91fbd66 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfJs.coffee @@ -6,7 +6,7 @@ define [ "ide/pdfng/directives/pdfRenderer" "ide/pdfng/directives/pdfPage" "ide/pdfng/directives/pdfViewer" - "libs/pdf" + "libs/pdfjs-1.0.712/pdf" "text!libs/pdfListView/TextLayer.css" "text!libs/pdfListView/AnnotationsLayer.css" "text!libs/pdfListView/HighlightsLayer.css"