Skip to content

Commit

Permalink
taxonomy
Browse files Browse the repository at this point in the history
  • Loading branch information
wileybenet committed Mar 29, 2013
1 parent fd968f2 commit df9bc2c
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 36 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

####Google-powered map of all sustainability efforts on the UW campus.

This repo consists of all sus_map module that extends Drupal.

Map items are stored as Drupal nodes and are easily editable and expandable.
This is a module that extends Drupal.
Binary file added css/images/minus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css/images/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 47 additions & 14 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
clear:both;
}
.sus-map-link {
color:rgb(13, 158, 77);
color:rgb(0, 126, 185);
cursor:pointer;
}
.sus-map-link:hover {
text-decoration:underline;
}
.tax-link {
margin-left:20px;
}
.sus-map-action-img {
vertical-align:middle;
margin-right:2px;
}

.screen-overlay {
width:100%;
Expand Down Expand Up @@ -151,6 +158,7 @@
display:none;
font-size:12px;
box-shadow:0 2px 6px #000;
border-radius:3px;
}

#sus-map-bottom-row {
Expand Down Expand Up @@ -198,18 +206,23 @@
font-size:10px;
overflow:hidden;
}
.info-window-tax-header {
cursor:pointer;

}
.info-window-tax {
width:100%;
height:auto;
font-size:10px;
overflow:hidden;
background:transparent;
}
.info-window-lcol {
width:300px;
min-height:190px;
min-height:50px;
position:relative;
float:left;
}
.info-window-tax {
width:100%;
min-height:60px;
font-size:10px;
background:transparent;
}
.info-window-content {
width:290px;
height:120px;
Expand All @@ -219,7 +232,7 @@
}
.info-window-rcol {
width:190px;
min-height:130px;
min-height:50px;
margin-left:10px;
float:left;
}
Expand Down Expand Up @@ -265,10 +278,8 @@
}

.sus-map-building-childNode {
border-radius:15px;
width:30px;
height:30px;
background:#FEFEFE center -3px no-repeat;
width:28px;
height:28px;
float:left;
cursor:pointer;
}
Expand Down Expand Up @@ -327,4 +338,26 @@
#sus-map-top-sel {
top:0px;
left:10px;
}
}
.sus-map-larr {
width:2px;
height:1px;
position:absolute;
border:8px solid rgba(0,0,0,.3);
border-top-color:transparent;
border-bottom-color:transparent;
border-left:0px;
top:9px;
left:-10px;
}
.sus-map-larr-fill {
width:2px;
height:1px;
position:absolute;
border:7px solid #FFF;
border-top-color:transparent;
border-bottom-color:transparent;
border-left:0px;
top:-9px;
left:1px;
}
17 changes: 11 additions & 6 deletions js/susmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Susmap = function() {
this.infoWindowStopProp = false;

this.markerTitle = jQuery('#sus-map-marker-title');
this.markerTitle.content = jQuery('#sus-map-marker-title').find("span");
this.nodeTypes = [];
this.visMarkers = [];
this.buildingDataByName = {};
Expand Down Expand Up @@ -163,8 +164,9 @@ Susmap.prototype.setBuildingMarker = function(key, val) {
url: this_.root+"js/markers/building/building-icon.png",
anchor: new google.maps.Point(20, 20)
};
marker.setIcon(icon);
this_.markerTitle.hide();
marker.setIcon(icon);

this_.markerTitle.stop(true,true).fadeOut();
});
return marker;
}
Expand Down Expand Up @@ -193,9 +195,10 @@ Susmap.prototype.openIconTitle = function(e, nid, vOff) {

var x = loc.x,
y = loc.y;
var left = this.map.getDiv().style.marginLeft.split(" ")[0].parseNum()+22+"px";
var left = this.map.getDiv().style.marginLeft.split(" ")[0].parseNum()+28+"px";

this.markerTitle.css({left:x, top:y, "margin-left":left, "margin-top":-15-vOff+"px"}).html("Marker Node ID: "+nid).show();
this.markerTitle.content.html(this_.nodeData[nid].title);
this.markerTitle.css({left:x, top:y, "margin-left":left, "margin-top":-15-vOff+"px"}).stop(true,true).fadeIn(250);
}

Susmap.prototype.openInfoWindow = function(infoWindow, marker) {
Expand Down Expand Up @@ -305,14 +308,16 @@ Susmap.prototype.attachInfoWindowHandles = function() {
});
$(document).delegate(".tax-building", "click", function() {
var building = $(this).text();
console.log(building);
});
$(document).delegate(".filter-ntype", "click", function() {
var nType = $(this).text().replace(/ /g, "");
$('#'+nType).addClass("sus-map-filter-base-selector-selected");
this_.setMarkerVisibility(nType, true);
this_.hashManager.hashSelectSet(nType);
});
$(document).delegate(".info-window-tax-header", "click", function() {
$('.info-window-tax').animate({height:"200px"});
});
}(jQuery));
}
Susmap.prototype.attachFilterHandles = function() {
Expand Down Expand Up @@ -371,7 +376,7 @@ Susmap.prototype.renderMap = function() {
$('#sus-map-load-bar').animate({width:"100%"}, 1, function() {
$('.screen-overlay').fadeOut(function(){$(this).remove()});
var gmw = $(window).width();
$('#sus-map').width(gmw-106);
$('#sus-map').width(gmw);
$(window).resize();
});
}(jQuery));
Expand Down
6 changes: 3 additions & 3 deletions js/susmap_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Array.prototype.clean = function(deleteValue) {
}
return this;
};
function setLink(str, url) {
var ob = {str:str, url:url};
var temp = '<span class="sus-map-link" action="{{url}}">{{str}}</span>';
function setLink(str, url, cls) {
var ob = {str:str, url:url, cls:" "+cls};
var temp = '<span class="sus-map-link{{cls}}" action="{{url}}">{{str}}</span>';
return Mustache.render(temp, ob);
}
37 changes: 32 additions & 5 deletions js/susmap_info_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ function initInfoWindowNS() {
this_.title = $('#sus-map-info-window').find('.info-window-title');
this_.subtitle = $('#sus-map-info-window').find('.info-window-subtitle');
this_.content = $('#sus-map-info-window').find('.info-window-content');
this_.tax = $('#sus-map-info-window').find('.info-window-tax');
this_.taxHeader = $('#sus-map-info-window').find('.info-window-tax-header');
this_.tax = $('#sus-map-info-window').find('.info-window-tax').hide();
this_.image = $('#sus-map-info-window').find('.info-window-image');
this_.imageBuilding = $('#sus-map-info-window').find('.info-window-image-building');
this_.close = $('#sus-map-info-window').find('.info-window-close');
this_.imageAnchor = {x: 22, y: -150};
}(jQuery));
}

InfoWindow.prototype = new google.maps.OverlayView();

InfoWindow.prototype.open = function(map, point, id) {
Expand Down Expand Up @@ -61,26 +63,32 @@ function initInfoWindowNS() {
((this_.nType!="Building")?setLink(this_.nType, "info-nType"):this_.nType)
);
this_.title.html(this_.Susmap.nodeData[this_.nid].title);

var terms = "";
this_.taxHeader.find('span').html("Associated Terms");
$.each(this_.Susmap.nodeData[this_.nid].taxonomy, function(k,v) {
if (k != "Building") {
terms += k+"<br />";
$.each(v, function(key,val) {
terms += setLink(val, "taxonomy")+"<br />";
terms += setLink(val, "taxonomy", "tax-link")+"<br />";
});
}
});
if (this_.nType=="Building") {
this_.taxHeader.find('span').html("Features:");
var title = this_.Susmap.nodeData[this_.nid].title;
var childNodes = this_.Susmap.buildingDataByName[title].childNodes;
terms = "";
if (childNodes) {
$.each(childNodes, function(k,v) {
terms += Mustache.render($('#sus-map-building-nodes-template').html(), v);
});
}
terms += '<div class="c-b"></div>';
}
this_.tax.html(terms);
this_.tax.html(terms).height(0);
this_.taxHeader.on("click", function() {this_.toggleTax(this_)});

this_.content.html(this_.Susmap.nodeData[this_.nid].body);
if (this_.Susmap.nodeData[this_.nid].image) {
this_.image.attr({src:"/sites/default/files/"+this_.Susmap.nodeData[this_.nid].image}).fadeIn();
Expand Down Expand Up @@ -118,6 +126,23 @@ function initInfoWindowNS() {
panes.floatPane.appendChild(this.div.show().get(0));
this.focus();
}
InfoWindow.prototype.toggleTax = function(self) {
var this_ = this;
(function($) {
if (self.tax.is(':visible')) {
self.tax.animate({height:"0px"}, 200, function() {
self.taxHeader.find('img').attr("src", self.Susmap.root+"css/images/plus.png");
$(this).hide()
});
} else {
self.tax.css("height", "auto");
var h = self.tax.height();
self.tax.height(0);
self.taxHeader.find('img').attr("src", self.Susmap.root+"css/images/minus.png");
self.tax.show().animate({height:h+"px"});
}
}(jQuery));
}
InfoWindow.prototype.focus = function() {
var projection = this.getProjection();
var point = projection.fromLatLngToDivPixel(this.latlng);
Expand Down Expand Up @@ -145,7 +170,9 @@ function initInfoWindowNS() {
this_.title.html("");
this_.subtitle.html("");
this_.content.html(this_.loadIcon);
this_.tax.html("");
this_.tax.html("").hide();
this_.taxHeader.find('img').attr("src", this_.Susmap.root+"css/images/plus.png");
this_.taxHeader.off("click");
var emptyImg = {src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="};
this_.image.attr(emptyImg).hide();
this_.imageBuilding.attr(emptyImg).hide();
Expand All @@ -166,7 +193,7 @@ function initInfoWindowNS() {
if (!$('#'+nodeSet).hasClass("sus-map-filter-base-selector-selected")) {
$('#'+nodeSet).click();
}
});
}(jQuery));
} else if (action == "taxonomy") {
//this_.Susmap.hashManager.hashSelectSet(false);
(function($) {
Expand Down
2 changes: 2 additions & 0 deletions js/susmap_location_hash_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ LocationHashManager.prototype.init = function() {

if (nodeSet != "") {
this.nodeSet = nodeSet.split("+");
}
if (node != "") {
this.node = (node)?parseInt(node):null;
}
}
Expand Down
12 changes: 8 additions & 4 deletions js/susmap_page_styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ PageStyles.prototype.renderMap = function() {
width: $(window).width()+"px",
height: $(window).height()+"px"
});
var left = 106;
$('#sus-map').css({
margin: "0 0 0 "+left+"px",
width: $(window).width()-left+"px",
margin: "0px",
width: $(window).width()+"px",
height: $(window).height()+"px"
});
}(jQuery));
Expand All @@ -54,6 +53,10 @@ PageStyles.prototype.renderSusmapOverlays = function() {
$('#sus-map-col').append('<a href="http://green.washington.edu" title="The Office of Environmental Stewardship and Sustainability" id="sus-map-logo"></a>');

$('body').append('<div id="sus-map-marker-title"></div>');
$('#sus-map-marker-title').append('<div class="sus-map-larr"></div>');
$('#sus-map-marker-title').find(".sus-map-larr").append('<div class="sus-map-larr-fill"></div>');
$('#sus-map-marker-title').append('<span></span>');

$('body').append('<div id="sus-map-info-window"></div>');
$('#sus-map-info-window').append('<img class="info-window-icon-frame" />');
$('#sus-map-info-window').append('<img class="info-window-image-building" />');
Expand All @@ -62,13 +65,14 @@ PageStyles.prototype.renderSusmapOverlays = function() {
$('#sus-map-info-window').append('<div class="info-window-subtitle"></div>');
$('#sus-map-info-window').append('<div class="info-window-title"></div>');
$('#sus-map-info-window').append('<div class="info-window-lcol"></div>');
$('.info-window-lcol').append('<div class="info-window-tax"></div>');
$('.info-window-lcol').append('<div class="info-window-content"></div>');
$('#sus-map-info-window').append('<div class="info-window-rcol"></div>');
$('.info-window-rcol').append('<img class="info-window-image" />');
$('#sus-map-info-window').append('<div style="clear:both"></div>');
$('.info-window-icon-frame').attr("src", root+"css/images/icon_frame.png");
$('.info-window-close').attr("src", root+"css/images/x.png");
$('#sus-map-info-window').append('<div class="info-window-tax-header"><img class="sus-map-action-img" src="'+root+'css/images/plus.png" /><span></span></div>');
$('#sus-map-info-window').append('<div class="info-window-tax"></div>');
}(jQuery));
}

Expand Down
2 changes: 1 addition & 1 deletion js/susmap_templates.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

var templates = '';

templates += genTemp("building-nodes-template", '<div class="sus-map-building-childNode" title="{{name}}" style="background-image:url({{url}});" action="{{nid}}"></div>');
templates += genTemp("building-nodes-template", '<img class="sus-map-building-childNode" title="{{name}}" src="{{url}}" action="{{nid}}" />');



Expand Down

0 comments on commit df9bc2c

Please sign in to comment.