Skip to content

Commit

Permalink
[QOLDEV-1011] use 'g' instead of 'c' to access current user
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrawnCA committed Dec 5, 2024
1 parent 6096408 commit 775ca00
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions ckanext/data_qld/templates/datarequests/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
#}
{% 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 %}
{% snippet "package/comment_list.html", content_type='datarequest', pkg_id=datarequest.id, pkg_name=datarequest.id, userobj=g.userobj %}

{% endblock %}
2 changes: 1 addition & 1 deletion ckanext/data_qld/templates/datarequests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% link_for _('Add data request'), named_route='datarequest.new', class_='btn btn-primary', icon=h.get_plus_icon() %}
</div>
{% endif %}
{% if not c.user %}
{% if not g.user %}
<div class="page_primary_action">
{% link_for _('Login to create data request'), named_route='user.login', class_='btn btn-primary', came_from=h.full_current_url() %}
</div>
Expand Down
10 changes: 5 additions & 5 deletions ckanext/data_qld/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<div class="account-masthead">
<div class="container">
{% block header_account_container_content %} {% if g.userobj %}
<div class="account avatar authed" data-module="me" data-me="{{ c.userobj.id }}">
<div class="account avatar authed" data-module="me" data-me="{{ g.userobj.id }}">
<ul class="unstyled">
{% block header_account_logged %} {% if c.userobj.sysadmin %}
{% block header_account_logged %} {% if g.userobj.sysadmin %}
<li>CKAN {{ h.ckan_version() }}</li>
<li>
<a href="{{ h.url_for('admin.index') }}" title="{{ _('Sysadmin settings') }}">
Expand All @@ -18,9 +18,9 @@
</li>
{% endif %}
<li>
<a href="{{ h.url_for('user.read', id=c.userobj.name) }}" class="image" title="{{ _('View profile') }}">
{{ h.gravatar((c.userobj.email_hash if c and c.userobj else ''), size=22) }}
<span class="username">{{ c.userobj.display_name }}</span>
<a href="{{ h.url_for('user.read', id=g.userobj.name) }}" class="image" title="{{ _('View profile') }}">
{{ h.gravatar((g.userobj.email_hash if g and g.userobj else ''), size=22) }}
<span class="username">{{ g.userobj.display_name }}</span>
</a>
</li>
{% set new_activities = h.new_activities() %}
Expand Down
2 changes: 1 addition & 1 deletion ckanext/data_qld/templates/report/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>{{ report.title }}</h1>
<p>
{{ _('Generated') }}: {{ h.report__render_datetime(report_date, '%d/%m/%Y %H:%M') }}
</p>
{% if c.userobj.sysadmin %}
{% if g.userobj.sysadmin %}
<div class="panel panel-info" style="width=700px">
<div class="panel-heading"><strong>{% trans %}Refresh report{% endtrans %}</strong></div>
<div class="panel-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{%- do exclude_fields.append('governance_acknowledgement') -%}
{%- endif -%}

{% if not h.resource_visibility_has_user_permission_for_org(pkg['owner_org'], c.userobj, 'create_dataset') %}
{% if not h.resource_visibility_has_user_permission_for_org(pkg['owner_org'], g.userobj, 'create_dataset') %}
{%- do exclude_fields.append('request_privacy_assessment') -%}
{%- do exclude_fields.append('privacy_assessment_result') -%}
{% endif %}
Expand Down

0 comments on commit 775ca00

Please sign in to comment.