Commit c52d71cfd99180b11111f9aa09b58e20f4e6524e
1 parent
0d2ac9fb
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
plugin boiler plate
Showing
4 changed files
with
41 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
| 1 | +class SerproCaptchaPlugin < Noosfero::Plugin | ||
| 2 | + | ||
| 3 | + def self.plugin_name | ||
| 4 | + _('Dialoga custom plugin') | ||
| 5 | + end | ||
| 6 | + | ||
| 7 | + def self.plugin_description | ||
| 8 | + _("Provide a plugin to dialoga environment.") | ||
| 9 | + end | ||
| 10 | + | ||
| 11 | + def self.api_mount_points | ||
| 12 | + [SerproCaptchaPlugin::API ] | ||
| 13 | + end | ||
| 14 | + | ||
| 15 | +end |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +class SerproCaptchaPlugin::API < Grape::API | ||
| 2 | + | ||
| 3 | + resource :dialoga_plugin do | ||
| 4 | + get 'random_topics/:discussion_id' do | ||
| 5 | + discussion = ProposalsDiscussionPlugin::Discussion.find(params[:discussion_id]) | ||
| 6 | + | ||
| 7 | + # render articles using Entity Article | ||
| 8 | + present discussion.random_topics_one_by_category, :with => Noosfero::API::Entities::Article, :fields => params[:fields] | ||
| 9 | + end | ||
| 10 | + end | ||
| 11 | + | ||
| 12 | +end |
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +require File.dirname(__FILE__) + '/../../../test/test_helper' |