Skip to content

Commit

Permalink
Show two links over marine debris block. #119
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Glaser committed Aug 20, 2014
1 parent 0d8a3ad commit 763ea74
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 4 deletions.
7 changes: 6 additions & 1 deletion _site_generated/assets/css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -7540,7 +7540,11 @@ small {
background-color: transparent;
}
.home-item-cntr {
padding: 10px 15px 15px 15px;
padding: 0px 15px 0px 15px;
height: 100%;
}
a > div.home-item-cntr:hover {
background: rgba(4, 4, 4, 0.1);
}
.home-item-cntr.welcome {
padding: 20px 30px 30px 30px;
Expand Down Expand Up @@ -7569,6 +7573,7 @@ small {
font-size: 24px;
}
.home-item-label {
padding-top: 10px;
margin-bottom: 10px;
}
.home-item-label > .pull-left {
Expand Down
93 changes: 92 additions & 1 deletion _site_generated/assets/js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -30811,6 +30811,80 @@ angular.module('wcodpApp').factory('solr', ['$http', '$location', function($http
);


angular.module('wcodpApp').factory('marinePlanner', ['$http', '$timeout', function($http, $timeout) {

var _availableLayers = [],
_availableLayersEndpoint = 'http://visualize.westcoastoceans.org/geoportal-ids/',
_layerUrlPattern = 'http://visualize.westcoastoceans.org/{layerSlug}/';


/**
* The first time the function is called, it stores a promise for an
* ajax call to grab the full list of UUIDs for layers Todd has added
* to MP. The first use of the promise will cache the list for further
* uses of the promise.
*/



/**
* [_getListOfLayers description]
* @param {Function} callback [description]
* @return {[type]} [description]
*/
function _getListOfLayers (callback) {
if (_availableLayers.length > 0) {
callback(_availableLayers);
} else {
// Grab list of visualizable layers from mp.
$http.get(_availableLayersEndpoint).success(function (data) {
// 'data' should be a collection of objects, each containing
// an id and a slug.

// Cache result so we don't always have to fetch the list
// from marine planner.
_availableLayers = data;

// Satisfy the current request.
callback(_availableLayers);

}).error(function (data) {
if (console) { console.log('Error getting available layers list from marine planner.'); }
});
}
}


/**
* [_getLayerSlug description]
* @param {[type]} uuid [description]
* @param {[type]} list [description]
* @return {[type]} [description]
*/
function _getLayerSlug (uuid, list) {
// TODO, probably using underscore
return 'slug-slug';
}


return {

getMarinePlannerUrl: function (uuid, success_callback, error_callback) {
_getListOfLayers(function (list) {
var slug = _getLayerSlug(uuid, list),
url = slug ? _layerUrlPattern.replace('{layerSlug}', slug) : null;
if (url) {
success_callback(url);
} else {
error_callback();
}
});
}

};

}]);

angular.module('wcodpApp').factory('packery', ['$timeout', function($timeout) {

var pckry,
Expand Down Expand Up @@ -31855,7 +31929,7 @@ angular.module('wcodpApp').directive('resultsList', ['$http', '$location', funct
}]);


angular.module('wcodpApp').directive('result', ['$http', '$location', 'metadata', function($http, $location, metadata) {
angular.module('wcodpApp').directive('result', ['$http', '$location', 'metadata', function($http, $location, metadata, marinePlanner) {

return {
templateUrl: '/assets/views/ResultView.html',
Expand All @@ -31873,6 +31947,8 @@ angular.module('wcodpApp').directive('result', ['$http', '$location', 'metadata'

scope.map = null;

scope.marinePlannerUrl = '';

scope.metadata = {
datePublished: '',
creator: '',
Expand Down Expand Up @@ -32057,6 +32133,21 @@ angular.module('wcodpApp').directive('result', ['$http', '$location', 'metadata'
scope.jsonUrl = function () {
return scope.metadataXmlUrl() + '&f=pjson';
};

scope.marinePlannerUrl = function () {
var uuid = scope.resultData['sys.sync.foreign.id_s'];
if (scope.marinePlannerUrl.length > 0) {
return scope.marinePlannerUrl;
} else {
var success = function (result) {
scope.marinePlannerUrl = result;
};
var error = function () {
scope.marinePlannerUrl = '#error';
};
marinePlanner.getMarinePlannerUrl(uuid, success, error);
}
};

scope.getLinks = function () {
$http.get(scope.jsonUrl()).success(function (data) {
Expand Down
7 changes: 6 additions & 1 deletion site_raw/_includes/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ small {
background-color: transparent;
}
.home-item-cntr {
padding: 10px 15px 15px 15px;
padding: 0px 15px 0px 15px;
height: 100%;
}
a > div.home-item-cntr:hover {
background: rgba(4, 4, 4, 0.1);
}
.home-item-cntr.welcome {
padding: 20px 30px 30px 30px;
Expand Down Expand Up @@ -221,6 +225,7 @@ small {
font-size: 24px;
}
.home-item-label {
padding-top: 10px;
margin-bottom: 10px;
}
.home-item-label > .pull-left {
Expand Down
6 changes: 5 additions & 1 deletion site_raw/_includes/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ small {
.home-item.lightGrey { background-color: @lightGrey; }
.home-item.transparent { background-color: transparent; }

.home-item-cntr { padding: 10px 15px 15px 15px; }
.home-item-cntr { padding: 0px 15px 0px 15px; height: 100%; }
a > div.home-item-cntr:hover {
background: rgba(4, 4, 4, 0.1);
}
.home-item-cntr.welcome { padding: 20px 30px 30px 30px; }

.home-item-cntr.search { padding: 30px 20px 20px 20px; }
Expand Down Expand Up @@ -267,6 +270,7 @@ small {
font-size: 24px;
}
.home-item-label {
padding-top: 10px;
margin-bottom: 10px;
}
.home-item-label > .pull-left {
Expand Down
1 change: 1 addition & 0 deletions site_raw/assets/js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ angular.module('wcodpApp', ['ui.bootstrap', 'leaflet-directive']);
{% include js/filters/TitleCase.js%}
// Services
{% include js/services/Solr.js %}
{% include js/services/MarinePlanner.js %}
{% include js/services/Packery.js %}
{% include js/services/Metadata.js %}
{% include js/services/BrowserSize.js %}
Expand Down

0 comments on commit 763ea74

Please sign in to comment.