Commit fb38345f76621f8fd8664d82be6ef2b469375bb1
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'stable' of gitlab.com:participa/noosfero into stable
Showing
9 changed files
with
26 additions
and
6 deletions
Show diff stats
app/views/cms/edit.html.erb
1 | 1 | <%= error_messages_for 'article' %> |
2 | 2 | |
3 | -<% show_media_panel = environment.enabled?('media_panel') && [TinyMceArticle, TextileArticle, Event, EnterpriseHomepage].any?{|klass| @article.kind_of?(klass)} %> | |
3 | +<% show_media_panel = environment.enabled?('media_panel') && [TinyMceArticle, TextileArticle, Event, EnterpriseHomepage, ProposalsDiscussionPlugin::Topic, ProposalsDiscussionPlugin::Discussion].any?{|klass| @article.kind_of?(klass)} %> | |
4 | 4 | |
5 | 5 | <div class='<%= (show_media_panel ? 'with_media_panel' : 'no_media_panel') %>'> |
6 | 6 | <%= labelled_form_for 'article', :html => { :multipart => true, :class => @type } do |f| %> | ... | ... |
lib/noosfero/api/entities.rb
lib/noosfero/api/v1/articles.rb
... | ... | @@ -40,8 +40,15 @@ module Noosfero |
40 | 40 | |
41 | 41 | get ':id/children' do |
42 | 42 | article = find_article(environment.articles, params[:id]) |
43 | + | |
44 | + votes_order = params.delete(:order) if params[:order]=='votes_score' | |
43 | 45 | articles = select_filtered_collection_of(article, 'children', params) |
44 | 46 | articles = articles.display_filter(current_person, nil) |
47 | + | |
48 | + if votes_order | |
49 | + articles = articles.joins('left join votes on articles.id=votes.voteable_id').group('articles.id').reorder('sum(coalesce(votes.vote, 0)) DESC') | |
50 | + end | |
51 | + | |
45 | 52 | present articles, :with => Entities::Article, :fields => params[:fields] |
46 | 53 | end |
47 | 54 | ... | ... |
lib/noosfero/api/v1/users.rb
... | ... | @@ -24,11 +24,15 @@ module Noosfero |
24 | 24 | |
25 | 25 | present user, :with => Entities::User |
26 | 26 | end |
27 | - | |
27 | + | |
28 | + get "/me" do | |
29 | + present current_user, :with => Entities::User | |
30 | + end | |
31 | + | |
28 | 32 | get ":id" do |
29 | 33 | present environment.users.find_by_id(params[:id]), :with => Entities::User |
30 | 34 | end |
31 | - | |
35 | + | |
32 | 36 | get ":id/permissions" do |
33 | 37 | user = environment.users.find(params[:id]) |
34 | 38 | output = {} | ... | ... |
plugins/proposals_discussion
public/designs/themes/participa-theme
public/javascripts/application.js
public/proposal-app
test/unit/api/users_test.rb
... | ... | @@ -40,4 +40,10 @@ class UsersTest < ActiveSupport::TestCase |
40 | 40 | assert_includes json["user"]["permissions"], community.identifier |
41 | 41 | end |
42 | 42 | |
43 | + should 'get logged user' do | |
44 | + get "/api/v1/users/me?#{params.to_query}" | |
45 | + json = JSON.parse(last_response.body) | |
46 | + assert_equal user.id, json['user']['id'] | |
47 | + end | |
48 | + | |
43 | 49 | end | ... | ... |