Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QOLDEV-1011] ensure we only fall back to 'c' if parameters are undef… #258

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ckanext/data_qld/templates/datarequests/close.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{#
Handle either old Pylons-style global variables, or newer template parameters.
#}
{% set datasets = datasets or c.datasets %}
{% set datarequest = datarequest or c.datarequest %}
{% set errors = errors or c.errors %}
{% set errors_summary = errors_summary or c.errors_summary %}
{% if datarequest is not defined %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is datarequest the controller of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good indicator of whether we're running a version of ckanext-datarequests that relies on c or uses extra_vars. The other option would be to individually test for the presence of each parameter, but that seems unnecessary when this is a temporary shim.

{% set datarequest = c.datarequest %}
{% set datasets = c.datasets %}
{% set errors = c.errors %}
{% set errors_summary = c.errors_summary %}
{% endif %}

{% block subtitle %}{{ _('Close data request') }}{% endblock %}

Expand Down
7 changes: 5 additions & 2 deletions ckanext/data_qld/templates/datarequests/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
{#
Handle either old Pylons-style global variables, or newer template parameters.
#}
{% set datarequest = datarequest or c.datarequest %}
{% set userobj = userobj or c.userobj %}
{% if datarequest is not defined %}
{% set datarequest = c.datarequest %}
{% set userobj = c.userobj %}
{% endif %}

{% snippet "package/comment_list.html", content_type='datarequest', pkg_id=datarequest.id, pkg_name=datarequest.id, userobj=userobj %}

{% endblock %}
10 changes: 6 additions & 4 deletions ckanext/data_qld/templates/datarequests/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{#
Handle either old Pylons-style global variables, or newer template parameters.
#}
{% set datarequest = datarequest or c.datarequest %}
{% set errors = errors or c.errors %}
{% set errors_summary = errors_summary or c.errors_summary %}
{% set original_title = original_title or c.original_title %}
{% if datarequest is not defined %}
{% set datarequest = c.datarequest %}
{% set errors = c.errors %}
{% set errors_summary = c.errors_summary %}
{% set original_title = c.original_title %}
{% endif %}

{% block subtitle %}{{ _('Edit data request') }}{% endblock %}

Expand Down
8 changes: 5 additions & 3 deletions ckanext/data_qld/templates/datarequests/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
{#
Handle either old Pylons-style global variables, or newer template parameters.
#}
{% set datarequest = datarequest or c.datarequest %}
{% set errors = errors or c.errors %}
{% set errors_summary = errors_summary or c.errors_summary %}
{% if datarequest is not defined %}
{% set datarequest = c.datarequest %}
{% set errors = c.errors %}
{% set errors_summary = c.errors_summary %}
{% endif %}

{% block subtitle %}{{ _('Create data request') }}{% endblock %}

Expand Down
4 changes: 3 additions & 1 deletion ckanext/data_qld/templates/datarequests/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
{#
Handle either old Pylons-style global variables, or newer template parameters.
#}
{% set datarequest = datarequest or c.datarequest %}
{% if datarequest is not defined %}
{% set datarequest = c.datarequest %}
{% endif %}

{% block title %}Data request {{datarequest.get('title', '')}}{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<label class="control-label" for="field-accepted_dataset_id">{{ _("Accepted dataset") }}</label>
<div class="controls">
<select id="field-accepted_dataset_id" name="accepted_dataset_id" data-module="autocomplete">
<option value="" selected="selected">No Dataset</option>
<option value="" selected="selected">No Dataset</option>
{% for dataset in datasets %}
<option value="{{ dataset.get('name') }}">{{ dataset.get('title') }}</option>
{% endfor %}
Expand Down
Loading