Commit 409aa3cccfc4cb6f6597b20f1eee8743c6fb823e
1 parent
0711ae06
Exists in
colab_tag_merge
Added CommunityAssociation in Noosfero
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
2 changed files
with
24 additions
and
16 deletions
Show diff stats
colab/plugins/noosfero/static/noosfero/js/colab_integration.js
| ... | ... | @@ -20,7 +20,7 @@ function transform_tags() |
| 20 | 20 | |
| 21 | 21 | function feed_gitlab_tag() |
| 22 | 22 | { |
| 23 | - var $tag = $('.software-community-feed_repository'); | |
| 23 | + var $tag = $('#activity-tab'); | |
| 24 | 24 | $tag.text("Esta comunidade não está associada a"+ |
| 25 | 25 | " nenhum repositório no momento, para mais"+ |
| 26 | 26 | " detalhes contacte o administrador"); |
| ... | ... | @@ -31,9 +31,9 @@ function feed_gitlab_tag() |
| 31 | 31 | |
| 32 | 32 | function discussion_tag() |
| 33 | 33 | { |
| 34 | - var $tag = $('.software-community-discussion'); | |
| 34 | + var $tag = $('#discussions-tab'); | |
| 35 | 35 | var request_path = '/spb/get_list/'+ |
| 36 | 36 | '?list_name='+mailman_list+ |
| 37 | 37 | '&MAX='+list_limit; |
| 38 | 38 | $tag.load(request_path); |
| 39 | -} | |
| 40 | 39 | \ No newline at end of file |
| 40 | +} | ... | ... |
colab/plugins/noosfero/views.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | from django.conf import settings |
| 3 | 3 | |
| 4 | 4 | from colab.plugins.views import ColabProxyView |
| 5 | - | |
| 5 | +from colab_spb.models import CommunityAssociations | |
| 6 | 6 | |
| 7 | 7 | class NoosferoProxyView(ColabProxyView): |
| 8 | 8 | app_label = 'noosfero' |
| ... | ... | @@ -11,16 +11,24 @@ class NoosferoProxyView(ColabProxyView): |
| 11 | 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 | 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 | + } | ... | ... |