This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31372 from borjasalguero/update_selfcontained_reb…
…ased Bug 1183727 - [Contacts][NGA] Create #update view and connect it to #…
- Loading branch information
Showing
26 changed files
with
583 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
(function(exports) { | ||
|
||
'use strict'; | ||
|
||
/* | ||
* This class is in charge of creating a URL with params | ||
* based on the diferent views we have within the App. | ||
*/ | ||
|
||
const paths = { | ||
detail: '/contacts/views/details/details.html', | ||
form: '/contacts/views/form/form.html', | ||
// TODO Add paths to the rest of views | ||
settings: '', | ||
list: '' | ||
}; | ||
|
||
exports.ParamUtils = { | ||
get: function() { | ||
var params = {}; | ||
var split = window.location.search.split('?'); | ||
if (!split || !split[1]) { | ||
return params; | ||
} | ||
var raw = split[1]; | ||
var pairs = raw.split('&'); | ||
for (var i = 0; i < pairs.length; i++) { | ||
var data = pairs[i].split('='); | ||
params[data[0]] = data[1]; | ||
} | ||
return params; | ||
}, | ||
generateUrl: function(view, params) { | ||
if (!view || !view.length || view === '') { | ||
return; | ||
} | ||
var path = paths[view]; | ||
if (!path) { | ||
return; | ||
} | ||
|
||
if (!params) { | ||
return path; | ||
} | ||
|
||
var keys = Object.keys(params); | ||
if (!keys || keys.length === 0) { | ||
return path; | ||
} | ||
|
||
var urlParams = '?'; | ||
for (var i = 0, l = keys.length; i < l; i++) { | ||
if (i !== 0) { | ||
urlParams += '&'; | ||
} | ||
var key = keys[i]; | ||
urlParams += key + '=' + params[key]; | ||
} | ||
return path + urlParams; | ||
} | ||
}; | ||
|
||
}(window)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.