Last active
January 20, 2016 07:19
-
-
Save rotty3000/5952204 to your computer and use it in GitHub Desktop.
add bookmarks in Liferay via AUI
This file contains hidden or 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
| AUI().use('aui-io', function(A) { | |
| var data = []; | |
| if(confirm('add custom data?')) { | |
| var start = prompt('start index'); | |
| var end = prompt('end index'); | |
| for (var i = start; i < end; i++) { | |
| data.push('Bookmark' + i); | |
| } | |
| } | |
| var AddBookmark = function(name, callback) { | |
| Liferay.Service( | |
| '/bookmarksentry/add-entry', | |
| { | |
| groupId: themeDisplay.getScopeGroupId(), | |
| folderId: 0, | |
| 'name': name, | |
| url: 'http://' + name + '.com', | |
| description: '' | |
| }, | |
| callback | |
| ); | |
| }; | |
| A.each( | |
| data, | |
| function(item, index, collection) { | |
| var then_alert_me = function(response) { | |
| console.log('add ' + item + ' successful...Response: ', response); | |
| }; | |
| setTimeout( | |
| function() { | |
| AddBookmark(item, then_alert_me); | |
| }, | |
| 500 | |
| ); | |
| } | |
| ); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment