Commit 792973f83fd7c64f49fad02b93c7b67a22e6669f

Authored by Victor Costa
2 parents 0d9dfcfa c282b702

Merge branch 'angular_poc' into staging

lib/noosfero/api/helpers.rb
... ... @@ -114,7 +114,6 @@ require_relative '../../find_by_contents'
114 114 end
115 115 end
116 116  
117   - ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s}
118 117 TASK_TYPES = ['Task'] + Task.descendants.map{|a| a.to_s}
119 118  
120 119 def find_article(articles, id)
... ... @@ -125,8 +124,9 @@ require_relative '../../find_by_contents'
125 124 def post_article(asset, params)
126 125 return forbidden! unless current_person.can_post_content?(asset)
127 126  
128   - klass_type= params[:content_type].nil? ? 'TinyMceArticle' : params[:content_type]
129   - return forbidden! unless ARTICLE_TYPES.include?(klass_type)
  127 + klass_type= params[:content_type].nil? ? TinyMceArticle.name : params[:content_type]
  128 + article_types = ['Article'] + Article.descendants.map{|a| a.to_s}
  129 + return forbidden! unless article_types.include?(klass_type)
130 130  
131 131 article = klass_type.constantize.new(params[:article])
132 132 article.last_changed_by = current_person
... ...
lib/noosfero/api/v1/articles.rb
... ... @@ -260,6 +260,15 @@ module Noosfero
260 260  
261 261 end
262 262  
  263 + resource :profiles do
  264 + get ':id/home_page' do
  265 + profiles = environment.profiles
  266 + profiles = profiles.visible_for_person(current_person)
  267 + profile = profiles.find_by_id(params[:id])
  268 + present_partial profile.home_page, :with => Entities::Article
  269 + end
  270 + end
  271 +
263 272 kinds = %w[profile community person enterprise]
264 273 kinds.each do |kind|
265 274 resource kind.pluralize.to_sym do
... ...