Prepare reverter

This commit is contained in:
Ilya Zverev 2016-07-04 19:07:07 +03:00
parent 810c390a82
commit abfab98136
5 changed files with 8 additions and 13 deletions

View file

@ -17,7 +17,7 @@ GEOCODE_BATCH = 20
# Override these (and anything else) in config_local.py
OAUTH_KEY = ''
OAUTH_SECRET = ''
SESSION_KEY = 'sdkjfhsfljhsadf'
SECRET_KEY = 'sdkjfhsfljhsadf'
try:
from config_local import *

View file

@ -1,8 +1,7 @@
from flask import Flask
import config
app = Flask(__name__)
app.debug = config.DEBUG
app.config.from_object('config')
try:
from flask_compress import Compress

View file

@ -33,8 +33,6 @@ def oauth(resp):
resp['oauth_token'],
resp['oauth_token_secret']
)
user_details = openstreetmap.get('user/details').data
session['osm_username'] = user_details[0].get('display_name')
return redirect(url_for('revert'))
@ -49,6 +47,4 @@ def get_token(token='user'):
def logout():
if 'osm_token' in session:
del session['osm_token']
if 'osm_username' in session:
del session['osm_username']
return redirect(url_for('the_one_and_only_page'))

View file

@ -1,28 +1,28 @@
function getCheckedObjects() {
function getCheckedObjects(which) {
var result = [];
var checks = document.getElementsByClassName('obj_check');
for (var i = 0; i < checks.length; i++) {
if (checks[i].checked)
result.push(checks[i].value);
result.push(checks[i].value.split(',')[which]);
checks[i].checked = false;
}
return result;
}
function btnClear() {
getCheckedObjects();
getCheckedObjects(0);
window.scrollTo(0, 0);
}
function btnLevel0() {
var checks = getCheckedObjects();
var checks = getCheckedObjects(0);
var param = checks.join(',');
var w = window.open('http://level0.osmz.ru/?url=' + param, '_blank');
w.focus();
}
function btnRevert(url) {
var checks = getCheckedObjects();
var checks = getCheckedObjects(1);
var param = checks.join(',');
window.location.assign(url + '?objects=' + param);
}

View file

@ -106,7 +106,7 @@
<h2>Changes</h2>
{% for change in changes %}
<div class="change">
<input type="checkbox" class="obj_check" value="{{ change.obj_type }}{{ change.obj_id }}">
<input type="checkbox" class="obj_check" value="{{ change.obj_type }}{{ change.obj_id }},{{ change.id }}">
<a href="https://www.openstreetmap.org/user/{{ change.user }}">{{ change.user }}</a><sup><a href="{{ purl(params, user=change.user) }}">&#9875;</a></sup> at {{ change.timestamp.strftime('%d.%m.%Y %H:%M') }} in
{% if change.action == 'n' %}
<a href="https://www.openstreetmap.org/note/{{ change.changeset }}">{{ change.changeset }}</a>: {{ change.explain_action() }}