Code Monkey home page Code Monkey logo

ckanext-discourse's Introduction

How it works

A new topic is created in the Discourse forum (in a designated Category) for each dataset, organization, and group in the CKAN site. This will happen automatically the first time someone visits the CKAN dataset, org and group page and starts a discussion. Topic reply counts are also displayed in the appropriate listing pages.

This plugin also supports ckanext-datarequests and ckanext-showcase.

Setup Discourse

  1. Install Discourse (v1.6+)

    The recommended way is to use the official Docker image following these instructions.

    Also make sure to set up Discourse email integration properly before proceeding as its required for account creation and notification.

  2. Create a new Discourse user. This will be the user that will create the topics on Discourse for each CKAN entity that has commenting support (currently, commenting is supported on Dataset packages, Organizations, Groups, Showcase Items, Dataset requests).

To create a new user, go to "Admin" > "Users" > "Send Invites" and enter an email address. You may want to name the user so that its plainly evident its a bot (e.g. databot). After creating the bot user, be sure to verify its email so it can post.

  1. Create a new Discourse Category. This will contain all topics created for each CKAN dataset. To do so, go to the homepage and click on "Categories" > "New Category". Enter a name and optionally the slug for your category (e.g. Open Data Talk). After creating a Category, go to the Category page and take note of the URL. You will need this to setup ckanext-discourse.

  2. Configure Embbedding. Go to "Admin" > "Customize" > "Embedding". You must fill up the following fields:

    • Allowed Hosts: Add the domain (without the http:// bit) of your CKAN instance (e.g. data.myorg.com)
    • Post to Category: Name of the category that you created on step 3 (e.g. Open Data Portal Datasets)
    • Embedding Settings: Username for topic creation: Name of the user that you created on step 2 (e.g. databot)
    • Crawler Settings:
      • CSS selector for elements that are allowed in embeds - ".module-content"
      • CSS selector for elements that are removed from embeds - ".ckanext-showcase-launch, .discourse-content, .social, .nums, .follow_button"
  3. Configure Oneboxing. Go to "Admin" > "Settings" > "Onebox". Oneboxing allows users to create a Onebox preview from CKAN URLs. To create a CKAN onebox in Discourse, just insert a CKAN URL in its own line and one will be created automatically.

Setup CKAN

  1. Install ckanext-discourse.

     . /usr/lib/ckan/default/bin/activate
     cd /usr/lib/ckan/default/src
     git clone https://github.com/jqnatividad/ckanext-discourse
     cd ckanext-discourse
     python setup.py develop
    
  2. Add the discourse plugin to the enabled plugins on your ini file:

     ckan.plugins = ... discourse
    

    If discourse embedding is desired for ckanext-showcase and ckanext-datarequests, be sure to add the discourse plugin before those plugins (i.e. ckan.plugins = ... discourse showcase datarequests), so it can properly extend their HTML templates with the required discourse embed code.

  3. Add the following options as well:

     discourse.url = http://datatalk.myorg.com
     discourse.username = databot
     discourse.ckan_category = c/open-data-talk
     discourse_count_cache_age = 60
     discourse.debug = false
    

    discourse.url: the url of your Discourse instance. Be sure to specify the full url. https is supported.

    discourse.username: the discourse username created earlier.

    discourse.ckan_category: appended to the discourse.url to get the full URL of the discourse category JSON. In this example, the webpage for the Discourse CKAN category is http://datatalk.myorg.com/c/open-data-talk. The plugin automatically adds the ".json" file suffix (i.e. http://datatalk.myorg.com/c/open-data-talk.json) to get the JSON file required to talk to the Discourse API.

    discourse_count_cache_age: how often to talk to the the Discourse API in seconds.

    discourse.debug: instead of inserting the JS code to embed a Discourse topic, debugging information is displayed instead. This is useful when troubleshooting, as a misconfigured plugin will "spam" your discourse instance with topics that may annoy your users with false-positive discourse notifications.

Extending the discourse integration

The discourse plugin provides a plugin interface called IDiscourse, which enables other extensions to extend the discourse integration. Currently only one method is available:

ckanext-discourse's People

Contributors

amercader avatar aykutsimseks avatar jqnatividad avatar tschortsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ckanext-discourse's Issues

ckan discourse extension example

Hi Team,
Can you provide any example for ckan-discourse extension. I have setup a discourse server and installed ckan extension on ckan server. But I not able to see any changes on my ckan server. I want to know how does the commenting look like and what issue can be for me not able to see the comments on my ckan server

Any chance you could share some screenshots?

It would be really helpful to see how the integration between the two apps looks for the end user. How is the forum topic linked from data set?
How is the data set linked from the forum?

Cheers!

Add Debug setting

preventing ckanext-discourse from actually creating a discourse topic in the associated discourse instance. Instead, it will just display debug data in the iframe.

This should help avoid spam in the associated discourse instance when troubleshooting discourse integration.

Do not attempt to create topics for private datasets

Otherwise, ckanext-discourse will fail to create the topic properly in the associated Discourse instance.

Right now, when a private dataset is created in CKAN, the created Discourse topic links to the CKAN login screen, since Discourse is attempting to authenticate access to the private dataset.

Make discourse.ckan_category parameter smarter

Right now, its only the HTML fragment needed to pull the Discourse JSON of a category, which is then appended to discourse.url to get the fully qualified URL of the category json, e.g.

discourse.url = https://talk.beta.nyc/
discourse.ckan_category = c/data/community-data.json

https://talk.beta.nyc/c/data/community-data.json

It should just be the human-readable name of the category, i.e.

discourse.url = https://talk.beta.nyc/
discourse.ckan_category = Community Data

cc @amercader

CORS-like issue, blocks posting topic to discourse

I have followed the instructions on the readme, and currently, I have the Discourse iframe being partly loaded on CKAN. It says 'loading discussion' with my Discourse site logo displayed, then there's a 10 second pause, the message changes to say 'error embedding'.
And the following error appears in Chrome dev console:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://discourse-site') does not match the recipient window's origin ('https://ckan-site').

Note that I have SSL enabled on both CKAN and Discourse.

Add handling for private datasets

Discussions on private datasets should be supported. While datasets are being reviewed internally, it can be argued that internal folks need to have a place to have those discussions before a dataset release.

This could be done by creating a separate private Discourse category to which private dataset discussions are posted.

An added bonus of this approach is that once a dataset is released, a separate topic post-release is created to which the private discussions pre-release can link to.

Group/organization blacklist

Create a blacklist that ckanext-discourse will ignore. This is good for testing and for excluding datasets where discourse commenting is not required.

KeyError with discourse

CKAN 2.41
psql (PostgreSQL) 9.1.19
Standard source deployment

I recieve the following error after running $python setup.py

[Sun Nov 22 22:35:14 2015] [error] Traceback (most recent call last):
[Sun Nov 22 22:35:14 2015] [error] File "/usr/lib/python2.7/site.py", line 157, in addpackage
[Sun Nov 22 22:35:14 2015] [error] exec line
[Sun Nov 22 22:35:14 2015] [error] File "", line 1, in
[Sun Nov 22 22:35:14 2015] [error] KeyError: 'ckanext'
[Sun Nov 22 22:35:14 2015] [error]
[Sun Nov 22 22:35:14 2015] [error] Remainder of file ignored

Add ckanext-pages support

So users can also create topics on custom pages.

To indicate that a custom page should allow Discourse commenting, the CKAN administrator adds the following snippet (e.g. ">>DISCOURSE<<"??? ) to the markdown text of the page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.