Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/adamloving/dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
leonwong committed Oct 16, 2011
2 parents 830d71c + dc58c82 commit 0c995c4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 26 deletions.
12 changes: 6 additions & 6 deletions app/coffeescripts/filter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class Filter
query.owner = @groups.join(',')

if @coords
query.sw_lat = @coords.southWest.Ma
query.sw_long = @coords.southWest.Na
query.ne_lat = @coords.northEast.Ma
query.ne_long = @coords.northEast.Na
query.sw_lat = @coords.southWest.lat()
query.sw_long = @coords.southWest.lng()
query.ne_lat = @coords.northEast.lat()
query.ne_long = @coords.northEast.lng()

query.start_date = @startDate

Expand All @@ -46,8 +46,8 @@ class Filter
if q.search
s += '<li>Keyword: ' + q.search + '</li>'

if q.tags
s+= '<li>Tags: ' + q.tags.join(', ') + '</li>'
if q.tag
s += '<li>Tags: ' + q.tag + '</li>'

if q.owner
s+= '<li>Groups: ' + q.groups.join(', ') + '</li>'
Expand Down
1 change: 1 addition & 0 deletions app/views/home/_extras.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
button(height='300px') Add Additional Filter Plugin
2 changes: 2 additions & 0 deletions app/views/home/_filters.slim
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
h2 Groups
= render :partial => 'friends'

h2 Extra filters
= render :partial => 'extras'
12 changes: 6 additions & 6 deletions app/views/layouts/_top_nav.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.topbar-inner
.container
h3
img(src='../../../images/profile.jpeg' width='55px' height='55px' align='right')

h3
a(href='/') Dimensions

a(href='/') Welcome Leon to Dimensions!

form(onsubmit='return false;')
input#search(type="text" placeholder="Search")


h3
img(src='../../../images/profile.jpeg' width='55px' height='55px' align='right')

= javascript_include_rpx(user_session_url)
14 changes: 7 additions & 7 deletions public/javascripts/filter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* DO NOT MODIFY. This file was compiled Sun, 16 Oct 2011 18:33:10 GMT from
/* DO NOT MODIFY. This file was compiled Sun, 16 Oct 2011 19:19:51 GMT from
* /Users/adam/Projects/dimensions/app/coffeescripts/filter.coffee
*/

Expand Down Expand Up @@ -41,10 +41,10 @@
query.owner = this.groups.join(',');
}
if (this.coords) {
query.sw_lat = this.coords.southWest.Ma;
query.sw_long = this.coords.southWest.Na;
query.ne_lat = this.coords.northEast.Ma;
query.ne_long = this.coords.northEast.Na;
query.sw_lat = this.coords.southWest.lat();
query.sw_long = this.coords.southWest.lng();
query.ne_lat = this.coords.northEast.lat();
query.ne_long = this.coords.northEast.lng();
}
query.start_date = this.startDate;
return query;
Expand All @@ -59,8 +59,8 @@
if (q.search) {
s += '<li>Keyword: ' + q.search + '</li>';
}
if (q.tags) {
s += '<li>Tags: ' + q.tags.join(', ') + '</li>';
if (q.tag) {
s += '<li>Tags: ' + q.tag + '</li>';
}
if (q.owner) {
s += '<li>Groups: ' + q.groups.join(', ') + '</li>';
Expand Down
27 changes: 20 additions & 7 deletions public/javascripts/map_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,33 @@ function centerMapToCurrentLocation()
});
}

function filterByBoundary(map)
{
boundary = "Visible map viewport has changed.\n\n";
boundary += "South west coorindates:\n" + getSouthWestCoordinates(map);
boundary += "\n\nNorth east coorindates:\n" + getNorthEastCoordinates(map);
console.log(boundary);
window.filter.setCoords(getNorthEastCoordinates(map), getSouthWestCoordinates(map));
}

$(function() {
$('#map').gmap();

$('#map').gmap().bind('init', function(event, map) {
centerMapToCurrentLocation();

$(map).dragend( function() {
// TODO: we need to refresh the stream based on the boundary filter
// instead of displaying alert.
boundary = "Visible map viewpoer has changed.\n\n";
boundary += "South west coorindates:\n" + getSouthWestCoordinates(map);
boundary += "\n\nNorth east coorindates:\n" + getNorthEastCoordinates(map);
console.log(boundary);
window.filter.setCoords(getNorthEastCoordinates(map), getSouthWestCoordinates(map))
filterByBoundary(map);
});

var firstEvent = true;
google.maps.event.addListener(map, 'zoom_changed', function() {
if (firstEvent) {
firstEvent = false;
} else {
filterByBoundary(map);
}

});
});

Expand Down

0 comments on commit 0c995c4

Please sign in to comment.