Update layout

This commit is contained in:
Xavier Bustamante Talavera 2018-10-16 11:13:21 +02:00
parent b391950d97
commit 84dd154cbe
5 changed files with 50 additions and 72 deletions

View File

@ -1,5 +1,7 @@
from enum import Enum from enum import Enum
import inflection
from ereuse_devicehub.resources.event import models as e from ereuse_devicehub.resources.event import models as e
@ -9,6 +11,9 @@ class State(Enum):
"""Events participating in this state.""" """Events participating in this state."""
return (s.value for s in cls) return (s.value for s in cls)
def __str__(self):
return inflection.humanize(self.name)
class Trading(State): class Trading(State):
Reserved = e.Reserve Reserved = e.Reserve

View File

@ -44,32 +44,17 @@
</article> </article>
<article class="col-md-6"> <article class="col-md-6">
<h3>These are the specifications</h3> <h3>These are the specifications</h3>
<ul class="list-unstyled">
<li>
<ul class="list-inline">
{% if device.trading %} {% if device.trading %}
<li>
{{ device.trading.name }} {{ device.trading.name }}
</li>
{% endif %} {% endif %}
{% if device.physical %} {% if device.trading and device.physical %}
<li> and
{% endif %}
{% if device.phyisical %}
{{ device.physical.name }} {{ device.physical.name }}
</li>
{% endif %} {% endif %}
</ul>
</li>
{% if device.physical_possessor %}
<li>
Physical possessor:
{{ device.physical_possessor.name }},
{{ device.physical_possessor.country.value }}
</li>
{% endif %}
</ul>
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
@ -80,10 +65,7 @@
{% if device.processor_model %} {% if device.processor_model %}
<tr> <tr>
<td> <td>
<details> CPU {{ device.processor_model }}
<summary>CPU {{ device.processor_model }}</summary>
{{ macros.component_type(device.components, 'Processor') }}
</details>
</td> </td>
<td>{{ device.rate.processor_range if device.rate }}</td> <td>{{ device.rate.processor_range if device.rate }}</td>
</tr> </tr>
@ -91,10 +73,8 @@
{% if device.ram_size %} {% if device.ram_size %}
<tr> <tr>
<td> <td>
<details> RAM {{ device.ram_size // 1000 }} GB
<summary>RAM {{ device.ram_size // 1000 }} GB</summary>
{{ macros.component_type(device.components, 'RamModule') }} {{ macros.component_type(device.components, 'RamModule') }}
</details>
</td> </td>
<td>{{ device.rate.ram_range if device.rate }}</td> <td>{{ device.rate.ram_range if device.rate }}</td>
</tr> </tr>
@ -102,12 +82,9 @@
{% if device.data_storage_size %} {% if device.data_storage_size %}
<tr> <tr>
<td> <td>
<details> Data Storage {{ device.data_storage_size // 1000 }} GB
<summary>Data Storage {{ device.data_storage_size // 1000 }} GB
</summary>
{{ macros.component_type(device.components, 'SolidStateDrive') }} {{ macros.component_type(device.components, 'SolidStateDrive') }}
{{ macros.component_type(device.components, 'HardDrive') }} {{ macros.component_type(device.components, 'HardDrive') }}
</details>
</td> </td>
<td>{{ device.rate.data_storage_range if device.rate }}</td> <td>{{ device.rate.data_storage_range if device.rate }}</td>
</tr> </tr>
@ -115,10 +92,8 @@
{% if device.graphic_card_model %} {% if device.graphic_card_model %}
<tr> <tr>
<td> <td>
<details> Graphics {{ device.graphic_card_model }}
<summary>Graphics {{ device.graphic_card_model }}</summary>
{{ macros.component_type(device.components, 'GraphicCard') }} {{ macros.component_type(device.components, 'GraphicCard') }}
</details>
</td> </td>
<td></td> <td></td>
</tr> </tr>
@ -126,8 +101,7 @@
{% if device.network_speeds %} {% if device.network_speeds %}
<tr> <tr>
<td> <td>
<details> Network
<summary>Network
{% if device.network_speeds[0] %} {% if device.network_speeds[0] %}
Ethernet Ethernet
{% if device.network_speeds[0] != None %} {% if device.network_speeds[0] != None %}
@ -143,9 +117,7 @@
max. {{ device.network_speeds[1] }} Mbps max. {{ device.network_speeds[1] }} Mbps
{% endif %} {% endif %}
{% endif %} {% endif %}
</summary>
{{ macros.component_type(device.components, 'NetworkAdapter') }} {{ macros.component_type(device.components, 'NetworkAdapter') }}
</details>
</td> </td>
<td></td> <td></td>
</tr> </tr>
@ -185,11 +157,10 @@
</div> </div>
<h3>This is the traceability log of your device</h3> <h3>This is the traceability log of your device</h3>
<div class="text-right"> <div class="text-right">
<small>Oldest one.</small> <small>Latest one.</small>
</div> </div>
<ol> <ol>
{% for event in device.events %} {% for event in device.events|reverse %}
<li> <li>
<strong> <strong>
{{ event.type }} {{ event.type }}
@ -207,11 +178,13 @@
{% endfor %} {% endfor %}
</ol> </ol>
<div class="text-right"> <div class="text-right">
<small>Latest one.</small> <small>Oldest one.</small>
</div> </div>
</article> </article>
</div> </div>
<a href="https://www.ereuse.org/">
<img class="img-responsive center-block" style="max-width: 30em;" <img class="img-responsive center-block" style="max-width: 30em;"
src="{{ url_for('Device.static', filename='ereuse-logo.svg') }}"> src="{{ url_for('Device.static', filename='ereuse-logo.svg') }}">
</a>
</body> </body>
</html> </html>

View File

@ -1,5 +1,5 @@
{% macro component_type(components, type) %} {% macro component_type(components, type) %}
<ul class="list-unstyled"> <ul>
{% for c in components if c.t == type %} {% for c in components if c.t == type %}
<li> <li>
{{ c.__format__('t') }} {{ c.__format__('t') }}

View File

@ -25,7 +25,7 @@ requests==2.19.1
requests-mock==1.5.2 requests-mock==1.5.2
SQLAlchemy==1.2.11 SQLAlchemy==1.2.11
SQLAlchemy-Utils==0.33.3 SQLAlchemy-Utils==0.33.3
teal==0.2.0a24 teal==0.2.0a25
webargs==4.0.0 webargs==4.0.0
Werkzeug==0.14.1 Werkzeug==0.14.1
sqlalchemy-citext==1.3.post0 sqlalchemy-citext==1.3.post0

View File

@ -34,7 +34,7 @@ setup(
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
install_requires=[ install_requires=[
'teal>=0.2.0a24', # teal always first 'teal>=0.2.0a25', # teal always first
'click', 'click',
'click-spinner', 'click-spinner',
'ereuse-utils[Naming]>=0.4b9', 'ereuse-utils[Naming]>=0.4b9',