De-hardcode the button text in page_chooser_panel

This commit is contained in:
Nick Smith 2014-07-07 14:05:34 +01:00
parent 951f8ade47
commit 7fcfff65bf
2 changed files with 6 additions and 9 deletions

View file

@ -1,13 +1,8 @@
{% extends "wagtailadmin/edit_handlers/chooser_panel.html" %}
{% load i18n %}
{% comment %}
TODO: make it possible to specify button labels that are better tuned to the
particular use case: e.g. "Choose an author", "Choose a location"
{% endcomment %}
{% block chosen_state_view %}
<span class="title">{{ page.title }}</span>
{% endblock %}
{% block choose_another_button_label %}{% trans "Choose another page" %}{% endblock %}
{% block choose_button_label %}{% trans "Choose a page" %}{% endblock %}
{% block choose_another_button_label %}{{ choose_another_text_str }}{% endblock %}
{% block choose_button_label %}{{ choose_one_text_str }}{% endblock %}

View file

@ -10,10 +10,12 @@
<legend>{% trans "Editors pick" %}</legend>
<ul class="fields">
<li class="model_choice_field">
{% trans "Choose another page" as choose_another_text_str %}
{% trans "Choose a page" as choose_one_text_str %}
{% if form.instance.page %}
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page page=form.instance.page is_chosen=True only %}
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page page=form.instance.page is_chosen=True choose_one_text_str=choose_one_text_str choose_another_text_str=choose_another_text_str only %}
{% else %}
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page is_chosen=False only %}
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page is_chosen=False choose_one_text_str=choose_one_text_str choose_another_text_str=choose_another_text_str only %}
{% endif %}
</li>
<li class="char_field">