Commit eb1d516f814eedc82f3d5d310fa86eaf62662e3d
0 parents
Exists in
master
Initial commit
Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
Showing
3 changed files
with
42 additions
and
0 deletions
Show diff stats
| 1 | +++ a/controllers/colab_integration_plugin_controller.rb | ||
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +class ColabIntegrationPluginController < ApplicationController | ||
| 2 | + def index | ||
| 3 | + { | ||
| 4 | + "total" => environment.profiles.count, | ||
| 5 | + "profiles" => [ | ||
| 6 | + environment.profiles.each do |profile| | ||
| 7 | + profile.attr_to_json | ||
| 8 | + end | ||
| 9 | + ] | ||
| 10 | + }.to_json | ||
| 11 | + end | ||
| 12 | +end | ||
| 0 | \ No newline at end of file | 13 | \ No newline at end of file |
| 1 | +++ a/lib/colab_integration_plugin.rb | ||
| @@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
| 1 | +class ColabIntegrationPlugin < Noosfero::Plugin | ||
| 2 | + | ||
| 3 | + def self.plugin_name | ||
| 4 | + "Colab Integration Plugin" | ||
| 5 | + end | ||
| 6 | + | ||
| 7 | + def self.plugin_description | ||
| 8 | + _("A plugin that offers noosfero's data for Colab Integration.") | ||
| 9 | + end | ||
| 10 | +end |
| 1 | +++ a/lib/ext/profile.rb | ||
| @@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
| 1 | +require_dependency 'profile' | ||
| 2 | + | ||
| 3 | +class Profile | ||
| 4 | + def attr_to_json | ||
| 5 | + { | ||
| 6 | + "type" => "#{self.type}", | ||
| 7 | + "data" => { | ||
| 8 | + "id" => "#{self.id}", | ||
| 9 | + "identifier" => "#{self.identifier}", | ||
| 10 | + "name" => "#{self.name}", | ||
| 11 | + "description" => "#{self.description}" | ||
| 12 | + }, | ||
| 13 | + # "articles" => [ | ||
| 14 | + # self.articles.each do |article| | ||
| 15 | + # { article.attr_to_json } | ||
| 16 | + # end | ||
| 17 | + # ] | ||
| 18 | + }.to_json | ||
| 19 | + end | ||
| 20 | +end |