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.html35
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js78
3 files changed, 106 insertions, 38 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..b5da0e6e 100644..100755
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
@@ -10,6 +10,35 @@
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 "okButton": {
14 "module": "montage/ui/button.reel",
15 "name": "Button",
16 "properties": {
17 "element": {"#": "okButton"},
18 "identifier": "okButton"
19 },
20 "listeners": [
21 {
22 "type": "action",
23 "listener": {"@": "owner"}
24 }
25 ]
26 },
27
28 "cancelButton": {
29 "module": "montage/ui/button.reel",
30 "name": "Button",
31 "properties": {
32 "element": {"#": "cancelButton"},
33 "identifier": "cancelButton"
34 },
35 "listeners": [
36 {
37 "type": "action",
38 "listener": {"@": "owner"}
39 }
40 ]
41 },
13 42
14 "owner":{ 43 "owner":{
15 "module": "js/components/ui/FilePicker/pickerNavigator.reel", 44 "module": "js/components/ui/FilePicker/pickerNavigator.reel",
@@ -68,10 +97,10 @@
68 <div id="right-bottom" class="right-bottom"></div> 97 <div id="right-bottom" class="right-bottom"></div>
69 </div> 98 </div>
70 <div class="buttons"> 99 <div class="buttons">
71 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton" /> 100 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton nj-skinned" />
72 <input id="okButton" disabled="true" type="button" value="OK" class="okButton" /> 101 <input id="okButton" disabled="true" type="button" value="OK" class="okButton nj-skinned" />
73 </div> 102 </div>
74 <div id="filters" class="filters"> 103 <div id="filters" class="filters" style="display:block;">
75 <div class="dropdown hide"></div> 104 <div class="dropdown hide"></div>
76 <span class="dropdownArrow">&#9660</span> 105 <span class="dropdownArrow">&#9660</span>
77 <span id="filterVal" class="filterVal">*.*</span> 106 <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..268ec41a 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 */
@@ -263,11 +264,11 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
263 } 264 }
264 }, 265 },
265 266
266 //TODO: add uri pattern validation 267 cleanupUri:{
267 validateUri:{
268 writable: false, 268 writable: false,
269 enumerable:true, 269 enumerable:true,
270 value: function(folderUri){ 270 value: function(folderUri){
271 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 272 //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 !== "/")){ 273 if(((folderUri.charAt(folderUri.length - 1) === "/") || (folderUri.charAt(folderUri.length - 1) === "\\")) && (folderUri !== "/")){
273 folderUri = folderUri.substring(0, (folderUri.length - 1)); 274 folderUri = folderUri.substring(0, (folderUri.length - 1));
@@ -324,7 +325,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
324 writable:false, 325 writable:false,
325 enumerable:true, 326 enumerable:true,
326 value:function(uri){ 327 value:function(uri){
327 uri = this.validateUri(uri); 328 uri = this.cleanupUri(uri);
328 var arr = []; 329 var arr = [];
329 var temp = new String(uri); 330 var temp = new String(uri);
330 while(temp.indexOf("/") != -1){ 331 while(temp.indexOf("/") != -1){
@@ -532,8 +533,6 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
532 this.refreshButton.identifier = "refreshButton"; 533 this.refreshButton.identifier = "refreshButton";
533 this.backArrow.identifier = "backArrow";