Ardour Digital - Specialists in development, consultancy, and training for Telligent community and ASP.NET application development

Github Gist's provide a simple way for storing and sharing code snippets linked to your GitHub account.

Gist's can be embedded in web pages, using the embed code in the right hand column - this requires a Javascript snippet to be placed on the page where the Gist should appear. Telligent Community removes any script added into user content to stop users running any scripts that may be dangerous. One easy way to get around this problem is to implement a IFileViewer plugin that will create the script for the user when a post is viewed.

UPDATE: This plugin is now available on GitHub/Nuget - see the GitHub project page for more information.

The code for this can be seen in the Gist embedded below!

This class will require references to the Telligent.Evolution.Components DLL.

If you compile this code and add the DLL to your community website you will see a new "GitHub Gist File Viewer" plugin on the Manage Plugins page  (Control Panel > Site Administration > Manage Plugins). Enable this users will then be able to embed Gist's using the Insert/Edit Media option in the Rich Text Editor:

If you are using the default Social theme you may see a line under each line of code in the gist, to remove this add the following to the "Custom Style Sheet" for the theme (Control Panel > Site Administration > Site Content > Site Theme > Custom Styles):


Comments

Silviu

Hello, if I create my own plugin with the source code that you provided, I am able to see and enable the plugin but once I try to insert a Gist editor link it would not convert it. what should I do?

  • Silviu
  • June 07, 2017

Rhys Godfrey

Hi Silviu

- What version of Telligent are you using?

- What do you see when you insert the link as shown above - the rich text editor will only show a placeholder, the Gist itself won't be shown until it's posted (this is the wwww.rhysgodfrey.co.uk/.../embeding-gist-in-telligent-community the Telligent editor works)

  • Rhys Godfrey
  • June 07, 2017

Silviu

Hi Rhys,

Thanks for helping out, so I'm using version 9.1. Instead of the gist editor there's a placeholder with the title and link to the gist file from my github account. The post does not change anything.

  • Silviu
  • June 09, 2017

Rhys Godfrey

Hi Silvu,

Should work with 9.1, have you tried the pre-built version on nuget/on GitHub (github.com/.../ArdourDigital.TelligentCommunity.Gists)

Can you send me some screenshots of what your seeing (rhys@rhysgodfrey.co.uk).

Do you see any errors in the exception log, or when using the developer tools in your browser?

  • Rhys Godfrey
  • June 11, 2017

Silviu

Hi Rhys,

If you don't mind I took the liberty to write to you on your  personal email so I that  I can send some screenshots as well.

  • Silviu
  • June 12, 2017


Leave a Comment