aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAnanya Sen2012-04-19 17:02:56 -0700
committerAnanya Sen2012-04-19 17:02:56 -0700
commit3bdd4919ee39759ae6f532d7f3494ca3d97b7255 (patch)
tree835c75c61c2e372f65ac301246c247f8ee5f851a /js
parent8cd6c76aabb4c75ab63f8d46b7e89bddbcbfe2a7 (diff)
downloadninja-3bdd4919ee39759ae6f532d7f3494ca3d97b7255.tar.gz
- disable autocompletion option for unsupported file type
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.css9
-rw-r--r--js/controllers/code-editor-controller.js30
2 files changed, 34 insertions, 5 deletions
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 @@
9 9
10.viewOptions .autoCodeComplete{ 10.viewOptions .autoCodeComplete{
11 float:left; 11 float:left;
12 height: 20px;
13}
14
15.viewOptions .autoCodeComplete span{
16 vertical-align: middle;
17}
18
19.viewOptions .autoCodeComplete .disabled{
20 color:#515151;
12} 21}
13 22
14.viewOptions .floatButtons{ 23.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
166 166
167 handleCodeCompletionSupport:{ 167 handleCodeCompletionSupport:{
168 value:function(fileType){ 168 value:function(fileType){
169 var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0]; 169 var autoCodeCompleteElem = document.getElementsByClassName("autoCodeComplete")[0], elems=null, i=0;
170 if(autoCodeCompleteElem && (this.codeCompletionSupport[fileType] === true)){ 170 if(autoCodeCompleteElem){
171 autoCodeCompleteElem.style.visibility = "visible"; 171 elems = autoCodeCompleteElem.getElementsByTagName("*");
172 }else if(autoCodeCompleteElem && !this.codeCompletionSupport[fileType]){ 172 }
173 autoCodeCompleteElem.style.visibility = "hidden"; 173
174 if(elems && (this.codeCompletionSupport[fileType] === true)){
175 //enable elements
176 for(i=0;i<elems.length;i++){
177 if(elems[i].hasAttribute("disabled")){
178 elems[i].removeAttribute("disabled");
179 }
180 if(elems[i].classList.contains("disabled")){
181 elems[i].classList.remove("disabled");
182 }
183 }
184 }else if(elems && !this.codeCompletionSupport[fileType]){
185 //disable elements
186 for(i=0;i<elems.length;i++){
187 if(!elems[i].hasAttribute("disabled")){
188 elems[i].setAttribute("disabled", "disabled");
189 }
190 if(!elems[i].classList.contains("disabled")){
191 elems[i].classList.add("disabled");
192 }
193 }
174 } 194 }
175 } 195 }
176 }, 196 },