forked from I2P_Developers/i2p.www
Support proposal links with number only (ticket #2144)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{%- macro change_lang(lang) -%}
|
{%- macro change_lang(lang) -%}
|
||||||
{%- if request.endpoint == 'site_show' -%}{{ url_for('site_show', lang=lang, page=page) }}
|
{%- if request.endpoint == 'site_show' -%}{{ url_for('site_show', lang=lang, page=page) }}
|
||||||
{%- elif request.endpoint == 'spec_show' -%}{{ url_for('spec_show', name=name) }}
|
{%- elif request.endpoint == 'spec_show' -%}{{ url_for('spec_show', name=name) }}
|
||||||
|
{%- elif request.endpoint == 'proposal_number' -%}{{ url_for('proposal_show', name=name) }}
|
||||||
{%- elif request.endpoint == 'proposal_show' -%}{{ url_for('proposal_show', name=name) }}
|
{%- elif request.endpoint == 'proposal_show' -%}{{ url_for('proposal_show', name=name) }}
|
||||||
{%- elif request.endpoint == 'blog_index' -%}
|
{%- elif request.endpoint == 'blog_index' -%}
|
||||||
{%- if category -%}{{ url_for('blog_index', lang=lang, category=category) }}
|
{%- if category -%}{{ url_for('blog_index', lang=lang, category=category) }}
|
||||||
|
@@ -119,6 +119,14 @@ def proposal_index():
|
|||||||
proposals.sort(key=lambda s: (PROPOSAL_STATUS_SORT[s['status']], s['num']))
|
proposals.sort(key=lambda s: (PROPOSAL_STATUS_SORT[s['status']], s['num']))
|
||||||
return render_template('spec/proposal-index.html', proposals=proposals)
|
return render_template('spec/proposal-index.html', proposals=proposals)
|
||||||
|
|
||||||
|
def proposal_number(number):
|
||||||
|
proposals = get_rsts(PROPOSAL_DIR, proposal_meta)
|
||||||
|
for proposal in proposals:
|
||||||
|
if int(proposal['name'][:3]) == number:
|
||||||
|
return proposal_show(proposal['name'])
|
||||||
|
else:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
def render_rst(directory, name, meta_parser, template):
|
def render_rst(directory, name, meta_parser, template):
|
||||||
# check if that file actually exists
|
# check if that file actually exists
|
||||||
path = safe_join(directory, name + '.rst')
|
path = safe_join(directory, name + '.rst')
|
||||||
|
@@ -48,6 +48,7 @@ url('/spec', 'spec.views.spec_index')
|
|||||||
url('/spec/<string:name>', 'spec.views.spec_show')
|
url('/spec/<string:name>', 'spec.views.spec_show')
|
||||||
url('/spec/<string:name>.txt', 'spec.views.spec_show_txt')
|
url('/spec/<string:name>.txt', 'spec.views.spec_show_txt')
|
||||||
url('/spec/proposals', 'spec.views.proposal_index')
|
url('/spec/proposals', 'spec.views.proposal_index')
|
||||||
|
url('/spec/proposals/<int:number>', 'spec.views.proposal_number')
|
||||||
url('/spec/proposals/<string:name>', 'spec.views.proposal_show')
|
url('/spec/proposals/<string:name>', 'spec.views.proposal_show')
|
||||||
url('/spec/proposals/<string:name>.txt', 'spec.views.proposal_show_txt')
|
url('/spec/proposals/<string:name>.txt', 'spec.views.proposal_show_txt')
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user