diff --git a/hiboo/profile/templates/profile_details.html b/hiboo/profile/templates/profile_details.html index 1c446eb3a51877a9eb1373392bd9873eec4321d8..1c9c8839d7be03ee53994ba9d92fc132a0378af0 100644 --- a/hiboo/profile/templates/profile_details.html +++ b/hiboo/profile/templates/profile_details.html @@ -18,9 +18,8 @@ <dt>{% trans %}UUID{% endtrans %}</dt> <dd><pre>{{ profile.uuid }}</pre></dd> - {% set status = profile.STATUSES[profile.status] %} <dt>{% trans %}Status{% endtrans %}</dt> - <dd><span class="badge bg-{{ status[0] }}">{{ status[1] }}</span></dd> + <dd>{{ macros.profile_status(profile) }}</dd> <dt>{% trans %}Created at{% endtrans %}</dt> <dd>{{ profile.created_at }}</dd> diff --git a/hiboo/profile/templates/profile_list.html b/hiboo/profile/templates/profile_list.html index 11626efdd79a93c5b82e9ed242989ceec91aa5e0..347d80d270243f5d6b1b878161c1073b9a28b98f 100644 --- a/hiboo/profile/templates/profile_list.html +++ b/hiboo/profile/templates/profile_list.html @@ -29,7 +29,6 @@ <th>{% trans %}Actions{% endtrans %}</th> </tr> {% for profile in profiles %} - {% set status = profile.STATUSES[profile.status] %} <tr> {% if not service %} <td>{{ profile.service.name }}</td> @@ -42,7 +41,7 @@ <td>-</td> {% endif %} <td>{{ profile.uuid }}</td> - <td><span class="badge bg-{{ status[0] }}">{{ status[1] }}</span></td> + <td>{{ macros.profile_status(profile) }}</td> <td>{{ profile.created_at.date() }}</td> <td> {% if profile.status == "active" %} diff --git a/hiboo/templates/macros.html b/hiboo/templates/macros.html index c5c9a8123424160189ac8ae1a503697a83b2686b..d3ce4771c66831ad69ccad2ec192a09faebd9d5e 100644 --- a/hiboo/templates/macros.html +++ b/hiboo/templates/macros.html @@ -31,6 +31,16 @@ </ul> {% endmacro %} +{% macro profile_status(profile) %} + {% set status = profile.STATUSES[profile.status] %} + <span class="badge bg-{{ status[0] }}">{{ status[1] }}</span> + {% if profile.transition %} + {% set transition = profile.STATUSES[profile.transition] %} + <i class="fa fa-arrow-right"></i> + <span class="badge bg-{{ transition[0] }}">{{ transition[1] }}</span> + {% endif %} +{% endmacro %} + {% macro infobox(title, text, color, icon) %} <div class="info-box"> <span class="info-box-icon bg-{{ color }}"><i class="fa fa-{{ icon }}"></i></span> diff --git a/hiboo/user/templates/user_details.html b/hiboo/user/templates/user_details.html index cabc8cd8a6f63fefba9aafbdfbd540825097375a..3dba76807be00e9a3bead4ef4a049f12d06bd1a4 100644 --- a/hiboo/user/templates/user_details.html +++ b/hiboo/user/templates/user_details.html @@ -49,7 +49,7 @@ <tr> <td><a href="{{ url_for("service.details", service_uuid=profile.service.uuid) }}">{{ profile.service.name }}</a></td> <td><a href="{{ url_for("profile.details", profile_uuid=profile.uuid) }}">{{ profile.username }}</a></td> - <td>{{ profile.status }}</td> + <td>{{ macros.profile_status(profile) }}</td> </tr> {% endfor %} </table>