From 3bdd4919ee39759ae6f532d7f3494ca3d97b7255 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 19 Apr 2012 17:02:56 -0700 Subject: - disable autocompletion option for unsupported file type Signed-off-by: Ananya Sen --- .../code-editor-view-options.css | 9 +++++++ js/controllers/code-editor-controller.js | 30 ++++++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css index 79468768..442a5183 100644 --- a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css +++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css @@ -9,6 +9,15 @@ .viewOptions .autoCodeComplete{ float:left; + height: 20px; +} + +.viewOptions .autoCodeComplete span{ + vertical-align: middle; +} + +.viewOptions .autoCodeComplete .disabled{ + color:#515151; } .viewOptions .floatButtons{ diff --git a/js/controllers/code-editor-controller.js b/js/controllers/code-editor-controller.js index 8757dceb..5dee4ab2 100644 --- a/js/controllers/code-editor-controller.js +++ b/js/controllers/code-editor-controller.js @@ -166,11 +166,31 @@ var CodeEditorController = exports.CodeEditorController = Montage.create(Compone handleCodeCompletionSupport:{ value:function(fileType){ - var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0]; - if(autoCodeCompleteElem && (this.codeCompletionSupport[fileType] === true)){ - autoCodeCompleteElem.style.visibility = "visible"; - }else if(autoCodeCompleteElem && !this.codeCompletionSupport[fileType]){ - autoCodeCompleteElem.style.visibility = "hidden"; + var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0], elems=null, i=0; + if(autoCodeCompleteElem){ + elems = autoCodeCompleteElem.getElementsByTagName("*"); + } + + if(elems && (this.codeCompletionSupport[fileType] === true)){ + //enable elements + for(i=0;i