Commit 34e5a00d288ea9300b2e1850aa44f14968ad4a8f
1 parent
409aa3cc
Exists in
colab_tag_merge
Added get_context_data and fixed tag name
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
2 changed files
with
37 additions
and
23 deletions
Show diff stats
colab/plugins/noosfero/static/noosfero/js/colab_integration.js
| ... | ... | @@ -20,12 +20,12 @@ function transform_tags() |
| 20 | 20 | |
| 21 | 21 | function feed_gitlab_tag() |
| 22 | 22 | { |
| 23 | - var $tag = $('#activity-tab'); | |
| 23 | + var $tag = $('#repository-feed-tab'); | |
| 24 | 24 | $tag.text("Esta comunidade não está associada a"+ |
| 25 | 25 | " nenhum repositório no momento, para mais"+ |
| 26 | - " detalhes contacte o administrador"); | |
| 26 | + " detalhes contate o administrador"); | |
| 27 | 27 | $.getJSON(repository, {limit:activities_limit, offset:0},function(msg, e){ |
| 28 | - $tag.html(msg.html); | |
| 28 | + $tag.html(msg.html); | |
| 29 | 29 | }); |
| 30 | 30 | } |
| 31 | 31 | ... | ... |
colab/plugins/noosfero/views.py
| ... | ... | @@ -4,6 +4,7 @@ from django.conf import settings |
| 4 | 4 | from colab.plugins.views import ColabProxyView |
| 5 | 5 | from colab_spb.models import CommunityAssociations |
| 6 | 6 | |
| 7 | + | |
| 7 | 8 | class NoosferoProxyView(ColabProxyView): |
| 8 | 9 | app_label = 'noosfero' |
| 9 | 10 | diazo_theme_template = 'proxy/noosfero.html' |
| ... | ... | @@ -12,23 +13,36 @@ class NoosferoProxyView(ColabProxyView): |
| 12 | 13 | ) |
| 13 | 14 | |
| 14 | 15 | def dispatch(self, 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 | - } | |
| 16 | + return super(NoosferoProxyView, self).dispatch(request, | |
| 17 | + *args, **kwargs) | |
| 18 | + | |
| 19 | + def get_context_data(self, **kwargs): | |
| 20 | + context = super(NoosferoProxyView, self).get_context_data(**kwargs) | |
| 21 | + | |
| 22 | + community = self.get_community_name(self.request.path) | |
| 23 | + | |
| 24 | + if community is "": | |
| 25 | + return | |
| 26 | + | |
| 27 | + associations = CommunityAssociations.objects.all() | |
| 28 | + | |
| 29 | + for community_association in associations: | |
| 30 | + if community_association.community.name in community: | |
| 31 | + context['community_association'] = { | |
| 32 | + 'community': community_association.community.name, | |
| 33 | + 'repository': community_association.group.url, | |
| 34 | + 'mailman_list': community_association.mail_list.name, | |
| 35 | + 'list_limit': 7, | |
| 36 | + 'activities_limit': 7, | |
| 37 | + } | |
| 38 | + return context | |
| 39 | + | |
| 40 | + def get_community_name(self, path): | |
| 41 | + community = "" | |
| 42 | + words = self.request.path.split('/') | |
| 43 | + | |
| 44 | + for index in range(len(words)): | |
| 45 | + if 'profile' in words[index]: | |
| 46 | + community = words[index+1] | |
| 47 | + break | |
| 48 | + return community | ... | ... |