// Generated by CoffeeScript 1.12.7
/**
* History page display
* @module
*/
'use strict';
app.directive('activity', [
'constantService', function(constants) {
return {
restrict: 'E',
templateUrl: 'site/activity.html',
link: function($scope) {
var action, activity, i, isAuthRequest, j, results;
activity = $scope.activity;
activity.reverse();
$scope.idColor = function(i) {
var hsv, sv;
hsv = 3733 * i;
sv = hsv / 360 | 0;
return "hsl(" + (hsv % 360) + "," + (70 + sv % 20) + "%," + (45 + (sv / 20 | 0) % 27) + "%)";
};
isAuthRequest = function(act) {
return act.type === 'authorize' && act.action === 'add' && act.party.id === act.user && !act.site && !act.member && !act.old;
};
action = {
add: "created",
remove: "removed",
change: "changed",
superuser: "superuser",
party: {
add: "registered"
},
account: {
add: "created account",
attempt: "failed login",
open: "logged in",
close: "logged out"
},
authorize: {
add: "added"
},
volume: {
add: "created volume",
change: "changed volume"
},
access: {
add: "added"
},
preset: [
{
add: "shared selected information with the public",
remove: "stopped sharing with the public"
}, {
add: "shared with authorized researchers",
remove: "stopped sharing with authorized researchers"
}
],
release: {
add: "set",
remove: "cleared"
},
asset: {
add: "uploaded"
}
};
$scope.activityAction = function(act) {
var a, at, i, ref;
if (isAuthRequest(act)) {
return "requested";
}
at = action[act.type];
if (act.type === 'access' && (i = constants.accessPreset.parties.indexOf(act.party.id)) >= 0) {
at = action.preset[i];
}
a = (ref = at != null ? at[act.action] : void 0) != null ? ref : action[act.action];
if (act.type === 'container') {
a += ' ' + (act.top ? 'materials' : 'session');
}
return a;
};
i = 0;
$scope.removedArray = [];
results = [];
while (i < activity.length) {
if (activity[i].action === "remove") {
$scope.removedArray.push(activity[i].id);
j = 0;
while (j < activity.length) {
if (activity[j].id === activity[i].id && activity[j].transcode) {
$scope.removedArray.push(activity[j].transcode.id);
}
j++;
}
}
results.push(i++);
}
return results;
}
};
}
]);
//# sourceMappingURL=activity.js.map