Sha256: aac0d7e6201a7d07e44a45b5551e84007ae68452ae951be592de338470b8f161
Contents?: true
Size: 1.62 KB
Versions: 16
Compression:
Stored size: 1.62 KB
Contents
;(function() { "use strict"; // Provide interaction with a participant's profile. function ProfileCtrl(alertService, profileId, Profiles, Nudges) { var self = this; this._profiles = Profiles; this._nudges = Nudges; this.alertService = alertService; this.getAlerts = function() { return alertService.getAlerts(); }; this.profile = {}; this.removeAlert = function(alert) { alertService.removeAlert(alert); }; this._profiles.getOne(profileId).then(function(profile) { self.id = profile.id; self.profile = profile; self.iconSrc = ''; }).catch(function(error) { alertService.addError(error); }); } // Send a nudge from one participant to another. ProfileCtrl.prototype.nudge = function(recipientId) { var self = this; this._nudges.create(recipientId) .then(function(response) { self.nudgeAlert = response.message; }) .catch(function(response) { self.alertService.addError(response.data.error); }); }; ProfileCtrl.prototype.updateProfileIcon = function(iconName) { var self = this; this.iconSrc = iconName; this._profiles.update(this) .then(function(profile) { self.profile.iconSrc = profile.iconSrc; }) .catch(function(response) { self.alertService.addError(response.data.error); }); $('#icon-selection-button').click(); }; // Create a module and register the controllers. angular.module('socialNetworking.controllers') .controller('ProfileCtrl', ['alertService', 'profileId', 'Profiles', 'Nudges', ProfileCtrl]); })();
Version data entries
16 entries across 16 versions & 1 rubygems