From: Alex Sadleir Date: Mon, 23 Sep 2013 23:40:17 +0000 Subject: Move Disqus comments to package not resource page X-Git-Url: https://maxious.lambdacomplex.org/git/?p=ckanext-datagovau.git&a=commitdiff&h=829c316044b3348bf9721cc955c9ead52fdc67bf --- Move Disqus comments to package not resource page --- --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,14 +5,12 @@ - - - + - + @@ -39,7 +37,6 @@ - + @@ -88,7 +86,7 @@ - + @@ -97,25 +95,25 @@ - + - + - + - - + + - + @@ -147,20 +145,21 @@ - @@ -188,7 +187,7 @@ - + @@ -231,20 +230,6 @@ - - - - - - @@ -307,39 +292,39 @@ + + + + + + + + + + + + - - - - - - - - - - - - - - - + @@ -347,10 +332,10 @@ - + + - @@ -367,14 +352,6 @@ - - + + @@ -507,17 +492,17 @@ - - + + - + - + @@ -592,96 +577,68 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + --- a/ckanext/datagovau/plugin.py +++ b/ckanext/datagovau/plugin.py @@ -5,24 +5,25 @@ import ckan.lib.dictization.model_dictize as model_dictize import ckan.plugins.toolkit as tk import ckan.model as model +from pylons import config #parse the activity feed for last active non-system user def get_last_active_user(id): - system_user = "de0ba262-83fe-45e2-adda-41bb9f0c86d8" - user_list = [x for x in lib.helpers.get_action('package_activity_list',{'id':id}) if x['user_id'] != system_user] - user = user_list[0]['user_id'] + system_user = lib.helpers.get_action('user_show',{'id': config.get('ckan.site_id', 'ckan_site_user')}) + user_list = [x for x in lib.helpers.get_action('package_activity_list',{'id':id}) if x['user_id'] != system_user['id']] + user = None + if len(user_list) > 0: + user = user_list[0].get('user_id', None) if user is None: - return lib.helpers.get_action('user_show',{'id':system_user}) + return system_user else: return lib.helpers.get_action('user_show',{'id':user}) # get user created datasets and those they have edited def get_user_datasets(user_dict): created_datasets_list = user_dict['datasets'] - active_datasets_id_list = [x['data']['package'] for x in + active_datasets_list = [x['data']['package'] for x in lib.helpers.get_action('user_activity_list',{'id':user_dict['id']}) if x['data'].get('package')] - active_datasets_list = active_datasets_id_list #if you need more detail, fetch each dataset here - print active_datasets_list return created_datasets_list + active_datasets_list --- a/ckanext/datagovau/templates/package/read.html +++ b/ckanext/datagovau/templates/package/read.html @@ -1,5 +1,11 @@ {% ckan_extends %} +{% block primary_content_inner %} +{{ super() }} +
+ {{ h.disqus_comments() }} +
+{% endblock %} {% block package_additional_info %}