phisch
(Philipp)
2016 年8 月 14 日 11:46
1
Hi,
How modular is Discourse internally? Will it easily be possible to develop a plugin which uses a different approach to discussion for a certain category?
Does Discourse use the MVVM principle or something similar, so that a discussion tree (or network) can be displayed in a different manner than it is now?
Basic example: Show Discussion as a tree rather than a list (this is not what I want to do)
If not, is it planned to achieve more modularity?
erlend_sh
(Erlend Sogge Heggen)
2016 年8 月 14 日 12:17
2
这些问题非常宽泛。你可以通过浏览我们的 Customization > Plugin 目录,看看大家是如何使用它的,从而找到关于“模块化程度”的答案。然后,可以参考以下新手指南:
在 Discourse 中构建插件其实非常简单,只要你了解一些特殊之处。本文的目标是创建一个插件骨架,并向你介绍基础知识。
你的开发环境
请确保你的电脑上已经运行了 Discourse 的开发环境。我建议你使用 相应的设置指南 ,完成后再回来继续阅读。
plugin.rb
使用 GitHub - discourse/discourse-plugin-skeleton: Template for Discourse plugins · GitHub 在你的插件目录中创建一个完整的 Discourse 插件骨架
该骨架现已包含在 Discourse 核心中,运行 rake plugin:create[plugin-name] 即可基于该骨架创建插件。
当 Discourse 启动时,它会在 plugins 目录中查找包含 plugin.rb 文件的子目录。plugin.rb 文件有两个作用:首先,它是插件的清单,包含插件的必需信息,例如名称、联系方式和描述;其次,它用于初始化运行插件所需的任何 Ruby 代码。
在本例中,我们不会添加任何 Rub…
There are a few ‘how to start’ guides for working with Discourse already and a wealth of useful info on meta, but I thought it might help to give an insight to the mental processes of starting from little, if any, prior coding experience to building substantial Discourse plugins.
Discourse is written by experienced developers and has a large codebase. This can feel intimidating. This intimidation factor can be a significant barrier for novice developers. This is a kind of ‘psychological primer’…
Falco
(Falco)
2016 年8 月 15 日 13:35
3
Read the Source, Luke
https://github.com/discourse/discourse
PS: Discourse is an Ember app powered by a Rest API, so yes.