From 729e32ee70b0dd30a3b498ed7d1636b1b5b56a43 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 16 Feb 2012 11:18:21 -0800 Subject: Squashed commit of the following: commit 302ae3c1812086d976eb67c9cf693c43205f3904 Author: Ananya Sen Date: Thu Feb 16 11:13:05 2012 -0800 hide the rulers when no document is open Signed-off-by: Ananya Sen commit 2e766c9eaa98fa20f311b3eb2f892a1a240e90cf Author: Ananya Sen Date: Thu Feb 16 06:43:33 2012 -0800 file picker: Enable ok if user double clicks folder and enter it. Validate path if user enter it manually in addressbar. Signed-off-by: Ananya Sen commit 4937b39fb0cf542f57cdadc7d1e2ed9798f7ef87 Author: Ananya Sen Date: Wed Feb 15 16:09:14 2012 -0800 fixes to document tabbing Signed-off-by: Ananya Sen commit 56d2a8d11a73cd04c7f1bc20d1ded52b9c1242f2 Author: Ananya Sen Date: Wed Feb 15 10:54:38 2012 -0800 Revert "Revert "Creating NinjaTemplate to HTML function"" This reverts commit 2e308be9bec5e06d81b2905b65005a232f0a190d. Signed-off-by: Ananya Sen commit e2b97c951a9a5a0c4ff831d44fdd82177cbd82ad Author: Ananya Sen Date: Wed Feb 15 10:54:14 2012 -0800 Revert "Revert "Reverting text/html document classes and setting up MVC folder structure"" This reverts commit 9048cd50bf5e0a418d1d95498bb593961f72db36. Signed-off-by: Ananya Sen commit aead95ce4b2571356701229567bfde73d54bed93 Author: Ananya Sen Date: Wed Feb 15 10:53:55 2012 -0800 Revert "Revert "Cleaning up"" This reverts commit a90e3be8850b64e8e370aa8ff8cadaa448dd0c82. Signed-off-by: Ananya Sen commit a8d1a2e1f4f4ab7b9298bfbd1b49731785c79c3a Author: Ananya Sen Date: Wed Feb 15 10:52:56 2012 -0800 Revert "Revert "Merging TextDocument into BaseDocument"" This reverts commit b8782f2e3dd106accbb0160a98e6b498f26752ea. Signed-off-by: Ananya Sen commit e864dc319805e259b7ae39a9d4d96fac552a1f87 Author: Ananya Sen Date: Wed Feb 15 10:52:38 2012 -0800 Revert "merging from github.com/joseeight/ninja-internal/tree/FileIO is breaking opening html files… to trying to fix local build" This reverts commit 3cf1d19c5cdc9534d9c87cbc7d1fcf48e68daa42. Signed-off-by: Ananya Sen commit 3cf1d19c5cdc9534d9c87cbc7d1fcf48e68daa42 Author: Ananya Sen Date: Wed Feb 15 10:06:42 2012 -0800 merging from github.com/joseeight/ninja-internal/tree/FileIO is breaking opening html files… to trying to fix local build Signed-off-by: Ananya Sen commit b8782f2e3dd106accbb0160a98e6b498f26752ea Author: Ananya Sen Date: Wed Feb 15 10:01:59 2012 -0800 Revert "Merging TextDocument into BaseDocument" This reverts commit 93c8f327d662a7693d1d6ca050a0efd15ebc18ed. Conflicts: js/controllers/document-controller.js Signed-off-by: Ananya Sen commit a90e3be8850b64e8e370aa8ff8cadaa448dd0c82 Author: Ananya Sen Date: Wed Feb 15 09:58:37 2012 -0800 Revert "Cleaning up" This reverts commit a7952c5a16e2cae3fd1a459b03b9f16bba1004da. Conflicts: js/controllers/document-controller.js js/io/document/text-document.js Signed-off-by: Ananya Sen commit 9048cd50bf5e0a418d1d95498bb593961f72db36 Author: Ananya Sen Date: Wed Feb 15 09:51:12 2012 -0800 Revert "Reverting text/html document classes and setting up MVC folder structure" This reverts commit 68ce64a5a2f4a71b54d33916aaf1d57161302425. Signed-off-by: Ananya Sen commit 2e308be9bec5e06d81b2905b65005a232f0a190d Author: Ananya Sen Date: Wed Feb 15 09:50:20 2012 -0800 Revert "Creating NinjaTemplate to HTML function" This reverts commit e327eccb93e2bc513fcbb7ab302783d6bce83884. Signed-off-by: Ananya Sen --- css/ninja.css | 4 +-- .../pickerNavigator.reel/pickerNavigator.js | 32 +++++++++++++++++++++- js/controllers/document-controller.js | 32 +++++++++++++--------- js/ninja.reel/ninja.css | 2 -- js/stage/stage-view.reel/stage-view.js | 5 ++-- scss/imports/scss/_MainWindow.scss | 2 ++ 6 files changed, 56 insertions(+), 21 deletions(-) diff --git a/css/ninja.css b/css/ninja.css index 0be30434..824a675a 100755 --- a/css/ninja.css +++ b/css/ninja.css @@ -118,9 +118,9 @@ body { position: absolute; margin: 0px; width: 100%; height: 100%; background-co #sceneBar { height: 70px; background-color: #474747; } -#mainContainer #rulerTop { background: url("../images/temp/ruler-top.png"); height: 15px; margin-bottom: 0px; } +#mainContainer #rulerTop { background: url("../images/temp/ruler-top.png"); height: 15px; margin-bottom: 0px; display:none;} -#rulerLeft { background: url("../images/temp/ruler-left.png"); width: 16px; } +#rulerLeft { background: url("../images/temp/ruler-left.png"); width: 16px; display:none;} #stateBar { height: 20px; background-color: #282828; margin-bottom: 0px; } diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js index 6b0d92f7..411386f9 100644 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js @@ -203,6 +203,13 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { this.pickerModel.storeHistory(this.pickerModel.currentRoot);//populate history this.updateMetadata(this.currentURI); + + //for directory selection, selected url is the folder entered + if(!this.pickerModel.inFileMode ){ + this.okButton.removeAttribute("disabled"); + //put into selectedItems..currently single selection is supported + this.selectedItems = [this.pickerModel.currentRoot]; + } } this.element.addEventListener("openFolder", function(evt){that.handlePickerNavOpenFolder(evt);}, false);//add icon double click event listener to reload iconList with new set of data @@ -211,6 +218,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { this.element.addEventListener("updateMetadata", function(evt){that.handlePickerNavUpdateMetadata(evt);}, false);//show metadata on click of icon //this.addressGo.addEventListener("click", this, false); this.addressBarUri.addEventListener("keydown", this, false); + this.addressBarUri.addEventListener("keyup", this, false); this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly this.backArrow.addEventListener("click", this, false); this.forwardArrow.addEventListener("click", this, false); @@ -608,6 +616,13 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { this.backArrow.classList.remove("disable"); } + //for directory selection, selected url is the folder entered + if(!this.pickerModel.inFileMode ){ + this.okButton.removeAttribute("disabled"); + //put into selectedItems..currently single selection is supported + this.selectedItems = [evt.folderUri]; + } + } }, @@ -720,6 +735,21 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { } }, + handleAddressBarUriKeyup:{ + value: function(evt){ + //disable ok if user enters an invalid uri + if(!this.application.ninja.coreIoApi.isValidUri(this.addressBarUri.value)){ + //disable OK + if(!this.okButton.hasAttribute("disabled")){ + this.okButton.setAttribute("disabled", "true"); + } + }else{ + this.okButton.removeAttribute("disabled"); + this.selectedItems = [this.addressBarUri.value]; + } + } + }, + handleRefreshButtonClick:{ value:function(evt){ var uri = this.addressBarUri.value; @@ -794,7 +824,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { handleOkButtonAction : { value: function(evt){ - console.log("$$$ File Picker : selected "+ this.selectedItems.toString()); + //console.log("$$$ File Picker : selected "+ this.selectedItems.toString()); var success = true; if(!!this.pickerModel.callback && (this.selectedItems.length > 0)){//call the callback if it is available try{ diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index f397ace7..b1a22c1b 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -34,17 +34,17 @@ DocumentController = exports.DocumentController = Montage.create(Component, { return this._activeDocument; }, set: function(doc) { - if(this._activeDocument) this._activeDocument.isActive = false; - - if(this._documents.indexOf(doc) === -1) this._documents.push(doc); + if(!!this._activeDocument) this._activeDocument.isActive = false; this._activeDocument = doc; - this._activeDocument.isActive = true; + if(!!this._activeDocument){ - if(!!this._activeDocument.editor){ - this._activeDocument.editor.focus(); + if(this._documents.indexOf(doc) === -1) this._documents.push(doc); + this._activeDocument.isActive = true; + if(!!this._activeDocument.editor){ + this._activeDocument.editor.focus(); + } } - } }, @@ -184,7 +184,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { switch (doc.extension) { case 'html': case 'html': //Open in designer view - Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument); + Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); break; default: //Open in code view @@ -250,7 +250,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, { } var doc = this._findDocumentByUUID(id); - this._removeDocumentView(doc.container); var closeDocumentIndex = this._findIndexByUUID(id); this._documents.splice(this._findIndexByUUID(id), 1); @@ -263,8 +262,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, { nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); + this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ - //if there are no documents to switch to then just show the iframeContainer + this.activeDocument = null; + this._removeDocumentView(doc.container); + this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; } } @@ -275,11 +277,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, { _onOpenDocument: { value: function(doc){ //var data = DocumentManager.activeDocument; - //DocumentManager._hideCurrentDocument(); - //stageManagerModule.stageManager.toggleCanvas(); + this._hideCurrentDocument(); + this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); + + this.application.ninja.stage.hideCanvas(false); + + this.activeDocument = doc; - DocumentController.activeDocument = doc; + this._showCurrentDocument(); NJevent("onOpenDocument", doc); // appDelegateModule.MyAppDelegate.onSetActiveDocument(); diff --git a/js/ninja.reel/ninja.css b/js/ninja.reel/ninja.css index 99fa9a4f..83c0e569 100755 --- a/js/ninja.reel/ninja.css +++ b/js/ninja.reel/ninja.css @@ -7,5 +7,3 @@ .main { padding: 100px; } - - diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 31ace49c..cd19f361 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -123,7 +123,7 @@ exports.StageView = Montage.create(Component, { switchDocument:{ value: function(doc){ //save editor cursor position - if(!!this.application.ninja.documentController.activeDocument.editor){ + if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ this.application.ninja.documentController.activeDocument.hline = this.application.ninja.documentController.activeDocument.editor.getCursor(true); } this.application.ninja.documentController._hideCurrentDocument(); @@ -136,7 +136,7 @@ exports.StageView = Montage.create(Component, { var documentController = this.application.ninja.documentController; //restore editor cursor position - if(!!this.application.ninja.documentController.activeDocument.editor){ + if(!!this.application.ninja.documentController.activeDocument && !!this.application.ninja.documentController.activeDocument.editor){ this.application.ninja.documentController.activeDocument.editor.setCursor(this.application.ninja.documentController.activeDocument.hline); document.getElementById("codeMirror_"+this.application.ninja.documentController.activeDocument.uuid).getElementsByClassName("CodeMirror")[0].focus(); } @@ -187,7 +187,6 @@ exports.StageView = Montage.create(Component, { }, hideOtherDocuments:{ value:function(docUuid){ - //use CodeMirror toTextArea() to remove editor and save content into textarea this.application.ninja.documentController._documents.forEach(function(aDoc){ if(aDoc.currentView === "design"){ aDoc.container.parentNode.style["display"] = "none"; diff --git a/scss/imports/scss/_MainWindow.scss b/scss/imports/scss/_MainWindow.scss index b5ff42bc..0b0649dc 100755 --- a/scss/imports/scss/_MainWindow.scss +++ b/scss/imports/scss/_MainWindow.scss @@ -204,12 +204,14 @@ background: url("../images/temp/ruler-top.png"); height:15px; margin-bottom: 0px; + display:none; } #rulerLeft { // TODO: temporary background please replace when component is implemented background: url("../images/temp/ruler-left.png"); width:16px; + display:none; } #stateBar { -- cgit v1.2.3