Skip to content

Commit 85c297c

Browse files
committed
Merge branch 'edge'
2 parents e4a6e6c + a14c4ef commit 85c297c

File tree

19 files changed

+381
-206
lines changed

19 files changed

+381
-206
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
if (!Array.prototype.map) {
2+
/* polyfill */
3+
Array.prototype.map = function(callback, thisArg) {
4+
5+
var T, A, k;
6+
7+
if (this == null) {
8+
throw new TypeError(" this is null or not defined");
9+
}
10+
11+
// 1. Let O be the result of calling ToObject passing the |this| value as the argument.
12+
var O = Object(this);
13+
14+
// 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
15+
// 3. Let len be ToUint32(lenValue).
16+
var len = O.length >>> 0;
17+
18+
// 4. If IsCallable(callback) is false, throw a TypeError exception.
19+
// See: http://es5.github.com/#x9.11
20+
if (typeof callback !== "function") {
21+
throw new TypeError(callback + " is not a function");
22+
}
23+
24+
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
25+
if (thisArg) {
26+
T = thisArg;
27+
}
28+
29+
// 6. Let A be a new array created as if by the expression new Array(len) where Array is
30+
// the standard built-in constructor with that name and len is the value of len.
31+
A = new Array(len);
32+
33+
// 7. Let k be 0
34+
k = 0;
35+
36+
// 8. Repeat, while k < len
37+
while(k < len) {
38+
39+
var kValue, mappedValue;
40+
41+
// a. Let Pk be ToString(k).
42+
// This is implicit for LHS operands of the in operator
43+
// b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
44+
// This step can be combined with c
45+
// c. If kPresent is true, then
46+
if (k in O) {
47+
48+
// i. Let kValue be the result of calling the Get internal method of O with argument Pk.
49+
kValue = O[ k ];
50+
51+
// ii. Let mappedValue be the result of calling the Call internal method of callback
52+
// with T as the this value and argument list containing kValue, k, and O.
53+
mappedValue = callback.call(T, kValue, k, O);
54+
55+
// iii. Call the DefineOwnProperty internal method of A with arguments
56+
// Pk, Property Descriptor {Value: mappedValue, : true, Enumerable: true, Configurable: true},
57+
// and false.
58+
59+
// In browsers that support Object.defineProperty, use the following:
60+
// Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true });
61+
62+
// For best browser support, use the following:
63+
A[ k ] = mappedValue;
64+
}
65+
// d. Increase k by 1.
66+
k++;
67+
}
68+
69+
// 9. return A
70+
return A;
71+
};
72+
}
73+
74+
(function(window, angular, $) {
75+
"use strict";
76+
77+
function config($httpProvider, $locationProvider) {
78+
/* ensure server recognized ajax requests */
79+
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
80+
81+
/* CSRF support, but we're not doing any posts... */
82+
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
83+
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
84+
85+
/* cache responses by default */
86+
$httpProvider.defaults.cache = true;
87+
88+
$locationProvider.html5Mode(true);
89+
}
90+
91+
92+
var app = angular.module('Datastore', ['djng.urls', 'ui.bootstrap', 'ngCookies', 'ngSanitize'])
93+
.config(['$httpProvider', '$locationProvider', config]);
94+
95+
app.value('DcrPaths', {
96+
'CURATED': '/iplant/home/shared/commons_repo/curated',
97+
'COMMUNITY': '/iplant/home/shared'
98+
});
99+
100+
})(window, angular);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
(function(window, angular, $) {
2+
"use strict";
3+
4+
var app = angular.module('Datastore')
5+
6+
app.controller('HomeCtrl', ['$scope', 'DcrPaths', function($scope, DcrPaths) {
7+
var defaultTitle = 'Tip:';
8+
var defaultDescription = 'Hover over an option for more information.';
9+
10+
$scope.data={
11+
browseDescriptionTitle: defaultTitle,
12+
browseDescription: defaultDescription,
13+
publishDescriptionTitle: defaultTitle,
14+
publishDescription: defaultDescription
15+
};
16+
17+
$scope.urls={
18+
community: '/browse' + DcrPaths.COMMUNITY,
19+
curated: '/browse' + DcrPaths.CURATED
20+
};
21+
22+
$scope.mouseOver = function(data) {
23+
if (data == 'shared') {
24+
$scope.data.browseDescriptionTitle = 'Community Released:';
25+
$scope.data.browseDescription = "These data are provided by community collaborators for public access. Community Released Data are not curated by the Data Commons and don't have permanent identifiers. Their location and contents may change."
26+
27+
} else if (data == 'dcr') {
28+
$scope.data.browseDescriptionTitle = 'CyVerse Curated:';
29+
$scope.data.browseDescription = "All data that have been given a permanent identifier (DOI or ARK) by CyVerse. These data are stable and contents will not change.";
30+
} else if (data == 'ncbi-sra') {
31+
$scope.data.publishDescriptionTitle = 'NCBI-SRA:';
32+
$scope.data.publishDescription = "Instructions on how to publish data to NCBI's Sequence Read Archive via the Data Commons."
33+
} else if (data == 'ncbi-wgs') {
34+
$scope.data.publishDescriptionTitle = 'NCBI-WGS:';
35+
$scope.data.publishDescription = "Instructions on how to publish data to NBCI's Whole Genome Shotgun (WGS) Archive via the Data Commons."
36+
} else if (data == 'dcrPublish') {
37+
$scope.data.publishDescriptionTitle = 'CyVerse:';
38+
$scope.data.publishDescription = "Request a permanent identifier (DOI or ARK) through the Data Commons or request a Community Released Data Folder.";
39+
}
40+
};
41+
42+
$scope.mouseLeave = function() {
43+
$scope.data={
44+
browseDescriptionTitle: defaultTitle,
45+
browseDescription: defaultDescription,
46+
publishDescriptionTitle: defaultTitle,
47+
publishDescription: defaultDescription,
48+
};
49+
};
50+
}]);
51+
52+
})(window, angular, jQuery);

0 commit comments

Comments
 (0)