airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [01/20] airavata-php-gateway git commit: Switching to load users on an AJAX call
Date Wed, 17 Aug 2016 15:32:48 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop f2f22bdf0 -> f5ff011aa


Switching to load users on an AJAX call


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/3c071537
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/3c071537
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/3c071537

Branch: refs/heads/develop
Commit: 3c071537eb5b0a7cf049088aaf653e94897724ed
Parents: fb31a44
Author: Jeff Kinnison <jeffdkinnison@gmail.com>
Authored: Thu Aug 4 12:06:45 2016 -0400
Committer: Jeff Kinnison <jeffdkinnison@gmail.com>
Committed: Thu Aug 4 12:06:45 2016 -0400

----------------------------------------------------------------------
 public/js/sharing/share.js | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3c071537/public/js/sharing/share.js
----------------------------------------------------------------------
diff --git a/public/js/sharing/share.js b/public/js/sharing/share.js
index d8e19fc..40420c6 100755
--- a/public/js/sharing/share.js
+++ b/public/js/sharing/share.js
@@ -89,10 +89,42 @@ $(function() {
 
     // Create, populate, and show the share box
     $('body').on('click', 'button#project-share, button#experiment-share', function(e) {
-        var $share_list;
+        var $share_list, ajax_data;
         e.stopPropagation();
         e.preventDefault();
 
+        if ($('#share-box-users').find('.user-thumbnail').length === 0) {
+            ajax_data = $(e.target).data();
+
+            $.ajax({
+                url: url,
+                data: {},
+                dataType: "json",
+                error: function(xhr, status, error) {
+                    $('#shared-users').addClass('text-align-center').text("Unable to load
users from Airavata server.");
+                },
+                success: function(data, status, xhr) {
+                    var user, $user, $users;
+
+                    $users = $('#share-box-users');
+                    $users.empty().removeClass('text-align-center');
+
+                    for (user in data) {
+                        if (data.hasOwnProperty(user)) {
+                            $user = createThumbnail(user, data.firstname, data.lastname,
data.email, access_enum.NONE, true);
+                            $user.find('.sharing-thumbnail-access').hide();
+
+                            $user.addClass('user-thumbnail');
+                            $user.addClass('share-box-users-item');
+                            $users.append($user);
+                        }
+                    }
+                }
+            });
+        }
+
+        $('#share-box-users').addClass('text-align-center').text('Loading user list');
+
         $share_list = $('#shared-users').children();
 
         if ($share_list.filter('.sharing-thumbnail').length > 0) {


Mime
View raw message