Commit 409aa3cccfc4cb6f6597b20f1eee8743c6fb823e

Authored by Macartur Sousa
1 parent 0711ae06
Exists in colab_tag_merge

Added CommunityAssociation in Noosfero

Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
colab/plugins/noosfero/static/noosfero/js/colab_integration.js
@@ -20,7 +20,7 @@ function transform_tags() @@ -20,7 +20,7 @@ function transform_tags()
20 20
21 function feed_gitlab_tag() 21 function feed_gitlab_tag()
22 { 22 {
23 - var $tag = $('.software-community-feed_repository'); 23 + var $tag = $('#activity-tab');
24 $tag.text("Esta comunidade não está associada a"+ 24 $tag.text("Esta comunidade não está associada a"+
25 " nenhum repositório no momento, para mais"+ 25 " nenhum repositório no momento, para mais"+
26 " detalhes contacte o administrador"); 26 " detalhes contacte o administrador");
@@ -31,9 +31,9 @@ function feed_gitlab_tag() @@ -31,9 +31,9 @@ function feed_gitlab_tag()
31 31
32 function discussion_tag() 32 function discussion_tag()
33 { 33 {
34 - var $tag = $('.software-community-discussion'); 34 + var $tag = $('#discussions-tab');
35 var request_path = '/spb/get_list/'+ 35 var request_path = '/spb/get_list/'+
36 '?list_name='+mailman_list+ 36 '?list_name='+mailman_list+
37 '&MAX='+list_limit; 37 '&MAX='+list_limit;
38 $tag.load(request_path); 38 $tag.load(request_path);
39 -}  
40 \ No newline at end of file 39 \ No newline at end of file
  40 +}
colab/plugins/noosfero/views.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 from django.conf import settings 2 from django.conf import settings
3 3
4 from colab.plugins.views import ColabProxyView 4 from colab.plugins.views import ColabProxyView
5 - 5 +from colab_spb.models import CommunityAssociations
6 6
7 class NoosferoProxyView(ColabProxyView): 7 class NoosferoProxyView(ColabProxyView):
8 app_label = 'noosfero' 8 app_label = 'noosfero'
@@ -11,16 +11,24 @@ class NoosferoProxyView(ColabProxyView): @@ -11,16 +11,24 @@ class NoosferoProxyView(ColabProxyView):
11 ('^/social/account/login(.*)$', r'{}\1'.format(settings.LOGIN_URL)), 11 ('^/social/account/login(.*)$', r'{}\1'.format(settings.LOGIN_URL)),
12 ) 12 )
13 13
14 - def get_context_data(self, **kwargs):  
15 - context = super(NoosferoProxyView, self).get_context_data(**kwargs)  
16 - context['community_association'] = {  
17 - 'community':'e-sic-livre',  
18 - 'repository':'/gitlab/software-publico',  
19 - 'mailman_list':'lista',  
20 - 'list_limit':7,  
21 - 'activities_limit':7,  
22 - }  
23 - return context  
24 -  
25 def dispatch(self, request, *args, **kwargs): 14 def dispatch(self, request, *args, **kwargs):
26 - return super(NoosferoProxyView, self).dispatch(request, *args, **kwargs) 15 + return super(NoosferoProxyView, self).dispatch(request,
  16 + *args, **kwargs)
  17 +
  18 + def set_current_community_association(self, context):
  19 + community = self.request.path.split('/')[2]
  20 +
  21 + if not community:
  22 + return
  23 +
  24 + associations = CommunityAssociations.objects.all()
  25 +
  26 + for community_association in associations:
  27 + if community_association.community.name in community:
  28 + context['community_association'] = {
  29 + 'community': community_association.community.name,
  30 + 'repository': community_association.group.url,
  31 + 'mailman_list': community_association.mail_list.name,
  32 + 'list_limit': 7,
  33 + 'activities_limit': 7,
  34 + }