{ "info": { "author": "abidibo", "author_email": "abidibo@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development" ], "description": "# django-resckeditor\n\nThis is a django app which provides and infrastructure you can use to include custom contents of other apps directly inside ckeditor.\n\nIt requires [django-ckeditor](https://github.com/django-ckeditor/django-ckeditor)\n\nIt defines a custom CKEDITOR plugin which implements two dialog tabs: the first to select the resource, and the second to dynamically set options.\n\n**Full documentation**: [https://django-resckeditor.readthedocs.io/en/latest/](https://django-resckeditor.readthedocs.io/en/latest/)\n\n\n\n\n## Getting Started\n\nInstall django-resckeditor:\n\n $ pip install django-resckeditor\n\nAdd resckeditor to your installed apps:\n\n INSTALLED_APPS = (\n # ...\n 'ckeditor',\n 'ckeditor_uploader',\n 'resckeditor',\n # ...\n )\n\nadd the urls in your core application:\n\n urlpatterns = [\n # ...\n url(r'^resckeditor/', include('resckeditor.urls', namespace='resckeditor')),\n ]\n\n**N.B.** do not change the **resckeditor** path, since it is hardcoded in the js code.\n\nAdd the resource and ajax plugins to your ckeditor instance:\n\n CKEDITOR_CONFIGS = {\n 'default': {\n 'skin': 'moono',\n 'toolbar_Full': [\n // ..\n ['Res'/*, ...*/],\n // ..\n ],\n 'toolbar': 'Full',\n // ...\n 'extraPlugins': 'ajax,resource',\n }\n }\n\nDefine functions export resources for ckeditor, so for example in your settings:\n\n RESCKEDITOR_CONFIG = {\n 'RESOURCES': [\n {\n 'list': 'path.to.module.func.defining.resources',\n 'output': 'path.to.module.func.returning.html',\n 'label': 'My group of widgets'\n },\n ]\n }\n\n\nThe `list` function is invoked without arguments and should return a dictionary defining all the available resources\n(i.e. all the news we want to export) and the available options:\n\n def my_list_function():\n res = []\n for n in News.objects.published():\n res.append({\n 'label': n.title,\n 'id': n.id\n })\n return {\n 'resources': res,\n 'options': [\n {\n 'type': 'text',\n 'name': 'news-dialog-options-section-title',\n 'label': 'Last News',\n 'default': ''\n },\n {\n 'type': 'checkbox',\n 'name': 'news-dialog-options-show-title',\n 'label': 'Show title',\n 'default': True\n },\n {\n 'type': 'number',\n 'name': 'news-dialog-options-num-chars',\n 'label': 'Number of chars',\n 'default': 50\n },\n {\n 'type': 'select',\n 'name': 'news-dialog-options-layout',\n 'label': 'Layout',\n 'data': [\n {'label': 'one row', 'value': 'row'},\n {'label': 'two columns', 'value': 'col-2'},\n {'label': 'three columns', 'value': 'col-3'},\n {'label': 'four columns', 'value': 'col-4'},\n ]\n }\n ]\n\n }\n\nThe `output` function will receive the id of the resource selected and a dictionary containing the provided options.\nIt should return the html output of the resource.\n\n def my_output_function(id, options):\n n = News.objects.get(pk=id)\n return '