Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds wiki #6028

Merged
merged 5 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@
'oauth2_provider',
'townsquare',
'compliance',
'django_nyt.apps.DjangoNytConfig',
'mptt',
'sekizai',
'sorl.thumbnail',
'wiki.apps.WikiConfig',
'wiki.plugins.attachments.apps.AttachmentsConfig',
'wiki.plugins.notifications.apps.NotificationsConfig',
'wiki.plugins.images.apps.ImagesConfig',
'wiki.plugins.macros.apps.MacrosConfig',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -165,6 +174,7 @@
'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages',
'app.context.preprocess', 'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
"sekizai.context_processors.sekizai",
],
},
}]
Expand Down Expand Up @@ -742,6 +752,10 @@
if ENABLE_DDTRACE:
INSTALLED_APPS += ['ddtrace.contrib.django']

WIKI_ACCOUNT_HANDLING = True
WIKI_ACCOUNT_SIGNUP_ALLOWED = True


# Sending an email when a bounty is funded below a threshold
LOWBALL_BOUNTY_THRESHOLD = env.float('LOWBALL_BOUNTY_THRESHOLD', default=10.00)

Expand Down
13 changes: 11 additions & 2 deletions app/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
from .sitemaps import sitemaps

urlpatterns = [

path('wiki/', include('wiki.urls')),

# oauth2 provider
url('^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
path('jsi18n/', JavaScriptCatalog.as_view(), name='javascript-catalog'),
Expand Down Expand Up @@ -655,6 +658,10 @@
# users
url(r'^api/v0.1/user_bounties/', dashboard.views.get_user_bounties, name='get_user_bounties'),
url(r'^api/v0.1/users_fetch/', dashboard.views.users_fetch, name='users_fetch'),

# wiki
path('wiki/notifications/', include('django_nyt.urls')),

]

if settings.ENABLE_SILK:
Expand All @@ -674,13 +681,15 @@

urlpatterns += [
re_path(
r'^([a-z|A-Z|0-9|\.](?:[a-z\d]|-(?=[a-z\d]))+)/([a-z|A-Z|0-9|\.]+)/?$',
r'^(?!wiki)([a-z|A-Z|0-9|\.](?:[a-z\d]|-(?=[a-z\d]))+)/([a-z|A-Z|0-9|\.]+)/?$',
dashboard.views.profile,
name='profile_min'
),
re_path(r'^([a-z|A-Z|0-9|\.](?:[a-z\d]|-(?=[a-z\d]))+)/?$', dashboard.views.profile, name='profile_min'),
re_path(r'^(?!wiki)([a-z|A-Z|0-9|\.](?:[a-z\d]|-(?=[a-z\d]))+)/?$', dashboard.views.profile, name='profile_min'),
]

LOGIN_REDIRECT_URL = '/login'

handler403 = 'retail.views.handler403'
handler404 = 'retail.views.handler404'
handler500 = 'retail.views.handler500'
Expand Down
10 changes: 10 additions & 0 deletions app/dashboard/templates/shared/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,16 @@ <h5>Weekly leaderboard</h5>
{% trans "Mission" %}
</a>
</li>
<li>
<a class="dropdown-item" href="/wiki">
{% trans "Wiki" %}
</a>
</li>
<li>
<a class="dropdown-item" href="/wiki/help">
{% trans "Help" %}
</a>
</li>
</ul>

<ul class="col-md-3 col-lg-2 list-unstyled">
Expand Down
3 changes: 2 additions & 1 deletion app/retail/templates/shared/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ <h5>{% trans "Community" %}</h5>
Chat
</a>
<a href="{% url "activity" %}">{% trans "Activity Feed" %}</a>
<a href="{% url "help" %}">{% trans "Help" %}</a>
<a href="/wiki/">{% trans "Wiki" %}</a>
<a href="/wiki/help">{% trans "Help" %}</a>
<a href="https://store.gitcoin.co/">{% trans "Store" %}</a>
</div>
<div class="sitenav">
Expand Down
9 changes: 9 additions & 0 deletions app/retail/templates/wiki/accounts/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% load i18n wiki_tags sekizai_tags %}
{% block wiki_pagetitle %}{% trans "" %}{% endblock %}

{% block wiki_contents %}
<script type="text/javascript">
document.location.href = '{% url 'social:begin' 'github' %}?next={{ request.get_full_path }}';

</script>
{% endblock %}
9 changes: 9 additions & 0 deletions app/retail/templates/wiki/accounts/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% load i18n wiki_tags sekizai_tags %}
{% block wiki_pagetitle %}{% trans "" %}{% endblock %}

{% block wiki_contents %}
<script type="text/javascript">
document.location.href = '{% url 'social:begin' 'github' %}?next={{ request.get_full_path }}';

</script>
{% endblock %}
22 changes: 22 additions & 0 deletions app/retail/templates/wiki/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "wiki/base_site.html" %}

{% block wiki_site_title %} - Gitcoin{% endblock %}

{% block wiki_header_branding %}
<a class="navbar-brand" href="/">
<img id="logo" src="/static/v2/images/logo_large.png" style="margin-top: -20px;" width="150" height="50" />
</a>
<style type="text/css">
.navbar{
background: url(/static/v2/images/header-bg.png);
}
</style>
{% endblock %}

{% block wiki_header_navlinks %}
<ul class="nav navbar-nav">
<li class="active"><a href="/">Home</a></li>
<li class="active"><a href="/chat">Chat</a></li>
<li class="active"><a href="{% url 'wiki:root' %}">Wiki</a></li>
</ul>
{% endblock %}
156 changes: 156 additions & 0 deletions app/retail/templates/wiki/base_site.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{% load sekizai_tags i18n wiki_tags static %}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
{% include 'shared/favicon.html' %}
<title>{% block wiki_pagetitle %}{% endblock %}{% block wiki_site_title %} - django-\/\/ i K |{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="www.django-wiki.org">

<!-- Le styles -->
<link href="{% static "wiki/bootstrap/css/wiki-bootstrap.min.css" %}" rel="stylesheet">

{% render_block "css" %}
</head>

<body>

{% block wiki_body %}

{% block wiki_navbar %}
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<div class="navbar-header">
<!-- .navbar-toggle is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{% block wiki_header_branding %}
<a class="navbar-brand" href="{% url 'wiki:root' %}">django-\/\/ i K |</a>
{% endblock %}
</div>
<div class="navbar-collapse collapse">
<form class="navbar-form navbar-right" id="wiki-search-form" method="GET" action="{% spaceless %}
{% if article or urlpath %}
{% url 'wiki:search' article_id=article.id path=urlpath.path %}
{% else %}
{% url 'wiki:search' %}
{% endif %}
{% endspaceless %}"
>
<div class="input-group">
<input type="search" class="form-control search-query" name="q" placeholder="{% spaceless %}
{% if article or urlpath %}
{% trans "Search ..." %}
{% else %}
{% trans "Search whole wiki..." %}
{% endif %}
{% endspaceless %}" />
<span class="input-group-btn">
<button class="btn btn-default" type="submit">
<span class="fa fa-search"></span>
</button>
</span>
</div><!-- /input-group -->
</form>
<div class="navbar-right">
{% if user.is_authenticated %}
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="badge notification-cnt">0</span>
{{ user }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{% if "ACCOUNT_HANDLING"|wiki_settings %}
<li>
<a href="{% url 'wiki:profile_update' %}">
<i class="fa fa-gear"></i>
{% trans "Wiki Account Settings" %}
</a>
</li>
{% endif %}
<li>
<a href="/">
<i class="fa fa-power-off"></i>
{% trans "Exit Wiki mode" %}
</a>
</li>
{% if user.is_superuser %}
<li>
<a href="{% url 'wiki:deleted_list' %}">
<i class="fa fa-trash-o"></i>
{% trans "Deleted articles" %}
</a>
</li>
{% endif %}
{% if "wiki.plugins.notifications"|plugin_enabled %}
{% include "wiki/plugins/notifications/menubaritem.html" %}
{% endif %}
{% if "wiki.plugins.globalhistory"|plugin_enabled %}
{% include "wiki/plugins/globalhistory/menubaritem.html" %}
{% endif %}
</ul>
</li>
</ul>
{% else %}
<ul class="nav navbar-nav">
<li>
<a href="{% login_url as wiki_login_url %}{{ wiki_login_url }}">{% trans "Log in" %}</a>
</li>
{% if "ACCOUNT_HANDLING"|wiki_settings %}
<li>
<a href="{% url 'wiki:signup' %}">{% trans "Sign up" %}</a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
{% block wiki_header_navlinks %}
<ul class="nav navbar-nav">
<li class="active"><a href="/">{% trans "Home" %}</a></li>
<li><a href="https://github.com/django-wiki/django-wiki" target="_blank">{% trans "About" %}</a></li>
</ul>
{% endblock %}
</div>
</div>
</div>
{% endblock %}

<div class="container" style="margin-top: 60px;">

{% wiki_messages %}

<!-- Reserved for breadcrumbs -->
{% block wiki_breadcrumbs %}{% endblock %}

<!-- Main page contents go here -->
{% block wiki_contents %}{% endblock %}

<footer id="wiki-footer">
<hr />
{% block wiki_footer_logo %}
{% endblock %}
{% block wiki_footer_prepend %}
{% endblock %}
</footer>
</div>

</div> <!-- /container -->

{% endblock %}

<script src="{% static "wiki/js/jquery-3.3.1.min.js" %}"></script>
<script src="{% static "wiki/js/core.js" %}"></script>
<script src="{% static "wiki/bootstrap/js/bootstrap.min.js" %}"></script>
<!-- Optionally enable responsive features in IE8 -->
<script src="{% static "wiki/js/respond.min.js" %}"></script>
{% render_block "js" %}

</body>
</html>
3 changes: 3 additions & 0 deletions app/retail/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@ def create_status_update(request):
return JsonResponse(response)

def help(request):
if not request.user.is_staff:
return redirect('/wiki/help')

faq = {
'Product': [
{
Expand Down
2 changes: 2 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ ddtrace
metadata-parser==0.10.0
redis==3.3.11
pandas
wiki