Merge pull request #459 from metamaps/fix/searchbox
searchbox fixes for master
This commit is contained in:
commit
ef307f1d46
8 changed files with 63 additions and 39 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -67,6 +67,14 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.resultnoresult {
|
||||
padding: 8px 0;
|
||||
> div {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.canEditMap button.addToMap {
|
||||
display: block;
|
||||
}
|
||||
|
@ -219,14 +227,13 @@
|
|||
font-style: italic;
|
||||
font-family: helvetica, sans-serif;
|
||||
}
|
||||
}/* tt-suggestion */
|
||||
|
||||
.topicMetacode,
|
||||
.searchResIconWrapper {
|
||||
vertical-align: middle;
|
||||
padding: 0 0 0 8px;
|
||||
width: 70px;
|
||||
padding: 0 18px 0 28px;
|
||||
}
|
||||
}/* tt-suggestion */
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<div id="rightAboutParms">
|
||||
<p>PRIVATE BETA</p>
|
||||
<p>2.7</p>
|
||||
<p>2.7.1</p>
|
||||
<p>Nov 29, 2014</p>
|
||||
</div>
|
||||
<div class="clearfloat">
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
<script type="text/template" id="topicSearchTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<div class="topicMetacode">
|
||||
<div class="topicMetacode searchResIconWrapper">
|
||||
<img src="{{typeImageURL}}" class="topicIcon" />
|
||||
<div class="metacodeTip">{{type}}</div>
|
||||
</div>
|
||||
|
|
|
@ -14,4 +14,4 @@ vagrant ssh --command "cd /vagrant; bundle install";
|
|||
vagrant ssh --command "cd /vagrant; cp .example-env .env";
|
||||
|
||||
# Rake all the things
|
||||
vagrant ssh --command "cd /vagrant; rake db:create; rake db:schema:load; rake db:fixtures:load"
|
||||
vagrant ssh --command "cd /vagrant; rake db:create; rake db:setup"
|
|
@ -4,7 +4,10 @@
|
|||
#sudo aptitude -q -y install libpq-dev
|
||||
|
||||
source "$HOME/.rvm/scripts/rvm"
|
||||
rvm use $(cat .ruby-version) || \
|
||||
rvm install $(cat .ruby-version)
|
||||
rvm gemset use $(cat .ruby-gemset) || \
|
||||
rvm gemset create $(cat .ruby-gemset) && \
|
||||
rvm gemset use $(cat .ruby-gemset)
|
||||
gem install bundler
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151028061513) do
|
||||
ActiveRecord::Schema.define(version: 20160120061513) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
Loading…
Reference in a new issue