links to maps go through without refresh from topic card.

This commit is contained in:
Connor Turland 2014-11-27 17:27:22 -05:00
parent 6408f81d08
commit caa80c067b
5 changed files with 35 additions and 27 deletions

View file

@ -194,13 +194,8 @@
Metamaps.Router = new Router(); Metamaps.Router = new Router();
Metamaps.Router.init = function () {
Backbone.history.start({ Metamaps.Router.intercept = function (evt) {
silent: true,
pushState: true,
root: '/'
});
$(document).on("click", "a:not([data-bypass])", function (evt) {
var segments; var segments;
var href = { var href = {
@ -209,7 +204,7 @@
}; };
var root = location.protocol + "//" + location.host + Backbone.history.options.root; var root = location.protocol + "//" + location.host + Backbone.history.options.root;
if (href.prop && href.prop === root) href.attr = "" if (href.prop && href.prop === root) href.attr = "";
if (href.prop && href.prop.slice(0, root.length) === root) { if (href.prop && href.prop.slice(0, root.length) === root) {
evt.preventDefault(); evt.preventDefault();
@ -219,9 +214,18 @@
if (href.attr === "") Metamaps.Router.home(); if (href.attr === "") Metamaps.Router.home();
else { else {
console.log(segments);
Metamaps.Router[segments[0]](segments[1]); Metamaps.Router[segments[0]](segments[1]);
} }
} }
};
Metamaps.Router.init = function () {
Backbone.history.start({
silent: true,
pushState: true,
root: '/'
}); });
} $(document).on("click", "a:not([data-bypass])", Metamaps.Router.intercept);
};
})(); })();

View file

@ -1092,7 +1092,7 @@ Metamaps.TopicCard = {
$('.links .mapCount').unbind().click(function(event){ $('.links .mapCount').unbind().click(function(event){
$('.mapCount .tip').toggle(); $('.mapCount .tip').toggle();
$('.hoverTip').toggleClass('hide'); $('.showcard .hoverTip').toggleClass('hide');
event.stopPropagation(); event.stopPropagation();
}); });
$('.mapCount .tip').unbind().click(function(event){ $('.mapCount .tip').unbind().click(function(event){
@ -1100,8 +1100,11 @@ Metamaps.TopicCard = {
}); });
$('.showcard').unbind('.hideTip').bind('click.hideTip', function(){ $('.showcard').unbind('.hideTip').bind('click.hideTip', function(){
$('.mapCount .tip').hide(); $('.mapCount .tip').hide();
$('.showcard .hoverTip').removeClass('hide');
}); });
$('.mapCount .tip li a').click(Metamaps.Router.intercept);
var originalText = $('.showMore').html(); var originalText = $('.showMore').html();
$('.mapCount .tip .showMore').unbind().toggle( $('.mapCount .tip .showMore').unbind().toggle(
function(event){ function(event){

View file

@ -312,6 +312,7 @@
.showMore { .showMore {
cursor: pointer; cursor: pointer;
color: #4FC059;
} }
.mapCount .tip a { .mapCount .tip a {

View file

@ -798,7 +798,7 @@
background-color: #4fb5c0; background-color: #4fb5c0;
} }
.callToAction .learnMoreCTA:hover { .callToAction .learnMoreCTA:hover {
background-color: #3d8e8e; background-color: #419599;
} }
.fullWidthWrapper.withPartners { .fullWidthWrapper.withPartners {

View file

@ -129,7 +129,7 @@
<script type="text/template" id="mapSearchTemplate"> <script type="text/template" id="mapSearchTemplate">
<div class="result{{rtype}}"> <div class="result{{rtype}}">
<div class="searchResIconWrapper"> <div class="searchResIconWrapper">
<img class="icon" src="/assets/metamap32c.png"> <img class="icon" src="/assets/metamap36c.png">
</div> </div>
<div class="resultText"> <div class="resultText">
<p class="resultTitle">{{label}}</p> <p class="resultTitle">{{label}}</p>