Skip to content

Commit

Permalink
Merge 5f19eaa into 5eda37a
Browse files Browse the repository at this point in the history
  • Loading branch information
dyohan9 committed Jun 19, 2019
2 parents 5eda37a + 5f19eaa commit 6ed6896
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions bothub/authentication/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def send_welcome_email(self):
return False
context = {
'name': self.name,
'base_url': settings.BASE_URL,
}
send_mail(
_('Welcome to Bothub'),
Expand All @@ -131,6 +132,7 @@ def send_reset_password_email(self):
self.nickname,
token)
context = {
'base_url': settings.BASE_URL,
'reset_url': reset_url,
}
send_mail(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block before-content %}
<div style="text-align: center; padding-top: 20px;">
<img src="{% static 'authentication/emails/welcome.png' %}" alt="{% trans 'Welcome to Bothub' %}" style="margin: auto; width: 100%; max-width: 388px; display: block;" />
<img src="{{ base_url }}{% static 'authentication/emails/welcome.png' %}" alt="{% trans 'Welcome to Bothub' %}" style="margin: auto; width: 100%; max-width: 388px; display: block;" />
<h1 style="font-size: 24px;">{% trans 'Welcome to Bothub' %}</h1>
</div>
{% endblock %}
Expand Down
4 changes: 4 additions & 0 deletions bothub/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ def send_new_role_email(self, responsible=None):
responsible_name = responsible and responsible.name \
or self.repository.owner.name
context = {
'base_url': settings.BASE_URL,
'responsible_name': responsible_name,
'user_name': self.user.name,
'repository_name': self.repository.name,
Expand Down Expand Up @@ -1187,6 +1188,7 @@ def send_new_request_email_to_admins(self):
if not settings.SEND_EMAILS:
return False
context = {
'base_url': settings.BASE_URL,
'user_name': self.user.name,
'repository_name': self.repository.name,
'text': self.text,
Expand All @@ -1209,6 +1211,7 @@ def send_request_rejected_email(self):
if not settings.SEND_EMAILS:
return False
context = {
'base_url': settings.BASE_URL,
'repository_name': self.repository.name,
}
send_mail(
Expand All @@ -1227,6 +1230,7 @@ def send_request_approved_email(self):
if not settings.SEND_EMAILS:
return False
context = {
'base_url': settings.BASE_URL,
'admin_name': self.approved_by.name,
'repository_name': self.repository.name,
}
Expand Down
6 changes: 3 additions & 3 deletions bothub/common/templates/bothub/emails/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div style="background-color: #f9f9f9; font-size: 1.25rem; color: #222222;">
{% block content %}
<a style="display: block; padding: 16px;" rel="nofollow" href="https://bothub.it/" target="_blank">
<img src="{% static 'bothub/emails/logo.png' %}" alt="Bothub" width="124" height="26" style="display: block; margin: auto;" />
<img src="{{ base_url }}{% static 'bothub/emails/logo.png' %}" alt="Bothub" width="124" height="26" style="display: block; margin: auto;" />
</a>
{% endblock %}
<div>{% block before-content %}{% endblock %}</div>
Expand All @@ -34,10 +34,10 @@
<div style="padding: 32px 24px;">
<div style="display: flex;">
<a style="padding: 0 8px;" rel="nofollow" href="https://www.facebook.com/bothub.it/" target="_blank">
<img src="{% static 'bothub/emails/facebook.png' %}" alt="Facebook" width="38" height="38" style="display: block;" border="0" />
<img src="{{ base_url }}{% static 'bothub/emails/facebook.png' %}" alt="Facebook" width="38" height="38" style="display: block;" border="0" />
</a>
<a style="padding: 0 8px;" rel="nofollow" href="https://www.linkedin.com/company/bothubit/" target="_blank">
<img src="{% static 'bothub/emails/linkedin.png' %}" alt="LinkedIn" width="38" height="38" style="display: block;" border="0" />
<img src="{{ base_url }}{% static 'bothub/emails/linkedin.png' %}" alt="LinkedIn" width="38" height="38" style="display: block;" border="0" />
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bothub/common/templates/common/emails/new_request.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block before-content %}
<div style="text-align: center; padding-top: 20px;">
<img src="{% static 'common/emails/request.gif' %}" alt="{% trans 'New Authorization Request' %}" style="margin: auto; width: 100%; max-width: 456px; display: block;" />
<img src="{{ base_url }}{% static 'common/emails/request.gif' %}" alt="{% trans 'New Authorization Request' %}" style="margin: auto; width: 100%; max-width: 456px; display: block;" />
<h1 style="font-size: 1.5rem;">{% trans 'New Authorization Request' %}</h1>
</div>
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% block before-content %}
<div style="text-align: center; padding-top: 20px;">
<img src="{% static 'common/emails/request.gif' %}" alt="{% trans 'Authorization Request Approved' %}" style="margin: auto; width: 100%; max-width: 456px; display: block;" />
<img src="{{ base_url }}{% static 'common/emails/request.gif' %}" alt="{% trans 'Authorization Request Approved' %}" style="margin: auto; width: 100%; max-width: 456px; display: block;" />
<h1 style="font-size: 24px;">{% trans 'Authorization Request Approved' %}</h1>
</div>
{% endblock %}
Expand Down
1 change: 1 addition & 0 deletions bothub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
default='*',
cast=lambda v: [s.strip() for s in v.split(',')])

BASE_URL = config('BASE_URL', default='')

# Application definition

Expand Down
6 changes: 6 additions & 0 deletions bothub/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
def render_template(template_name, **kwargs):
def wrapper(request):
from django.shortcuts import render
print(request)
return render(request, template_name, kwargs)
return wrapper

Expand All @@ -38,11 +39,13 @@ def wrapper(request):
'welcome/',
render_template(
'authentication/emails/welcome.html',
base_url=settings.BASE_URL,
name='Douglas')),
path(
'new-role/',
render_template(
'common/emails/new_role.html',
base_url=settings.BASE_URL,
responsible_name='Douglas',
user_name='Michael',
repository_name='Repository 1',
Expand All @@ -52,6 +55,7 @@ def wrapper(request):
'new-request/',
render_template(
'common/emails/new_request.html',
base_url=settings.BASE_URL,
user_name='Michael',
repository_name='Repository 1',
text='Lorem ipsum dolor sit amet, consectetur ' +
Expand All @@ -64,11 +68,13 @@ def wrapper(request):
'request-rejected/',
render_template(
'common/emails/request_rejected.html',
base_url=settings.BASE_URL,
repository_name='Repository 1')),
path(
'request-approved/',
render_template(
'common/emails/request_approved.html',
base_url=settings.BASE_URL,
admin_name='Douglas',
repository_name='Repository 1',
repository_url='http://localhost:8080/douglas/repo1/')),
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ services:
- CHECK_ACCESSIBLE_API_URL=${CHECK_ACCESSIBLE_API_URL}
- SEND_EMAILS=${SEND_EMAILS:-true}
- SUPPORTED_LANGUAGES=${SUPPORTED_LANGUAGES:-en|pt}
- BASE_URL=${BOTHUB_BACKEND_BASE_URL:-https://api.bothub.ti/}


networks:
Expand Down

0 comments on commit 6ed6896

Please sign in to comment.