From 462cf8e75c610fc76f2f91925aa794eca54d97ed Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 7 Jan 2020 12:48:26 +0100 Subject: [PATCH 01/24] Add new BSD License (3 Clause) --- LICENSE | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b87a1a4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,35 @@ +Copyright 2020 Santiago Lamora and individual contributors. +All Rights Reserved. + +django-musician is licensed under The BSD License (3 Clause, also known as +the new BSD license). The license is an OSI approved Open Source +license and is GPL-compatible(1). + +The license text can also be found here: +http://www.opensource.org/licenses/BSD-3-Clause + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Ask Solem, nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Ask Solem OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. From aba3495f94a483d2facd7d51d50ff5203d7ad1d2 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 7 Jan 2020 13:18:21 +0100 Subject: [PATCH 02/24] Add lilla logo to login background. --- musician/static/musician/css/default.css | 2 +- musician/static/musician/images/logo-pangea-lilla-bg.svg | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 musician/static/musician/images/logo-pangea-lilla-bg.svg diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index a9d7da4..e449649 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -76,7 +76,7 @@ a:hover { /** login **/ #body-login .jumbotron { - background: #282532;/**#50466E;**/ + background: #282532 no-repeat url("../images/logo-pangea-lilla-bg.svg") right; } #login-content { diff --git a/musician/static/musician/images/logo-pangea-lilla-bg.svg b/musician/static/musician/images/logo-pangea-lilla-bg.svg new file mode 100644 index 0000000..3db2325 --- /dev/null +++ b/musician/static/musician/images/logo-pangea-lilla-bg.svg @@ -0,0 +1 @@ + \ No newline at end of file From d3d75e7542d0c7f3cefda3d1290892692d001f9b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 7 Jan 2020 13:27:06 +0100 Subject: [PATCH 03/24] Add light gray logo to dashboard background. --- musician/static/musician/css/default.css | 3 ++- musician/static/musician/images/logo-pangea-light-gray-bg.svg | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 musician/static/musician/images/logo-pangea-light-gray-bg.svg diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index e449649..ecb1ff2 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -104,7 +104,8 @@ a:hover { } #content { - background: #ECECEB; + background: #ECECEB no-repeat url("../images/logo-pangea-light-gray-bg.svg"); + background-position: right 5% top 10%; color: #343434; } diff --git a/musician/static/musician/images/logo-pangea-light-gray-bg.svg b/musician/static/musician/images/logo-pangea-light-gray-bg.svg new file mode 100644 index 0000000..c4fe411 --- /dev/null +++ b/musician/static/musician/images/logo-pangea-light-gray-bg.svg @@ -0,0 +1 @@ + \ No newline at end of file From f6d13d6b958308020907de7d32c7f2a8114ccf31 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 7 Jan 2020 13:53:59 +0100 Subject: [PATCH 04/24] Set title pages. --- musician/templates/musician/base.html | 5 +-- musician/views.py | 45 +++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/musician/templates/musician/base.html b/musician/templates/musician/base.html index 9dc1ffc..42158a5 100644 --- a/musician/templates/musician/base.html +++ b/musician/templates/musician/base.html @@ -11,7 +11,7 @@ {% endblock %} - {% block title %}{% if name %}{{ name }} – {% endif %}Django musician{% endblock %} + {% block title %}{% if title %}{{ title }} – {% endif %}Django musician{% endblock %} {% block style %} {% block bootstrap_theme %} @@ -23,9 +23,6 @@ - {% if code_style %}{% endif %} {% endblock %} {% endblock %} diff --git a/musician/views.py b/musician/views.py index 7a8a2d1..bbff6a0 100644 --- a/musician/views.py +++ b/musician/views.py @@ -25,6 +25,10 @@ from .settings import ALLOWED_RESOURCES class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): template_name = "musician/dashboard.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('Dashboard'), + } def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -85,6 +89,10 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): template_name = "musician/profile.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('User profile'), + } def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -103,7 +111,7 @@ class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): class ServiceListView(CustomContextMixin, ExtendedPaginationMixin, UserTokenRequiredMixin, ListView): """Base list view to all services""" service_class = None - template_name = "musician/service_list.html" # TODO move to ServiceListView + template_name = "musician/service_list.html" def get_queryset(self): if self.service_class is None or self.service_class.api_name is None: @@ -132,9 +140,18 @@ class ServiceListView(CustomContextMixin, ExtendedPaginationMixin, UserTokenRequ class BillingView(ServiceListView): service_class = Bill template_name = "musician/billing.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('Billing'), + } class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View): + extra_context = { + # Translators: This message appears on the page title + 'title': _('Download bill'), + } + def get(self, request, *args, **kwargs): pk = self.kwargs.get('pk') bill = self.orchestra.retrieve_bill_document(pk) @@ -145,6 +162,10 @@ class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View): class MailView(ServiceListView): service_class = MailService template_name = "musician/mail.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('Mail addresses'), + } def get_queryset(self): def retrieve_mailbox(value): @@ -198,6 +219,10 @@ class MailView(ServiceListView): class MailingListsView(ServiceListView): service_class = MailinglistService template_name = "musician/mailinglists.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('Mailing lists'), + } def get_context_data(self, **kwargs): @@ -223,15 +248,27 @@ class MailingListsView(ServiceListView): class DatabasesView(ServiceListView): template_name = "musician/databases.html" service_class = DatabaseService + extra_context = { + # Translators: This message appears on the page title + 'title': _('Databases'), + } class SaasView(ServiceListView): service_class = SaasService template_name = "musician/saas.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('Software as a Service'), + } class DomainDetailView(CustomContextMixin, UserTokenRequiredMixin, DetailView): template_name = "musician/domain_detail.html" + extra_context = { + # Translators: This message appears on the page title + 'title': _('Domain details'), + } def get_queryset(self): # Return an empty list to avoid a request to retrieve all the @@ -254,7 +291,11 @@ class LoginView(FormView): form_class = LoginForm success_url = reverse_lazy('musician:dashboard') redirect_field_name = 'next' - extra_context = {'version': get_version()} + extra_context = { + # Translators: This message appears on the page title + 'title': _('Login'), + 'version': get_version(), + } def get_form_kwargs(self): kwargs = super().get_form_kwargs() From fb0c734f60b393cc8b66a0a9e07da2de06f1a409 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 7 Jan 2020 13:57:02 +0100 Subject: [PATCH 05/24] Redirect to dashboard as root index (redirect). --- userpanel/urls.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/userpanel/urls.py b/userpanel/urls.py index 1f0caec..84d4ec9 100644 --- a/userpanel/urls.py +++ b/userpanel/urls.py @@ -18,11 +18,13 @@ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path +from django.views.generic.base import RedirectView import musician urlpatterns = [ path('', include('musician.urls')), + path('', RedirectView.as_view(pattern_name='musician:dashboard', permanent=False), name='root_index') ] DEVELOPMENT = config('DEVELOPMENT', default=False, cast=bool) From 4cc3707ad5461910f5e074d050d48e6659140abc Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 14 Jan 2020 11:28:57 +0100 Subject: [PATCH 06/24] Show if a list is active or not. --- musician/models.py | 6 +----- musician/templates/musician/mailinglists.html | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/musician/models.py b/musician/models.py index db3367b..e02844e 100644 --- a/musician/models.py +++ b/musician/models.py @@ -229,6 +229,7 @@ class MailinglistService(OrchestraModel): fields = ('name', 'status', 'address_name', 'admin_email', 'configure') param_defaults = { 'name': None, + 'is_active': True, 'admin_email': None, } @@ -236,11 +237,6 @@ class MailinglistService(OrchestraModel): self.data = kwargs super().__init__(**kwargs) - @property - def status(self): - # TODO(@slamora): where retrieve if the list is active? - return 'active' - @property def address_name(self): return "{}@{}".format(self.data['address_name'], self.data['address_domain']['name']) diff --git a/musician/templates/musician/mailinglists.html b/musician/templates/musician/mailinglists.html index a5f0824..22a1b87 100644 --- a/musician/templates/musician/mailinglists.html +++ b/musician/templates/musician/mailinglists.html @@ -30,7 +30,11 @@ {% for resource in object_list %} {{ resource.name }} - {{ resource.status|capfirst }} + {% if resource.is_active %} + {% trans "Active" %} + {% else %} + {% trans "Inactive" %} + {% endif %} {{ resource.address_name}} {{ resource.admin_email }} Mailtrain From 669600f4da2b46645064a0a5cb50aa93680096b6 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 14 Jan 2020 11:40:42 +0100 Subject: [PATCH 07/24] Show user.last_login on dashboard --- musician/models.py | 7 ++++++- musician/templates/musician/dashboard.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/musician/models.py b/musician/models.py index e02844e..2f43e28 100644 --- a/musician/models.py +++ b/musician/models.py @@ -1,6 +1,7 @@ import ast import logging +from django.utils.dateparse import parse_datetime from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ @@ -100,6 +101,7 @@ class UserAccount(OrchestraModel): 'short_name': None, 'full_name': None, 'billing': {}, + 'last_login': None, } @classmethod @@ -108,7 +110,10 @@ class UserAccount(OrchestraModel): if 'billcontact' in data: billing = BillingContact.new_from_json(data['billcontact']) - return super().new_from_json(data=data, billing=billing) + + if 'last_login' in data: + last_login = parse_datetime(data['last_login']) + return super().new_from_json(data=data, billing=billing, last_login=last_login) class DatabaseUser(OrchestraModel): diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index d621e1c..e57fc2d 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -4,7 +4,7 @@ {% block content %}

{% trans "Welcome back" %} {{ profile.username }}

-

{% blocktrans with last_login=profile.last_login|default:"N/A" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}

+

{% blocktrans with last_login=profile.last_login|date:"SHORT_DATE_FORMAT" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}

{% for resource, usage in resource_usage.items %} From a9f23f6ea49f7a08fe62a3a37da9acca5cfebd41 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 14 Jan 2020 11:45:54 +0100 Subject: [PATCH 08/24] Hide domain.expiration_date (not provided by orchestra) --- musician/templates/musician/dashboard.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index e57fc2d..375fbe3 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -46,7 +46,9 @@
+ {% comment "@slamora: orchestra doesn't have this information [won't fix] See issue #2" %} {% trans "Expiration date" %}: {{ domain.expiration_date|date:"SHORT_DATE_FORMAT" }} + {% endcomment %}
From 34faf13dc6488acf84d18e18e135cfe1c98118dd Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 14 Jan 2020 13:10:16 +0100 Subject: [PATCH 09/24] Hide database.domain until is provided by orchestra --- musician/templates/musician/databases.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/musician/templates/musician/databases.html b/musician/templates/musician/databases.html index 33403bc..f660026 100644 --- a/musician/templates/musician/databases.html +++ b/musician/templates/musician/databases.html @@ -17,7 +17,9 @@ {% trans "Type" %}: {{ database.type }}
+ {% comment "@slamora: orchestra doesn't provide this information [won't fix] See issue #3" %} {% trans "associated to" %}: {{ database.domain|default:"-" }} + {% endcomment %}
From 160e0b059f141d48f85f6af915aabf401a06d55b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 14 Jan 2020 13:50:17 +0100 Subject: [PATCH 10/24] Bugfix: handle users that has never logged into Regression introduced by 669600f4da2b46645064a0a5cb50aa93680096b6 --- musician/models.py | 1 + musician/templates/musician/dashboard.html | 4 ++++ musician/tests.py | 25 ++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/musician/models.py b/musician/models.py index 2f43e28..683d7aa 100644 --- a/musician/models.py +++ b/musician/models.py @@ -107,6 +107,7 @@ class UserAccount(OrchestraModel): @classmethod def new_from_json(cls, data, **kwargs): billing = None + last_login = None if 'billcontact' in data: billing = BillingContact.new_from_json(data['billcontact']) diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index 375fbe3..90c8811 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -4,7 +4,11 @@ {% block content %}

{% trans "Welcome back" %} {{ profile.username }}

+{% if profile.last_login %}

{% blocktrans with last_login=profile.last_login|date:"SHORT_DATE_FORMAT" %}Last time you logged in was: {{ last_login }}{% endblocktrans %}

+{% else %} +

{% trans "It's the first time you log into the system, welcome on board!" %}

+{% endif %}
{% for resource, usage in resource_usage.items %} diff --git a/musician/tests.py b/musician/tests.py index b25e23a..805ff05 100644 --- a/musician/tests.py +++ b/musician/tests.py @@ -1,5 +1,7 @@ from django.test import TestCase +from .models import UserAccount + class DomainsTestCase(TestCase): def test_domain_not_found(self): @@ -12,3 +14,26 @@ class DomainsTestCase(TestCase): response = self.client.get('/domains/3/') self.assertEqual(404, response.status_code) + + +class UserAccountTest(TestCase): + def test_user_never_logged(self): + data = { + 'billcontact': {'address': 'foo', + 'city': 'Barcelona', + 'country': 'ES', + 'name': '', + 'vat': '12345678Z', + 'zipcode': '08080'}, + 'date_joined': '2020-01-14T12:38:31.684495Z', + 'full_name': 'Pep', + 'id': 2, + 'is_active': True, + 'language': 'EN', + 'short_name': '', + 'type': 'INDIVIDUAL', + 'url': 'http://example.org/api/accounts/2/', + 'username': 'pepe' + } + account = UserAccount.new_from_json(data) + self.assertIsNone(account.last_login) From 90ad13e61a0ec688b3b87888d78f1733729b7438 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 10:15:27 +0100 Subject: [PATCH 11/24] Define WebSite orchestra resource. --- musician/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/musician/models.py b/musician/models.py index 683d7aa..58d5d0c 100644 --- a/musician/models.py +++ b/musician/models.py @@ -263,3 +263,23 @@ class SaasService(OrchestraModel): 'is_active': True, 'data': {}, } + + +class WebSite(OrchestraModel): + api_name = 'website' + param_defaults = { + "id": None, + "name": None, + "protocol": None, + "is_active": True, + "domains": [], + "contents": [], + } + + @classmethod + def new_from_json(cls, data, **kwargs): + domains = cls.param_defaults.get("domains") + if 'domains' in data: + domains = [Domain.new_from_json(domain_data) for domain_data in data['domains']] + + return super().new_from_json(data=data, domains=domains) From 6980522d811e2ff9ff5e0be7e12c54a0863a5ba8 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 10:20:26 +0100 Subject: [PATCH 12/24] Make more descriptive variable names. --- musician/templates/musician/dashboard.html | 4 ++-- musician/views.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index 90c8811..c6de4e3 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -62,9 +62,9 @@

{{ domain.mails|length }} {% trans "mail addresses created" %} - {% if domain.address_left.alert %} + {% if domain.address_left.alert_level %}
- {{ domain.address_left.count }} mail address left + {{ domain.address_left.count }} mail address left {% endif %}

diff --git a/musician/views.py b/musician/views.py index bbff6a0..e96fa24 100644 --- a/musician/views.py +++ b/musician/views.py @@ -66,16 +66,16 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): # TODO(@slamora): validate concept of limits with Pangea profile_type = context['profile'].type for domain in domains: - address_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails) - alert = None - if address_left == 1: - alert = 'warning' - elif address_left < 1: - alert = 'danger' + addresses_left = ALLOWED_RESOURCES[profile_type]['mailbox'] - len(domain.mails) + alert_level = None + if addresses_left == 1: + alert_level = 'warning' + elif addresses_left < 1: + alert_level = 'danger' - domain.address_left = { - 'count': address_left, - 'alert': alert, + domain.addresses_left = { + 'count': addresses_left, + 'alert_level': alert_level, } context.update({ From 81fa9b57fde5ccab427816475540d91049337d5b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 10:45:18 +0100 Subject: [PATCH 13/24] Retrieve websites associated to a domain --- musician/api.py | 22 +++++++++++++++++++++- musician/models.py | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/musician/api.py b/musician/api.py index 8b4139c..bbf77a5 100644 --- a/musician/api.py +++ b/musician/api.py @@ -6,7 +6,7 @@ from django.http import Http404 from django.urls.exceptions import NoReverseMatch from django.utils.translation import gettext_lazy as _ -from .models import Domain, DatabaseService, MailService, SaasService, UserAccount +from .models import Domain, DatabaseService, MailService, SaasService, UserAccount, WebSite DOMAINS_PATH = 'domains/' @@ -25,6 +25,7 @@ API_PATHS = { 'mailbox-list': 'mailboxes/', 'mailinglist-list': 'lists/', 'saas-list': 'saas/', + 'website-list': 'websites/', # other 'bill-list': 'bills/', @@ -118,6 +119,8 @@ class Orchestra(object): def retrieve_domain_list(self): output = self.retrieve_service_list(Domain.api_name) + websites = self.retrieve_website_list() + domains = [] for domain_json in output: # filter querystring @@ -126,6 +129,10 @@ class Orchestra(object): # retrieve services associated to a domain domain_json['mails'] = self.retrieve_service_list( MailService.api_name, querystring) + + # retrieve websites (as they cannot be filtered by domain on the API we should do it here) + domain_json['websites'] = self.filter_websites_by_domain(websites, domain_json['id']) + # TODO(@slamora): databases and sass are not related to a domain, so cannot be filtered # domain_json['databases'] = self.retrieve_service_list(DatabaseService.api_name, querystring) # domain_json['saas'] = self.retrieve_service_list(SaasService.api_name, querystring) @@ -143,6 +150,19 @@ class Orchestra(object): return domains + def retrieve_website_list(self): + output = self.retrieve_service_list(WebSite.api_name) + return [WebSite.new_from_json(website_data) for website_data in output] + + def filter_websites_by_domain(self, websites, domain_id): + matching = [] + for website in websites: + web_domains = [web_domain.id for web_domain in website.domains] + if domain_id in web_domains: + matching.append(website) + + return matching + def verify_credentials(self): """ Returns: diff --git a/musician/models.py b/musician/models.py index 58d5d0c..aa3ebd4 100644 --- a/musician/models.py +++ b/musician/models.py @@ -162,6 +162,7 @@ class Domain(OrchestraModel): "records": [], "mails": [], "usage": {}, + "websites": [], } @classmethod From b277b9a2e4e0da9a04418806a0b410ba6b35747d Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 17:27:11 +0100 Subject: [PATCH 14/24] Show website information related to each domain. --- musician/templates/musician/dashboard.html | 44 ++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/musician/templates/musician/dashboard.html b/musician/templates/musician/dashboard.html index c6de4e3..55fd5b5 100644 --- a/musician/templates/musician/dashboard.html +++ b/musician/templates/musician/dashboard.html @@ -43,11 +43,15 @@ {{ domain.name }}
+ {% with domain.websites.0 as website %} + {% with website.contents.0 as content %} + {% endwith %} + {% endwith %}
{% comment "@slamora: orchestra doesn't have this information [won't fix] See issue #2" %} @@ -117,13 +121,22 @@
+
From 442c2a3d19297b4ed36eb3375001b0f78f063460 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 17:59:49 +0100 Subject: [PATCH 16/24] Code template when no database exists. --- musician/templates/musician/databases.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/musician/templates/musician/databases.html b/musician/templates/musician/databases.html index f660026..95e1c34 100644 --- a/musician/templates/musician/databases.html +++ b/musician/templates/musician/databases.html @@ -48,7 +48,21 @@ - {% endfor %} +{% empty %} +
+
+
+
+

+ {# Translators: database page when there isn't any database. #} +
{% trans "Ooops! Looks like there is nothing here!" %}
+
+
+
+
+{% endfor %} + {% if object_list|length > 0 %} {% include "musician/components/paginator.html" %} + {% endif %} {% endblock %} From 5495808d9c7f0d8f7a715796ef7d81e328e99e81 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 18:17:37 +0100 Subject: [PATCH 17/24] Set sidebar paddings. --- musician/static/musician/css/default.css | 18 ++++++++++++++++-- musician/templates/musician/base.html | 24 +++++++++++------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index ecb1ff2..6d9efee 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -40,8 +40,8 @@ a:hover { } #sidebar { - min-width: 250px; - max-width: 250px; + min-width: 280px; + max-width: 280px; min-height: 100vh; } @@ -49,6 +49,19 @@ a:hover { margin-left: -250px; } +#sidebar .sidebar-branding { + padding-left: 2rem; + padding-right: 2rem; +} +#sidebar #sidebar-services { + padding-left: 1rem; + padding-right: 1rem; +} + +#sidebar #user-profile-menu { + background: rgba(255, 255, 255, 0.3); +} + #sidebar ul.components { padding: 20px 0; } @@ -107,6 +120,7 @@ a:hover { background: #ECECEB no-repeat url("../images/logo-pangea-light-gray-bg.svg"); background-position: right 5% top 10%; color: #343434; + padding-left: 2rem; } /** services **/ diff --git a/musician/templates/musician/base.html b/musician/templates/musician/base.html index 42158a5..8a531e3 100644 --- a/musician/templates/musician/base.html +++ b/musician/templates/musician/base.html @@ -34,14 +34,15 @@
- - - + {% endblock sidebar %} From d43b849d491aebd161196a817b5ff720cb93e7d4 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 18:19:55 +0100 Subject: [PATCH 18/24] Code template when no saas exists. --- musician/templates/musician/saas.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/musician/templates/musician/saas.html b/musician/templates/musician/saas.html index eaad20a..2dc932a 100644 --- a/musician/templates/musician/saas.html +++ b/musician/templates/musician/saas.html @@ -38,6 +38,18 @@ + {% empty %} +
+
+
+
+

+ {# Translators: saas page when there isn't any saas. #} +
{% trans "Ooops! Looks like there is nothing here!" %}
+
+
+
+
{% endfor %} {% endblock %} From 36b0033b11c3074f50b71b711686226b04d893a4 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 18:33:33 +0100 Subject: [PATCH 19/24] Move version to top & fix services_menu list. --- musician/templates/musician/base.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/musician/templates/musician/base.html b/musician/templates/musician/base.html index 8a531e3..dbd0ee0 100644 --- a/musician/templates/musician/base.html +++ b/musician/templates/musician/base.html @@ -38,19 +38,19 @@ Pangea.org - Internet etic i solidari - {{ version }} + {# #} - {% for item in services_menu %} - {% endfor %} {# #} +
+ Panel Version {{ version }} +
{% endblock sidebar %}
From 3890fec1113077ad89536ac9586c453c362a9eb5 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Mon, 20 Jan 2020 18:34:00 +0100 Subject: [PATCH 20/24] Push to bottom profile menu on sidebar. --- musician/static/musician/css/default.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index 6d9efee..197878d 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -43,6 +43,12 @@ a:hover { min-width: 280px; max-width: 280px; min-height: 100vh; + + display: flex; + flex-direction: column; +} +#sidebar #sidebar-services { + flex-grow: 1; } #sidebar.active { From 5595ae6fd6b459b1f1d784378c400abc3e7deced Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 21 Jan 2020 12:30:37 +0100 Subject: [PATCH 21/24] Fix profile menu background color. --- musician/static/musician/css/default.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/musician/static/musician/css/default.css b/musician/static/musician/css/default.css index 197878d..a95a573 100644 --- a/musician/static/musician/css/default.css +++ b/musician/static/musician/css/default.css @@ -65,7 +65,7 @@ a:hover { } #sidebar #user-profile-menu { - background: rgba(255, 255, 255, 0.3); + background:rgba(254, 251, 242, 0.25); } #sidebar ul.components { From 7dbf55f495d1dc128b7553aeabc604237da08b1d Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 21 Jan 2020 13:10:12 +0100 Subject: [PATCH 22/24] Add link to billing on profile page. --- musician/templates/musician/profile.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/musician/templates/musician/profile.html b/musician/templates/musician/profile.html index c820007..6a49dd6 100644 --- a/musician/templates/musician/profile.html +++ b/musician/templates/musician/profile.html @@ -55,7 +55,9 @@ Details: {{ payment.data }} {% endif %}
- + From d2d0832d6ba5b6d63b2ea8eb0fec2cfb75e95952 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 21 Jan 2020 13:20:28 +0100 Subject: [PATCH 23/24] Show & lay SaaS details out. --- musician/templates/musician/saas.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/musician/templates/musician/saas.html b/musician/templates/musician/saas.html index 2dc932a..ca12f2d 100644 --- a/musician/templates/musician/saas.html +++ b/musician/templates/musician/saas.html @@ -24,12 +24,11 @@

-

{% trans "Service info" %}

-

{% trans "Active" %}: {{ saas.is_active|yesno }}

- {# TODO (@slamora): implement saas details #} -
-                {{ saas.data }}
-            
+

{% trans "Service info" %}

+ {{ saas.is_active|yesno }}
+ {% for key, value in saas.data.items %} + {{ value }}
+ {% endfor %}