diff --git a/README.md b/README.md index 76444337..5cfd3a37 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ git clone git@github.com:metamaps/metamaps_gen002.git Now ensure you have VirtualBox and Vagrant installed on your computer ``` cd metamaps_gen002 -./configure.sh +./bin/configure.sh ``` This will do all the setup steps to make Metamaps work with a bit of behind the scenes ninja magick. diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb index fc2ba6fc..b08217a7 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb @@ -367,6 +367,8 @@ Metamaps.GlobalUI.Account = { Metamaps.GlobalUI.Search = { locked: false, isOpen: false, + limitTopicsToMe: false, + limitMapsToMe: false, timeOut: null, changing: false, optionsInitialized: false, @@ -450,7 +452,7 @@ Metamaps.GlobalUI.Search = { var self = Metamaps.GlobalUI.Search; self.timeOut = setTimeout(function () { - if (!self.locked && !self.changing && self.isOpen && (bypass || $('.sidebarSearchField').val() == '')) { + if (!self.locked && !self.changing && self.isOpen && (bypass || $('.sidebarSearchField.tt-input').val() == '')) { self.changing = true; $('.sidebarSearchField, .sidebarSearch .tt-hint').css({ padding: '7px 0 3px 0', @@ -481,7 +483,7 @@ Metamaps.GlobalUI.Search = { display: function(s) { return s.label; }, templates: { notFound: function(s) { - return Hogan.compile($('#topicSearchTemplate').html()).render({ + return Hogan.compile(topicheader + $('#topicSearchTemplate').html()).render({ value: "No results", label: "No results", typeImageURL: "<%= asset_path('icons/wildcard.png') %>", @@ -500,7 +502,7 @@ Metamaps.GlobalUI.Search = { url: '/search/topics', prepare: function(query, settings) { settings.url += '?term=' + query; - if (Metamaps.Active.Mapper && $("#limitTopicsToMe").is(':checked')) { + if (Metamaps.Active.Mapper && self.limitTopicsToMe) { settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); } return settings; @@ -515,7 +517,7 @@ Metamaps.GlobalUI.Search = { display: function(s) { return s.label; }, templates: { notFound: function(s) { - return Hogan.compile($('#mapSearchTemplate').html()).render({ + return Hogan.compile(mapheader + $('#mapSearchTemplate').html()).render({ value: "No results", label: "No results", rtype: "noresult" @@ -533,7 +535,7 @@ Metamaps.GlobalUI.Search = { url: '/search/maps', prepare: function(query, settings) { settings.url += '?term=' + query; - if (Metamaps.Active.Mapper && $("#limitMapsToMe").is(':checked')) { + if (Metamaps.Active.Mapper && self.limitMapsToMe) { settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); } return settings; @@ -548,7 +550,7 @@ Metamaps.GlobalUI.Search = { display: function(s) { return s.label; }, templates: { notFound: function(s) { - return Hogan.compile($('#mapperSearchTemplate').html()).render({ + return Hogan.compile(mapperheader + $('#mapperSearchTemplate').html()).render({ value: "No results", label: "No results", rtype: "noresult", @@ -584,6 +586,12 @@ Metamaps.GlobalUI.Search = { self.hideLoader(); var h = $(window).height(); $(".tt-dropdown-menu").css('max-height', h - 100); + if (self.limitTopicsToMe) { + $('#limitTopicsToMe').prop('checked', true); + } + if (self.limitMapsToMe) { + $('#limitMapsToMe').prop('checked', true); + } }); $(window).resize(function () { var h = $(window).height(); @@ -599,11 +607,10 @@ Metamaps.GlobalUI.Search = { }); // make sure that when you click on 'limit to me' or 'toggle section' it works - $('.sidebarSearchField').bind('typeahead:change', function(){ - if ($(this).val() === "") { + $('.sidebarSearchField.tt-input').keyup(function(){ + if ($('.sidebarSearchField.tt-input').val() === '') { self.hideLoader(); - } - else { + } else { self.showLoader(); } }); @@ -630,26 +637,29 @@ Metamaps.GlobalUI.Search = { var self = Metamaps.GlobalUI.Search; function toggleResultSet(set) { - var s = $('.tt-dataset-' + set + ' .tt-dataset'); - if (s.css('height') == '0px') { - s.css({ - 'height': 'auto', - 'overflow': 'visible' - }); - $(this).removeClass('maximizeResults').addClass('minimizeResults'); - } else { - s.css({ - 'height': '0', - 'overflow': 'hidden' - }); + var s = $('.tt-dataset-' + set + ' .tt-suggestion, .tt-dataset-' + set + ' .resultnoresult'); + if (s.is(':visible')) { + s.hide(); $(this).removeClass('minimizeResults').addClass('maximizeResults'); + } else { + s.show(); + $(this).removeClass('maximizeResults').addClass('minimizeResults'); } } $('.limitToMe').unbind().bind("change", function (e) { + if ($(this).attr('id') == 'limitTopicsToMe') { + self.limitTopicsToMe = !self.limitTopicsToMe; + } + if ($(this).attr('id') == 'limitMapsToMe') { + self.limitMapsToMe = !self.limitMapsToMe; + } + // set the value of the search equal to itself to retrigger the autocomplete event self.isOpen = false; - $('.sidebarSearchField').typeahead('val', $('.sidebarSearchField').val()); + var searchQuery = $('.sidebarSearchField.tt-input').val(); + $(".sidebarSearchField").typeahead('val', '') + $(".sidebarSearchField").focus().typeahead('val', searchQuery).focus(); setTimeout(function () { self.isOpen = true; }, 2000); diff --git a/app/assets/stylesheets/search.scss.erb b/app/assets/stylesheets/search.scss.erb index 0f806f96..efd196cb 100644 --- a/app/assets/stylesheets/search.scss.erb +++ b/app/assets/stylesheets/search.scss.erb @@ -67,6 +67,14 @@ width: 100%; } +.resultnoresult { + padding: 8px 0; + > div { + display: table-cell; + vertical-align: middle; + } +} + .canEditMap button.addToMap { display: block; } @@ -219,15 +227,14 @@ font-style: italic; font-family: helvetica, sans-serif; } - - .topicMetacode, - .searchResIconWrapper { - vertical-align: middle; - padding: 0 0 0 8px; - width: 70px; - } }/* tt-suggestion */ + .searchResIconWrapper { + vertical-align: middle; + width: 70px; + padding: 0 18px 0 28px; + } + .tt-dataset { overflow: visible; } @@ -242,8 +249,12 @@ .topicIcon { width: 32px; height: 32px; - margin: 0 auto; } + + .resulttopic .topicIcon { + margin: 0 auto + } + .metacodeTip { display: none; margin: 0 auto; @@ -313,7 +324,7 @@ .tt-suggestion:hover .autoOptions { display: block; } - .tt-suggestion .resultnoresult .autoOptions { + .resultnoresult .autoOptions { display: none; } diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index 00b923f6..1b3c0991 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -18,7 +18,7 @@
PRIVATE BETA
-2.7
+2.7.1
Nov 29, 2014