Commit d8eee59a authored by Pierre Arnaud's avatar Pierre Arnaud

Code cleaning:

--------------

remove useless import

Rename route:
	data -> reuse
	acces_donnees -> open-data

Rename templates:
	data.mako -> reuse.mako
	iframe.mako -> open-data.mako

Remove useless .js

Reorder view.py functions
parent 377a52e1
......@@ -25,20 +25,7 @@
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from passim.models import initialize_model
#from passim.resources import RootResource
from .models import (
DBSession,
Base,
)
def on_before_renderer(event):
global APP_NAME, APP_VERSION
request = event['request']
def main(global_config, **settings):
......@@ -51,16 +38,12 @@ def main(global_config, **settings):
config = Configurator(
authorization_policy=authorization_policy,
# root_factory=RootResource,
settings=settings,
)
# Session setup
config.include('pyramid_beaker')
# Subscribers setup
config.add_subscriber(on_before_renderer, 'pyramid.events.BeforeRender')
# Auth setup
config.include('passim.auth')
......@@ -81,7 +64,7 @@ def main(global_config, **settings):
config.add_route('contact-email', '/contact-email')
config.add_route('contribute', '/contribute')
config.add_route('contribute-email', '/contribute-email')
config.add_route('data', '/data')
config.add_route('reuse', '/reuse')
config.add_route('help', '/help')
config.add_route('maps.sim', '/maps/sim')
......@@ -89,9 +72,9 @@ def main(global_config, **settings):
config.add_route('maps.dep', '/maps/dep')
config.add_route('maps.offers', '/maps/offers')
config.add_route('feed', '/feed') #rss last updates
config.add_route('feed', '/feed') # rss last updates
config.add_route('acces_donnees', '/acces_donnees') #Apache directory listing
config.add_route('open-data', '/open-data') # Apache directory listing
config.add_route('organisms', '/organismes/{name}/{id}')
config.add_route('territories', '/territoires/{type}/{name}')
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Passim 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-04-27 16:47+0200\n"
"POT-Creation-Date: 2015-04-29 15:53+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -30,7 +30,7 @@ msgid "Administrator"
msgstr ""
#: passim/templates/about.mako:12 passim/templates/site.mako:95
#: passim/templates/site.mako:139 passim/views/__init__.py:78
#: passim/templates/site.mako:139 passim/views/__init__.py:73
msgid "About"
msgstr ""
......@@ -82,7 +82,7 @@ msgid "Last modification time"
msgstr ""
#: passim/templates/contact.mako:19 passim/templates/site.mako:98
#: passim/views/__init__.py:128
#: passim/views/__init__.py:117
msgid "Contact"
msgstr ""
......@@ -129,7 +129,7 @@ msgid "Contribute Form"
msgstr ""
#: passim/templates/contribute.mako:9 passim/templates/site.mako:101
#: passim/views/__init__.py:164
#: passim/views/__init__.py:153
msgid "Contribute"
msgstr ""
......@@ -152,42 +152,6 @@ msgid ""
"management site.\n"
msgstr ""
#: passim/templates/data.mako:12 passim/templates/site.mako:104
#: passim/views/__init__.py:171
msgid "Reuse"
msgstr ""
#: passim/templates/data.mako:14
msgid ""
"PASSIM content is published on\n"
"[the national open data portal](https://www.data.gouv.fr/dataset/passim-"
"annuaire-des-services-d-information-transport)\n"
"under [Etalab Open Licence](http://www.data.gouv.fr/Licence-Ouverte-Open-"
"Licence).\n"
"\n"
"The PASSIM directory was created in 2004 as a means to give to public "
"authorities a global vision on the traveller info\n"
"service landscape and evolutions, and to contribute to some extent to a "
"technical harmonisation.\n"
"The passim.info web site presents the directory content to the public so that"
" they can find relevant services for any\n"
"place in France, however PASSIM main goal is that its data content be reused "
"by other services and applications.\n"
"\n"
"You may reuse PASSIM in several ways :\n"
"\n"
"* The complete content is available in the [the Passim back-"
"office](http://petitpois.passim.info/)\n"
"* The content is also published in [directory as CSV, KML and SHP "
"files](/acces_donnees)\n"
"* Also, the request can be made via a REST url "
"([example](/territoires/communes/75000-paris) : "
"http://www.passim.info/territoires/communes/75000-paris)\n"
"\n"
"Please [contact us](/contact) for any question or remark.<br>\n"
"Thank you for using PASSIM and thank in advance for your comments!\n"
msgstr ""
#: passim/templates/error-403.mako:9
msgid "Oops! Access denied."
msgstr ""
......@@ -213,7 +177,7 @@ msgid "Last update"
msgstr ""
#: passim/templates/help.mako:12 passim/templates/site.mako:107
#: passim/views/__init__.py:177
#: passim/views/__init__.py:187
msgid "Help"
msgstr ""
......@@ -267,7 +231,7 @@ msgid ""
"You are invited to [ask any question or make any remark](/contact) or to\n"
"[propose a new service to be included](/contribute).<br>\n"
"Also, you are welcome to [reuse PASSIM content in your applications or "
"services](/data).\n"
"services](/reuse).\n"
"\n"
"Thank you for using PASSIM and thanks in advance for your comments!\n"
msgstr ""
......@@ -315,6 +279,42 @@ msgstr ""
msgid "Transport Mode"
msgstr ""
#: passim/templates/reuse.mako:12 passim/templates/site.mako:104
#: passim/views/__init__.py:160
msgid "Reuse"
msgstr ""
#: passim/templates/reuse.mako:14
msgid ""
"PASSIM content is published on\n"
"[the national open data portal](https://www.data.gouv.fr/dataset/passim-"
"annuaire-des-services-d-information-transport)\n"
"under [Etalab Open Licence](http://www.data.gouv.fr/Licence-Ouverte-Open-"
"Licence).\n"
"\n"
"The PASSIM directory was created in 2004 as a means to give to public "
"authorities a global vision on the traveller info\n"
"service landscape and evolutions, and to contribute to some extent to a "
"technical harmonisation.\n"
"The passim.info web site presents the directory content to the public so that"
" they can find relevant services for any\n"
"place in France, however PASSIM main goal is that its data content be reused "
"by other services and applications.\n"
"\n"
"You may reuse PASSIM in several ways :\n"
"\n"
"* The complete content is available in the [the Passim back-"
"office](http://petitpois.passim.info/)\n"
"* The content is also published in [directory as CSV, KML and SHP files"
"](/open-data)\n"
"* Also, the request can be made via a REST url "
"([example](/territoires/communes/75000-paris) : "
"http://www.passim.info/territoires/communes/75000-paris)\n"
"\n"
"Please [contact us](/contact) for any question or remark.<br>\n"
"Thank you for using PASSIM and thank in advance for your comments!\n"
msgstr ""
#: passim/templates/site.mako:9 passim/templates/territories.mako:27
msgid "Search services for whole France"
msgstr ""
......@@ -499,40 +499,36 @@ msgid ""
"agency) public transport offer over a territory and a route planner."
msgstr ""
#: passim/views/__init__.py:61
#: passim/views/__init__.py:56
msgid "Access denied"
msgstr ""
#: passim/views/__init__.py:71
#: passim/views/__init__.py:66
msgid "Page not found"
msgstr ""
#: passim/views/__init__.py:84
msgid "CSV data"
msgstr ""
#: passim/views/__init__.py:108
#: passim/views/__init__.py:97
msgid "Home"
msgstr ""
#: passim/views/__init__.py:124
#: passim/views/__init__.py:113
msgid "Contact PASSIM: [your message subject]"
msgstr ""
#: passim/views/__init__.py:125
#: passim/views/__init__.py:114
msgid ""
"I am [an end-user, a company...]\n"
"\n"
"My message: ..."
msgstr ""
#: passim/views/__init__.py:144
#: passim/views/__init__.py:133
msgid ""
"Contribution to PASSIM : [new Info Service, correction to an existing Info "
"Service...]"
msgstr ""
#: passim/views/__init__.py:145
#: passim/views/__init__.py:134
msgid ""
"Proposed contribution : [new Info Service, correction to an existing Info "
"Service...]\n"
......@@ -558,11 +554,15 @@ msgid ""
"real time info...):"
msgstr ""
#: passim/views/__init__.py:277
#: passim/views/__init__.py:205
msgid "CSV data"
msgstr ""
#: passim/views/__init__.py:273
msgid "Contribution to PASSIM : [{0}]"
msgstr ""
#: passim/views/__init__.py:278
#: passim/views/__init__.py:274
msgid ""
"Your are [an end-user, a company...]\n"
"\n"
......@@ -586,19 +586,19 @@ msgid ""
"Thank you advance for any remarks, questions or suggestions about PASSIM !\n"
msgstr ""
#: passim/views/__init__.py:332
#: passim/views/__init__.py:328
msgid "Not found"
msgstr ""
#: passim/views/__init__.py:384
msgid "Error: "
#: passim/views/__init__.py:380
msgid "API error"
msgstr ""
#: passim/views/__init__.py:387
msgid "API error"
#: passim/views/__init__.py:383
msgid "Error: "
msgstr ""
#: passim/views/__init__.py:517
#: passim/views/__init__.py:511
msgid "Your email has been sent."
msgstr ""
......
This diff is collapsed.
/*
* Etalage-Passim -- Customization of Etalage for Passim
* By: Emmanuel Raviart <eraviart@easter-eggs.com>
*
* Copyright (C) 2011, 2012, 2013 Easter-eggs
* http://gitorious.org/passim/etalage-passim
*
* This file is part of Etalage-Passim.
*
* Etalage-Passim is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Etalage-Passim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var etalagepassim = etalagepassim || {};
etalagepassim.bind = (function ($) {
var $loadingGif;
var isLoaded = false;
function preloadLoadingGif() {
image = new Image();
image.src = etalagepassim.miscUrl + 'please-wait.gif';
image.alt = 'Chargement...';
$loadingGif = $("<span>", {"class": "loading"}).append($(image));
$loadingGif.addClass('loading');
isLoaded = true;
}
function loadingGif() {
if (!isLoaded) {
preloadLoadingGif();
}
$('a.internal').on('click', appendLoadingGif);
$('#search-form').on('submit', appendLoadingGif);
$('#btn-geolocation').on('click', function (e) {
e.preventDefault();
$('#search-form').off('submit', appendLoadingGif);
appendLoadingGif();
});
}
function appendLoadingGif(event) {
$('#search-form .control-group .controls').last().append($loadingGif);
}
return {
loadingGif: loadingGif
};
})(jQuery);
This diff is collapsed.
......@@ -41,7 +41,7 @@ If you think a service description is incomplete, false or should be deleted, pl
page bottom.<br>
You are invited to [ask any question or make any remark](/contact) or to
[propose a new service to be included](/contribute).<br>
Also, you are welcome to [reuse PASSIM content in your applications or services](/data).
Also, you are welcome to [reuse PASSIM content in your applications or services](/reuse).
Thank you for using PASSIM and thanks in advance for your comments!
''')) | n}
......@@ -12,7 +12,7 @@ ${parent.page_header()}
<p>
${_("This map is produced with data updated every day on")}
<br>
<a href="${request.host_url}/acces_donnees">${request.host_url}/acces_donnees</a>
<a href="${request.host_url}/open-data">${request.host_url}/open-data</a>
</p>
<p>
${_(u"Click on a département to display the indicators :")}
......
......@@ -13,7 +13,7 @@ ${parent.page_header()}
${_("Click on the white square in upper right corner and choose the transport type (urban, departmental, regional public transit, flexible on-demand transport, para-transit , school transport, bicycle services, car-sharing, ride-sharing, parking airports, ports...) and see the corresponding offers on the map.")}
<br>
${_("This map is produced with data updated every day on")}
<a href="/acces_donnees">${request.host_url}/acces_donnees</a>.
<a href="/open-data">${request.host_url}/open-data</a>.
</p>
<p>
${_("Initial data loading may be a little slow...")}<br>
......
......@@ -12,7 +12,7 @@ ${parent.page_header()}
<p>
${_("This map is produced with data updated every day on")}
<br>
<a href="/acces_donnees">${request.host_url}/acces_donnees</a>
<a href="/open-data">${request.host_url}/open-data</a>
</p>
<p>
${_(u"Click on a région to display the indicators :")}
......
......@@ -14,7 +14,7 @@ ${parent.page_header()}
<br>
${_("This map is produced with data updated every day on")}
<br>
<a href="${request.host_url}/acces_donnees">${request.host_url}/acces_donnees</a>.
<a href="${request.host_url}/open-data">${request.host_url}/open-data</a>.
</p>
<div id="map"></div>
......
......@@ -23,7 +23,7 @@ place in France, however PASSIM main goal is that its data content be reused by
You may reuse PASSIM in several ways :
* The complete content is available in the [the Passim back-office](http://petitpois.passim.info/)
* The content is also published in [directory as CSV, KML and SHP files](/acces_donnees)
* The content is also published in [directory as CSV, KML and SHP files](/open-data)
* Also, the request can be made via a REST url ([example](/territoires/communes/75000-paris) : http://www.passim.info/territoires/communes/75000-paris)
Please [contact us](/contact) for any question or remark.<br>
......
......@@ -10,7 +10,7 @@ from passim.resources import UsersResource
</%def>\
\
<%def name="csv_rss_button()">
<a class="btn btn-primary btn-sm" href="/acces_donnees" rel="tooltip" title="${_('Download PASSIM data in CSV format')}">CSV Data</a>
<a class="btn btn-primary btn-sm" href="/open-data" rel="tooltip" title="${_('Download PASSIM data in CSV format')}">CSV Data</a>
<a class="btn btn-warning btn-sm" href="${request.route_path('feed')}" target="_blank" title="${_('Atom feed')}"><i class="fa fa-rss"></i></a>
</%def>\
\
......@@ -100,8 +100,8 @@ from passim.resources import UsersResource
<li class="${u'active' if route_name == 'contribute' else u''}">
<a href="${request.route_path('contribute')}">${_('Contribute')}</a>
</li>
<li class="${u'active' if route_name == 'data' else u''}">
<a href="${request.route_path('data')}">${_('Reuse')}</a>
<li class="${u'active' if route_name == 'reuse' else u''}">
<a href="${request.route_path('reuse')}">${_('Reuse')}</a>
</li>
<li class="${u'active' if route_name == 'help' else u''}">
<a href="${request.route_path('help')}">${_('Help')}</a>
......
......@@ -24,17 +24,14 @@
import datetime
import json
import logging
import requests
import smtplib
from passim import captcha
from passim.forms.common import EmailForm
from passim.models import DBSession
from passim.utils import slugify
from pyramid_helpers.forms import Invalid
from pyramid_helpers.forms import validate
from pyramid.httpexceptions import HTTPFound
......@@ -76,12 +73,6 @@ def about(request):
return dict(title=_("About"))
@view_config(route_name='acces_donnees', renderer='/iframe.mako')
def acces_donnees(request):
_ = request.translate
return dict(title=_("CSV data"))
@view_config(route_name='accueil', renderer='/accueil.mako')
def accueil(request):
_ = request.translate
......@@ -163,18 +154,12 @@ Information Service
)
@view_config(route_name='data', renderer='/data.mako')
@view_config(route_name='reuse', renderer='/reuse.mako')
def data(request):
_ = request.translate
return dict(title=_("Reuse"))
@view_config(route_name='help', renderer='/help.mako')
def help(request):
_ = request.translate
return dict(title=_("Help"))
@view_config(route_name='contact-email', renderer='json')
def email_contact(request):
return email(request, 'passim:templates/contact-email.mako')
......@@ -196,6 +181,12 @@ def feed(request):
)
@view_config(route_name='help', renderer='/help.mako')
def help(request):
_ = request.translate
return dict(title=_("Help"))
@view_config(route_name='index')
def index(request):
# Clear session
......@@ -208,6 +199,12 @@ def index(request):
return HTTPFound(location=request.route_path('accueil'))
@view_config(route_name='open-data', renderer='/open-data.mako')
def open_data(request):
_ = request.translate
return dict(title=_("CSV data"))
@view_config(route_name='organisms', renderer='/organisms.mako')
def organisms(request):
_ = request.translate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment