aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui/FilePicker/pickerNavigator.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/ui/FilePicker/pickerNavigator.reel')
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css31
-rwxr-xr-x[-rw-r--r--]js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html7
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js81
3 files changed, 80 insertions, 39 deletions
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
index 2d9f1189..93578ec1 100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
@@ -63,6 +63,7 @@
63 63
64.picker .driversList:hover{ 64.picker .driversList:hover{
65 cursor:pointer; 65 cursor:pointer;
66 background-color: #444444;
66} 67}
67 68
68.picker .highlighted{ 69.picker .highlighted{
@@ -195,6 +196,36 @@
195 196
196.picker .okButton{ 197.picker .okButton{
197 margin-right:25px; 198 margin-right:25px;
199 -webkit-box-align: center;
200 text-align: center;
201 cursor: default;
202 padding: 0px 6px 0px;
203 border:2px solid #d1d1d1;
204 background-color: #e1e1e1;
205 box-sizing: border-box;
206 border-radius:10px;
207 background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%);
208 cursor:pointer;
209}
210
211.picker .cancelButton{
212 -webkit-box-align: center;
213 text-align: center;
214 cursor: default;
215 padding: 0px 6px 0px;
216 border:2px solid #d1d1d1;
217 background-color: #e1e1e1;
218 box-sizing: border-box;
219 border-radius:10px;
220 background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%);
221 cursor:pointer;
222}
223
224.picker input[type="button"]:disabled{
225 background-color: #a1a1a1;
226 border:2px solid #a1a1a1;
227 background-image:none;
228 cursor:auto;
198} 229}
199 230
200 231
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
index bf421247..bd427f97 100644..100755
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
@@ -10,7 +10,6 @@
10 <link rel="stylesheet" type="text/css" href="pickerNavigator.css"> 10 <link rel="stylesheet" type="text/css" href="pickerNavigator.css">
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13
14 "owner":{ 13 "owner":{
15 "module": "js/components/ui/FilePicker/pickerNavigator.reel", 14 "module": "js/components/ui/FilePicker/pickerNavigator.reel",
16 "name":"PickerNavigator", 15 "name":"PickerNavigator",
@@ -68,10 +67,10 @@
68 <div id="right-bottom" class="right-bottom"></div> 67 <div id="right-bottom" class="right-bottom"></div>
69 </div> 68 </div>
70 <div class="buttons"> 69 <div class="buttons">
71 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton" /> 70 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton nj-skinned" />
72 <input id="okButton" disabled="true" type="button" value="OK" class="okButton" /> 71 <input id="okButton" disabled="true" type="button" value="OK" class="okButton nj-skinned" />
73 </div> 72 </div>
74 <div id="filters" class="filters"> 73 <div id="filters" class="filters" style="display:block;">
75 <div class="dropdown hide"></div> 74 <div class="dropdown hide"></div>
76 <span class="dropdownArrow">&#9660</span> 75 <span class="dropdownArrow">&#9660</span>
77 <span id="filterVal" class="filterVal">*.*</span> 76 <span id="filterVal" class="filterVal">*.*</span>
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
index 299d44f5..d7a19c14 100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
@@ -209,26 +209,27 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
209 this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly 209 this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly
210 this.backArrow.addEventListener("click", this, false); 210 this.backArrow.addEventListener("click", this, false);
211 this.forwardArrow.addEventListener("click", this, false); 211 this.forwardArrow.addEventListener("click", this, false);
212 this.okButton.addEventListener("click", this, false);
213 this.cancelButton.addEventListener("click", this, false);
214
215 //populate filters
216 var filtersDD = this.element.querySelector(".filters .dropdown");
217 if(!!this.pickerModel.fileFilters
218 && (typeof this.pickerModel.fileFilters === "object")
219 && ('splice' in this.pickerModel.fileFilters)
220 && ('join' in this.pickerModel.fileFilters)){
221 this.pickerModel.fileFilters.forEach(function(aFilter){
222 var newDiv = document.createElement("div");
223 newDiv.innerHTML = aFilter;
224 filtersDD.appendChild(newDiv);
225 newDiv.addEventListener("click", function(evt){that.handleFilterClick(evt, aFilter, filtersDD)}, false);
226 }, this);
227 }
228 212
229 var renderedWidth = this.getComputedWidth(filtersDD); 213 //populate filters if in file selection mode
230 this.filters.style.width = "" + (parseInt((renderedWidth.substring(0, (renderedWidth.length - 2)))) + 20) + "px"; 214 if(this.pickerModel.inFileMode === true){
215 var filtersDD = this.element.querySelector(".filters .dropdown");
216 if(!!this.pickerModel.fileFilters
217 && (typeof this.pickerModel.fileFilters === "object")
218 && ('splice' in this.pickerModel.fileFilters)
219 && ('join' in this.pickerModel.fileFilters)){
220 this.pickerModel.fileFilters.forEach(function(aFilter){
221 var newDiv = document.createElement("div");
222 newDiv.innerHTML = aFilter;
223 filtersDD.appendChild(newDiv);
224 newDiv.addEventListener("click", function(evt){that.handleFilterClick(evt, aFilter, filtersDD)}, false);
225 }, this);
226 }
231 227
228 var renderedWidth = this.getComputedWidth(filtersDD);
229 this.filters.style.width = "" + (parseInt((renderedWidth.substring(0, (renderedWidth.length - 2)))) + 20) + "px";
230 }else{
231 this.filters.style.display = "none";
232 }
232 /** 233 /**
233 * attach click event listeners to the addressbar dropdown arrows 234 * attach click event listeners to the addressbar dropdown arrows
234 */ 235 */
@@ -244,6 +245,9 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
244 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false); 245 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false);
245 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false); 246 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false);
246 247
248 this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false);
249 this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false);
250
247 //ready to show picker now 251 //ready to show picker now
248 this.element.style.visibility = "visible"; 252 this.element.style.visibility = "visible";
249 } 253 }
@@ -263,11 +267,11 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
263 } 267 }
264 }, 268 },
265 269
266 //TODO: add uri pattern validation 270 cleanupUri:{
267 validateUri:{
268 writable: false, 271 writable: false,
269 enumerable:true, 272 enumerable:true,
270 value: function(folderUri){ 273 value: function(folderUri){
274 folderUri = folderUri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces
271 //remove unnecessary / from end - for Win and Mac .... don't trim for the root 275 //remove unnecessary / from end - for Win and Mac .... don't trim for the root
272 if(((folderUri.charAt(folderUri.length - 1) === "/") || (folderUri.charAt(folderUri.length - 1) === "\\")) && (folderUri !== "/")){ 276 if(((folderUri.charAt(folderUri.length - 1) === "/") || (folderUri.charAt(folderUri.length - 1) === "\\")) && (folderUri !== "/")){
273 folderUri = folderUri.substring(0, (folderUri.length - 1)); 277 folderUri = folderUri.substring(0, (folderUri.length - 1));
@@ -324,7 +328,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
324 writable:false, 328 writable:false,
325 enumerable:true, 329 enumerable:true,
326 value:function(uri){ 330 value:function(uri){
327 uri = this.validateUri(uri); 331 uri = this.cleanupUri(uri);
328 var arr = []; 332 var arr = [];
329 var temp = new String(uri); 333 var temp = new String(uri);
330 while(temp.indexOf("/") != -1){ 334 while(temp.indexOf("/") != -1){
@@ -532,8 +536,6 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
532 this.refreshButton.identifier = "refreshButton"; 536 this.refreshButton.identifier = "refreshButton";
533 this.backArrow.identifier = "backArrow"; 537 this.backArrow.identifier = "backArrow";
534 this.forwardArrow.identifier = "forwardArrow"; 538 this.forwardArrow.identifier = "forwardArrow";
535 this.okButton.identifier = "okButton";
536 this.cancelButton.identifier = "cancelButton";
537 this.iconView.identifier = "iconView"; 539 this.iconView.identifier = "iconView";
538 this.treeView.identifier = "treeView"; 540 this.treeView.identifier = "treeView";
539 this.resultsArea.identifier = "resultsArea"; 541 this.resultsArea.identifier = "resultsArea";
@@ -622,6 +624,16 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
622 this.currentSelectedNode = evt.target; 624 this.currentSelectedNode = evt.target;
623