diff --git a/hiboo/account/templates/account_profiles.html b/hiboo/account/templates/account_profiles.html index 51a52ba33d42187da2f545e5b5212a75f1dffa0b..886b612cc6e0de8e72ae71f884fa1b6cf40eb721 100644 --- a/hiboo/account/templates/account_profiles.html +++ b/hiboo/account/templates/account_profiles.html @@ -56,23 +56,7 @@ {% for action in common.get_actions(profile) %} <li class="nav-item"> <a class="nav-link" href="{{ action.url(profile=profile) }}"> - {% if action.label == "delete" %} - <i class="fas fa-user-slash"></i> - {% elif action.label == "block" %} - <i class="fas fa-ban"></i> - {% elif action.label == "unblock" %} - <i class="fas fa-unlock-alt"></i> - {% elif action.label == "purge" %} - <i class="fas fa-trash"></i> - {% elif action.label == "activate" %} - <i class="fas fa-user-check"></i> - {% elif action.label == "reject" %} - <i class="fas fa-user-times"></i> - {% elif action.label == "cancel" %} - <i class="fas fa-power-off"></i> - {% else %} - <i class="fas fa-trash"></i> - {% endif %} + <i class="{{ action.icon }}"></i> {{ action.description | capitalize }} </a> </li> diff --git a/hiboo/actions.py b/hiboo/actions.py index f28c64f011f6eb2df8f49b06bed683640d95612b..6b806cb898c7e7291720f8f291a358d300ee9acb 100644 --- a/hiboo/actions.py +++ b/hiboo/actions.py @@ -77,9 +77,10 @@ class CancelTransition(Action): action = "profile.cancel_transition" label = _("cancel") description = _("cancel ongoing profile actions") + icon="fas fa-power-off" def url(self, profile): return super(CancelTransition, self).url(profile_uuid=profile.uuid) def authorized(self, profile): - return profile.transition_step \ No newline at end of file + return profile.transition_step diff --git a/hiboo/models.py b/hiboo/models.py index b54eef96ad3b972d6a50a9dacd771977eeacc6a4..ba5b0095ed33c70e8ae0e4de34ba70a99c3f6f24 100644 --- a/hiboo/models.py +++ b/hiboo/models.py @@ -210,28 +210,28 @@ class Profile(db.Model): TRANSITIONS = { "activate": actions.Transition("activate", label=_("activate"), description=_("activate this profile"), - from_=(REQUEST,), to=ACTIVE + icon="fas fa-user-check", from_=(REQUEST,), to=ACTIVE ), "reject": actions.Transition("reject", label=_("reject"), description=_("reject this request"), - from_=(REQUEST,), to=PURGED + icon="fas fa-user-times", from_=(REQUEST,), to=PURGED ), "block": actions.Transition("block", label=_("block"), description=_("block this profile"), - from_=(ACTIVE,), to=BLOCKED + icon="fas fa-ban", from_=(ACTIVE,), to=BLOCKED ), "unblock": actions.Transition("unblock", label=_("unblock"), description=_("unblock this blocked profile"), - from_=(BLOCKED,), to=ACTIVE + icon="fas fa-unlock-alt", from_=(BLOCKED,), to=ACTIVE ), "delete": actions.Transition("delete", label=_("delete"), description=_("delete this profile"), - from_=(ACTIVE, BLOCKED), to=DELETED, + icon="fas fa-user-slash", from_=(ACTIVE, BLOCKED), to=DELETED, admin_only=False, delay=120 ), "purge": actions.Transition("purge", label=_("purge"), description=_("delete and purge this profile"), - from_=(ACTIVE, BLOCKED, DELETED), to=PURGED, + icon="fas fa-trash", from_=(ACTIVE, BLOCKED, DELETED), to=PURGED, delay=120 ) } @@ -282,7 +282,7 @@ class ClaimName(db.Model): service_uuid = db.Column(db.String(36), db.ForeignKey(Service.uuid)) profile = db.relationship(Profile, backref=db.backref('claimnames', cascade='all, delete-orphan', lazy='dynamic')) - + username = db.Column(db.String(255), nullable=False)