List all trial mode services

At the moment the service list doesn’t disambiguate between live and
trial mode services. This makes it hard to tell which of the things are
important and which aren’t.

The first step towards making this page clearer is to list trial mode
services separately.
This commit is contained in:
Chris Hill-Scott
2019-06-07 09:07:11 +01:00
parent 3511f8ad5b
commit 1ca0dfacf7
3 changed files with 43 additions and 10 deletions

View File

@@ -237,6 +237,24 @@ class User(JSONModel, UserMixin):
def email_domain(self):
return self.email_address.split('@')[-1]
@cached_property
def all_services(self):
return user_api_client.get_services_for_user(self.id)
@property
def trial_mode_services(self):
return [
service for service in self.all_services
if service['restricted']
]
@property
def live_services(self):
return [
service for service in self.all_services
if not service['restricted']
]
@cached_property
def default_organisation(self):
return Organisation(

View File

@@ -15,7 +15,7 @@
<li class="browse-list-item">
<a href="{{ url_for('.organisations') }}" class="browse-list-link">All organisations</a>
</li>
<div class ="keyline-block"></div>
<div class="keyline-block"></div>
{% endif %}
{% for org in organisations %}
<li class="browse-list-item">
@@ -30,7 +30,7 @@
</ul>
{% endif %}
</li>
<div class ="keyline-block"></div>
<div class="keyline-block"></div>
{% endfor %}
{% if services_without_organisations %}
{% for item in services_without_organisations %}
@@ -38,9 +38,24 @@
<a href="{{ url_for('.service_dashboard', service_id=item.id) }}" class="browse-list-link">{{ item.name }}</a>
</li>
{% endfor %}
<div class ="keyline-block"></div>
<div class="keyline-block"></div>
{% endif %}
{% if current_user.trial_mode_services %}
{% if organisations or current_user.live_services %}
</ul>
<h2 class="heading-small">
Trial mode services
</h2>
<ul>
{% endif %}
{% for service in current_user.trial_mode_services %}
<li class="browse-list-item">
<a href="{{ url_for('.service_dashboard', service_id=service.id) }}" class="browse-list-link">{{ service.name }}</a>
</li>
{% endfor %}
{% endif %}
</ul>
</nav>
{% if can_add_service %}
<div class="js-stick-at-bottom-when-scrolling">
<a href="{{ url_for('.add_service') }}" class="button-secondary">Add a new service</a>

View File

@@ -15,16 +15,16 @@ SAMPLE_DATA = {
'name': 'org_1',
'id': 'o1',
'services': [
{'name': 'org_service_1', 'id': 'os1'},
{'name': 'org_service_2', 'id': 'os2'},
{'name': 'org_service_3', 'id': 'os3'},
{'name': 'org_service_1', 'id': 'os1', 'restricted': False},
{'name': 'org_service_2', 'id': 'os2', 'restricted': False},
{'name': 'org_service_3', 'id': 'os3', 'restricted': True},
]
},
{
'name': 'org_2',
'id': 'o2',
'services': [
{'name': 'org_service_4', 'id': 'os4'},
{'name': 'org_service_4', 'id': 'os4', 'restricted': False},
]
},
{
@@ -34,9 +34,9 @@ SAMPLE_DATA = {
}
],
'services_without_organisations': [
{'name': 'service_1', 'id': 's1'},
{'name': 'service_2', 'id': 's2'},
{'name': 'service_3', 'id': 's3'},
{'name': 'service_1', 'id': 's1', 'restricted': False},
{'name': 'service_2', 'id': 's2', 'restricted': False},
{'name': 'service_3', 'id': 's3', 'restricted': True},
]
}