From e357730b316827789a6a677d197a58135033fce6 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sat, 24 May 2014 14:55:15 -0700 Subject: [PATCH] remember if the user checks the "location" checkbox and always find their location in the future if so --- README.md | 22 +++++++++++++ controllers/controllers.php | 14 ++++++++- views/dashboard.php | 61 +++++++++++++++++++++++-------------- 3 files changed, 73 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 1cf12a4..9a58be1 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,25 @@ IndiePost Work in progress. Do not use! https://indiepost.micropub.net/ + + +### Contributing + +By submitting code to this project, you agree to irrevocably release it under the same license as this project. + + +### License + +Copyright 2013 by Aaron Parecki + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/controllers/controllers.php b/controllers/controllers.php index 18879e3..3ff111e 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -32,12 +32,24 @@ $app->get('/new', function() use($app) { 'micropub_scope' => $user->micropub_scope, 'micropub_access_token' => $user->micropub_access_token, 'response_date' => $user->last_micropub_response_date, - 'test_response' => $test_response + 'test_response' => $test_response, + 'location_enabled' => $user->location_enabled )); $app->response()->body($html); } }); +$app->post('/prefs', function() use($app) { + if($user=require_login($app)) { + $params = $app->request()->params(); + $user->location_enabled = $params['enabled']; + $user->save(); + } + $app->response()->body(json_encode(array( + 'result' => 'ok' + ))); +}); + $app->get('/creating-a-token-endpoint', function() use($app) { $app->redirect('http://indiewebcamp.com/token-endpoint', 301); }); diff --git a/views/dashboard.php b/views/dashboard.php index 7a35ba1..120d0bf 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -24,6 +24,7 @@ +