Skip to content

Commit

Permalink
Revert "Add group name to global variables accessible from templates"
Browse files Browse the repository at this point in the history
This reverts commit 97f28cb.
  • Loading branch information
keita-yasuda committed May 8, 2024
1 parent 97f28cb commit 2cca3b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 59 deletions.
8 changes: 1 addition & 7 deletions ckanext/feedback/controllers/management.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ckan.common import _, current_user, g, request
from ckan.common import _, current_user, request
from ckan.lib import helpers
from ckan.plugins import toolkit
from flask import redirect, url_for
Expand All @@ -20,7 +20,6 @@ class ManagementController:
def comments():
tab = request.args.get('tab', 'utilization-comments')
categories = utilization_detail_service.get_utilization_comment_categories()
g.pkg_dict = {}

# If user is organization admin
if not current_user.sysadmin:
Expand All @@ -33,11 +32,6 @@ def comments():
utilization_comments = utilization_detail_service.get_utilization_comments(
owner_orgs=ids
)
g.pkg_dict = {
'organization': {
'name': current_user.get_groups(group_type='organization')[0].name,
}
}
else:
resource_comments = resource_comment_service.get_resource_comments()
utilization_comments = utilization_detail_service.get_utilization_comments()
Expand Down
7 changes: 1 addition & 6 deletions ckanext/feedback/controllers/resource.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ckan.model as model
from ckan.common import _, current_user, g, request
from ckan.common import _, current_user, request
from ckan.lib import helpers
from ckan.logic import get_action
from ckan.plugins import toolkit
Expand Down Expand Up @@ -36,11 +36,6 @@ def comment(resource_id):
cookie = comment_service.get_cookie(resource_id)
context = {'model': model, 'session': session, 'for_view': True}
package = get_action('package_show')(context, {'id': resource.package_id})
g.pkg_dict = {
'organization': {
'name': resource.package.get_groups(group_type='organization')[0].name
}
}

return toolkit.render(
'resource/comment.html',
Expand Down
47 changes: 1 addition & 46 deletions ckanext/feedback/controllers/utilization.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ckan.model as model
from ckan.common import _, current_user, g, request
from ckan.common import _, current_user, request
from ckan.lib import helpers
from ckan.logic import get_action
from ckan.plugins import toolkit
Expand Down Expand Up @@ -48,31 +48,6 @@ def search():
id, keyword, approval, admin_owner_orgs, org_name
)

g.pkg_dict = {}
if not org_name == '':
g.pkg_dict = {
'organization': {
'name': org_name,
}
}
elif not id == '':
resource = registration_service.get_resource(id)
package = model.Package.get(id)
if resource:
g.pkg_dict = {
'organization': {
'name': resource.package.get_groups(group_type='organization')[
0
].name
}
}
elif package:
g.pkg_dict = {
'organization': {
'name': package.get_groups(group_type='organization')[0].name
}
}

return toolkit.render(
'utilization/search.html',
{
Expand All @@ -90,11 +65,6 @@ def new():
resource = registration_service.get_resource(resource_id)
context = {'model': model, 'session': session, 'for_view': True}
package = get_action('package_show')(context, {'id': resource.package.id})
g.pkg_dict = {
'organization': {
'name': resource.package.get_groups(group_type='organization')[0].name
}
}

return toolkit.render(
'utilization/new.html',
Expand Down Expand Up @@ -150,13 +120,6 @@ def details(utilization_id):
comments = detail_service.get_utilization_comments(utilization_id, approval)
categories = detail_service.get_utilization_comment_categories()
issue_resolutions = detail_service.get_issue_resolutions(utilization_id)
g.pkg_dict = {
'organization': {
'name': registration_service.get_resource(utilization.resource_id)
.package.get_groups(group_type='organization')[0]
.name
}
}

return toolkit.render(
'utilization/details.html',
Expand Down Expand Up @@ -222,14 +185,6 @@ def edit(utilization_id):
resource_details = edit_service.get_resource_details(
utilization_details.resource_id
)
utilization = detail_service.get_utilization(utilization_id)
g.pkg_dict = {
'organization': {
'name': registration_service.get_resource(utilization.resource_id)
.package.get_groups(group_type='organization')[0]
.name
}
}

return toolkit.render(
'utilization/edit.html',
Expand Down

0 comments on commit 2cca3b0

Please sign in to comment.