-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Wire up visible to - Wire up location filter - Wire up show/hide on mode context filter - Populate default form value - Hide share button
- Loading branch information
Showing
21 changed files
with
235 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module.exports = LocationFilterDirective; | ||
|
||
LocationFilterDirective.$inject = ['Geocoding', '$q']; | ||
function LocationFilterDirective(Geocoding, $q) { | ||
return { | ||
restrict: 'E', | ||
scope: { | ||
centerPointModel: '=', | ||
withinKmModel: '=' | ||
}, | ||
require: '^form', | ||
link: LocationFilterLink, | ||
templateUrl: 'templates/posts/views/filters/filter-location.html' | ||
}; | ||
|
||
//LocationFilterLink.$inject = ['Geocoding']; | ||
function LocationFilterLink($scope, element, attrs, formCtrl) { | ||
$scope.geocoding = false; | ||
$scope.locationSearchText = ''; | ||
|
||
$scope.$watch('centerPointModel', updateStateFromModels); | ||
$scope.$watch('locationSearchText', updateModelsFromState); | ||
|
||
function updateStateFromModels(newValue, oldValue) { | ||
if (!$scope.locationSearchText) { | ||
$scope.locationSearchText = $scope.centerPointModel; | ||
} | ||
} | ||
|
||
function updateModelsFromState() { | ||
if ($scope.locationSearchText) { | ||
geocode($scope.locationSearchText).then(function (coords) { | ||
$scope.centerPointModel = coords; | ||
}); | ||
} else { | ||
$scope.centerPointModel = ''; | ||
} | ||
} | ||
|
||
function geocode(location) { | ||
var defer = $q.defer(), | ||
valid_coords = /\-?[0-9]+(\.[0-9]+)?\s*,\s*\-?[0-9]+(\.[0-9]+)?/; | ||
|
||
if (!location) { | ||
return; | ||
} | ||
|
||
if (valid_coords.test(location)) { | ||
defer.resolve(location); | ||
} else { // perform a geocoding lookup on the location | ||
$scope.geocoding = true; | ||
|
||
Geocoding.search(location).then(function (coordinates) { | ||
if (!coordinates) { | ||
defer.reject(); | ||
return; | ||
} // @todo - handle bad lookup | ||
|
||
$scope.geocoding = false; | ||
defer.resolve(coordinates[0] + ',' + coordinates[1]); | ||
}); | ||
} | ||
|
||
return defer.promise; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
server/www/templates/posts/views/filters/filter-category.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
<fieldset> | ||
<legend translate="app.surveys">Surveys</legend> | ||
|
||
<div class="form-field checkbox" ng-repeat="(index, form) in forms"> | ||
<div class="form-field checkbox" ng-repeat="(index, form) in forms" ng-class="{ overflow : ($index > 1) }"> | ||
<label> | ||
<input checklist-value="form.id" checklist-model="model" type="checkbox" name="selectedForms" > {{ ::form.name }} | ||
</label> | ||
</div> | ||
<div class="form-field checkbox" ng-class="{ overflow : (forms.length > 2) }"> | ||
<label> | ||
<input checklist-value="'none'" checklist-model="model" type="checkbox" name="selectedForms" > <span translate="nav.unknown">Unknown</span> | ||
</label> | ||
</div> | ||
<span class="form-field-toggle" translate="nav.more">More</span> | ||
</fieldset> |
Oops, something went wrong.