Commit a98dc763d17dbf2b852868c787b0ed13fe0c3607
Committed by
Gust
1 parent
8d0e0f11
Exists in
master
and in
4 other branches
Removing gitlab plugin folder
Showing
6 changed files
with
0 additions
and
158 deletions
Show diff stats
colab/plugins/gitlab/__init__.py
... | ... | @@ -1,8 +0,0 @@ |
1 | - | |
2 | - | |
3 | -default_app_config = 'colab.plugins.gitlab.apps.ProxyGitlabAppConfig' | |
4 | - | |
5 | -from colab.plugins.utils.widget_manager import WidgetManager | |
6 | -from colab.plugins.gitlab.widgets import GitlabProfileWidget | |
7 | - | |
8 | -WidgetManager.register_widget('profile', GitlabProfileWidget()) |
colab/plugins/gitlab/profile/diazo.xml
... | ... | @@ -1,36 +0,0 @@ |
1 | -<rules | |
2 | - xmlns="http://namespaces.plone.org/diazo" | |
3 | - xmlns:css="http://namespaces.plone.org/diazo/css" | |
4 | - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
5 | - | |
6 | - <xsl:variable name="username" select="str:replace(//a/@href[(contains(., '/gitlab/u/'))], '/gitlab/u/', '')" /> | |
7 | - <xsl:template match="a/@href[(contains(., '/profile/'))]"> | |
8 | - <xsl:attribute name="href">/account/<xsl:value-of select="$username"/>/edit?code=<xsl:value-of select="."/>/</xsl:attribute> | |
9 | - </xsl:template> | |
10 | - <xsl:template match="form/@action[(contains(., '/gitlab/'))]"> | |
11 | - <xsl:attribute name="action">/account/<xsl:value-of select="$username"/>/edit?code=<xsl:value-of select="."/>/</xsl:attribute> | |
12 | - </xsl:template> | |
13 | - | |
14 | - <!-- Drop colab stuff --> | |
15 | - <drop css:theme="nav.navbar-fixed-top" /> | |
16 | - <drop css:theme="div.footer" /> | |
17 | - | |
18 | - <!-- Drop unused tabs on gitlab --> | |
19 | - <drop content="div[@class='container']/ul/li[1]" /> | |
20 | - <drop content="div[@class='container']/ul/li[3]" /> | |
21 | - <drop content="div[@class='container']/ul/li[4]" /> | |
22 | - <drop content="div[@class='container']/ul/li[7]" /> | |
23 | - <drop content="fieldset[@class='update-username']" /> | |
24 | - | |
25 | - <before theme-children="/html/head" content-children="/html/head" /> | |
26 | - <before css:theme-children="#main-content" css:content-children="body" /> | |
27 | - | |
28 | - <merge attributes="class" css:theme="body" css:content="body" /> | |
29 | - | |
30 | - <!-- Add gitlab properties --> | |
31 | - <merge attributes="data-page" css:theme="body" css:content="body" /> | |
32 | - <merge attributes="data-project-id" css:theme="body" css:content="body" /> | |
33 | - | |
34 | - <drop css:content="#top-panel" /> | |
35 | - <drop css:content=".navbar-gitlab" /> | |
36 | -</rules> |
colab/plugins/gitlab/templates/proxy/gitlab_profile.html
... | ... | @@ -1,49 +0,0 @@ |
1 | - | |
2 | -{% load static from staticfiles %} | |
3 | - | |
4 | -{% block head_css %} | |
5 | -<style> | |
6 | - /* Reset left and with for .modal-dialog style (like gitlab does), | |
7 | - the bootstrap.css one makes it small */ | |
8 | - @media screen and (min-width: 768px) { | |
9 | - .modal-dialog { | |
10 | - left: auto; | |
11 | - width: auto; | |
12 | - } | |
13 | - } | |
14 | - | |
15 | - div#main-content div.container { | |
16 | - width: 1110px; | |
17 | - } | |
18 | - div#main-content div.flash-container{ | |
19 | - width: 85%; | |
20 | - } | |
21 | - #breadcrumbs { | |
22 | - border: 0 !important; | |
23 | - } | |
24 | - | |
25 | - #right-top-nav { | |
26 | - margin-right: 5em !important; | |
27 | - } | |
28 | -</style> | |
29 | -{% endblock %} | |
30 | - | |
31 | -{% block head_js %} | |
32 | -<script>jQuery.noConflict();</script> | |
33 | -{% endblock %} | |
34 | - | |
35 | -<div id="main-content"></div> | |
36 | -<script type="text/javascript"> | |
37 | - jQuery(function(){ | |
38 | - // bootstrap.css forces .hide {display:none!important}, and this makes | |
39 | - // gitlab .hide elements NEVER have a display:block, so | |
40 | - // instead of editing bootstrap.css, we just removed '.hide' css class and | |
41 | - // toggled | |
42 | - jQuery('.hide').removeClass('hide').css('display', 'none'); | |
43 | - }); | |
44 | - | |
45 | - // Extremelly ugly solutions to add Colab's CSRF token to Gitlab forms | |
46 | - // add CSRF token to HTTP header*** | |
47 | - jQuery('div#code form').append(jQuery("input[name='csrfmiddlewaretoken']")); | |
48 | - $('a.delete-key').attr('data-method', 'delete\" type=\"hidden\" /> <input name=\"csrfmiddlewaretoken\" value=\"' + jQuery("input[name='csrfmiddlewaretoken']").val()); | |
49 | -</script> |
colab/plugins/gitlab/urls.py
colab/plugins/gitlab/views.py
... | ... | @@ -1,22 +0,0 @@ |
1 | - | |
2 | -from ..utils.views import ColabProxyView | |
3 | -import os, sys | |
4 | - | |
5 | - | |
6 | -class GitlabProxyView(ColabProxyView): | |
7 | - app_label = 'gitlab' | |
8 | - diazo_theme_template = 'proxy/gitlab.html' | |
9 | - | |
10 | - | |
11 | -class GitlabProfileProxyView(ColabProxyView): | |
12 | - app_label = 'gitlab' | |
13 | - diazo_theme_template = 'proxy/gitlab_profile.html' | |
14 | - | |
15 | - @property | |
16 | - def diazo_rules(self): | |
17 | - child_class_file = sys.modules[self.__module__].__file__ | |
18 | - app_path = os.path.abspath(os.path.dirname(child_class_file)) | |
19 | - diazo_path = os.path.join(app_path, 'profile/diazo.xml') | |
20 | - | |
21 | - self.log.debug("diazo_rules: %s", diazo_path) | |
22 | - return diazo_path |
colab/plugins/gitlab/widgets.py
... | ... | @@ -1,35 +0,0 @@ |
1 | -from colab.plugins.gitlab.views import GitlabProxyView, GitlabProfileProxyView | |
2 | -from colab.plugins.utils.widget_manager import Widget | |
3 | -from django.utils.safestring import mark_safe | |
4 | - | |
5 | - | |
6 | -class GitlabProfileWidget(GitlabProxyView, Widget): | |
7 | - identifier = 'code' | |
8 | - name = 'Gitlab Profile' | |
9 | - default_url = '/gitlab/profile/account' | |
10 | - | |
11 | - def get_body(self): | |
12 | - start = self.content.find('<body') | |
13 | - start = self.content.find('>', start) | |
14 | - end = self.content.find('</body>') | |
15 | - print "start = " + str(start) + ", end = " + str(end) | |
16 | - print "content = " + self.content | |
17 | - | |
18 | - if -1 in [start, end]: | |
19 | - return '' | |
20 | - | |
21 | - body = self.content[start + len('>'):end] | |
22 | - return mark_safe(body) | |
23 | - | |
24 | - def generate_content(self, request): | |
25 | - requested_url = request.GET.get('code', self.default_url) | |
26 | - g = GitlabProfileProxyView() | |
27 | - r = g.dispatch(request, requested_url) | |
28 | - | |
29 | - if r.status_code == 302: | |
30 | - location = r.get('Location') | |
31 | - requested_url = location[location.find('/{}/'.format(self.app_label)):] | |
32 | - request.method = 'GET' | |
33 | - r = g.dispatch(request, requested_url) | |
34 | - | |
35 | - self.content = r.content |