Example #1
0
$.retrieveData = function () {

  drupalServices.userRetrieve(
    CONFIG.uid,
    function (data) {

      var value;

      // Check if user si flagged by the current user.
      if (data.user.is_flagged) {
        value = 'Unfollow';
      } else {
        value = 'Follow';
      }

      $.NavigationBar.showFollow({
        text: value,
        callback: function (_event) {
          $.follow(value);
        }
      });

      // map fields with correct values.
      $.followerCount.text = data.user.follow_count;
      $.eventCount.text = data.user.event_count;
      $.author.text = data.user.name;
    },
    function (data) {
      alert('error');
    }
  );

  drupalServices.userNodesList(
    CONFIG.uid,
    // Success
    function (json) {
      $.handleData(json);
    },
    // Fail
    function (data) {
      alert('error');
    }
  );
};
Example #2
0
 $.retrieveData = function() {
     drupalServices.userRetrieve(CONFIG.uid, function(data) {
         var value;
         value = data.user.is_flagged ? "Unfollow" : "Follow";
         $.NavigationBar.showFollow({
             text: value,
             callback: function() {
                 $.follow(value);
             }
         });
         $.followerCount.text = data.user.follow_count;
         $.eventCount.text = data.user.event_count;
         $.author.text = data.user.name;
     }, function() {
         alert("error");
     });
     drupalServices.userNodesList(CONFIG.uid, function(json) {
         $.handleData(json);
     }, function() {
         alert("error");
     });
 };