User profile layout (#2402)
This commit is contained in:
@@ -3,28 +3,26 @@
|
||||
{% endmacro %}
|
||||
|
||||
{%- macro page_actions(tools) -%}
|
||||
{% import _self as macro %}
|
||||
<div class="breadcrumb">
|
||||
<div class="box-tools">
|
||||
{{ macro.button_group(tools) }}
|
||||
{{ _self.button_group(tools) }}
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro entity_actions(tools) -%}
|
||||
{% import _self as macro %}
|
||||
<div class="breadcrumb">
|
||||
<div class="box-tools">
|
||||
<div class="btn-group">
|
||||
{% set actions = {} %}
|
||||
{%- for icon, values in tools %}
|
||||
{% if icon == 'back' %}
|
||||
{{ macro.action_button(icon, values) }}
|
||||
{{ _self.action_button(icon, values) }}
|
||||
{% else %}
|
||||
{% set actions = actions|merge({(icon): values}) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ macro.table_actions(actions, '') }}
|
||||
{{ _self.table_actions(actions, '') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,21 +33,18 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_boolean(visible) %}
|
||||
{% import _self as macro %}
|
||||
{% if visible %}
|
||||
{{ macro.label('yes'|trans, 'success') }}
|
||||
{{ _self.label('yes'|trans, 'success') }}
|
||||
{% else %}
|
||||
{{ macro.label('no'|trans, 'default') }}
|
||||
{{ _self.label('no'|trans, 'default') }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_visible(visible) %}
|
||||
{% import _self as macro %}
|
||||
{{ macro.label_boolean(visible) }}
|
||||
{{ _self.label_boolean(visible) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_role(role) %}
|
||||
{% import _self as macro %}
|
||||
{% set color = 'primary' %}
|
||||
{% if role == 'ROLE_SUPER_ADMIN' %}
|
||||
{% set color = 'danger' %}
|
||||
@@ -60,7 +55,7 @@
|
||||
{% elseif role == 'ROLE_USER' %}
|
||||
{% set color = 'gray' %}
|
||||
{% endif %}
|
||||
{{ macro.label(role|trans, color) }}
|
||||
{{ _self.label(role|trans, color) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro username(user) %}
|
||||
@@ -68,13 +63,11 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_user(user) %}
|
||||
{% import _self as macro %}
|
||||
{{ macro.label(user.displayName, 'primary') }}
|
||||
{{ _self.label(user.displayName, 'primary') }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_team(team, class) %}
|
||||
{% import _self as macro %}
|
||||
{{ macro.label(team.name, class|default('primary')) }}
|
||||
{{ _self.label(team.name, class|default('primary')) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro user_avatar(user, tooltip, class) %}
|
||||
@@ -87,7 +80,6 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_activity(activity, url) %}
|
||||
{% import _self as macro %}
|
||||
{% set isVisible = activity.visible %}
|
||||
{% set color = activity.color %}
|
||||
{% if color is empty and activity.project is not null %}
|
||||
@@ -99,22 +91,19 @@
|
||||
{% set isVisible = activity.project.customer.visible %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ macro.label_color_dot('activity', isVisible, activity.name, url, color) }}
|
||||
{{ _self.label_color_dot('activity', isVisible, activity.name, url, color) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_project(project, url) %}
|
||||
{% import _self as macro %}
|
||||
{% set isVisible = false %}
|
||||
{% if project.visible and project.customer.visible %}
|
||||
{% set isVisible = true %}
|
||||
{% endif %}
|
||||
{{ macro.label_color_dot('project', isVisible, project.name, url, (project.color ?? project.customer.color)) }}
|
||||
{{ _self.label_color_dot('project', isVisible, project.name, url, (project.color ?? project.customer.color)) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_customer(customer, url) %}
|
||||
{% import _self as macro %}
|
||||
{% set isVisible = customer.visible %}
|
||||
{{ macro.label_color_dot('customer', isVisible, customer.name, url, customer.color) }}
|
||||
{{ _self.label_color_dot('customer', customer.visible, customer.name, url, customer.color) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro label_color_dot(type, isVisible, name, url, color) %}
|
||||
@@ -137,11 +126,10 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro badge_team_access(teams) %}
|
||||
{% import _self as macro %}
|
||||
{% if teams|length > 0 %}
|
||||
{{ macro.badge_counter(teams|length) }}
|
||||
{{ _self.badge_counter(teams|length) }}
|
||||
{% else %}
|
||||
{{ macro.icon('unlocked') }}
|
||||
{{ _self.icon('unlocked') }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -218,7 +206,6 @@
|
||||
{% endmacro %}
|
||||
|
||||
{% macro table_actions(actions, class) %}
|
||||
{%- import _self as macro -%}
|
||||
{% if actions|length >= 1 %}
|
||||
{% if class is null %}
|
||||
{% set class = 'btn-sm' %}
|
||||
@@ -249,9 +236,17 @@
|
||||
{% set trash = values %}
|
||||
{% else %}
|
||||
{% set divider = false %}
|
||||
<li>
|
||||
{{ macro.action_button(icon, values, false) }}
|
||||
</li>
|
||||
{% if values.children is defined %}
|
||||
{%- for childIcon, childValues in values.children %}
|
||||
<li>
|
||||
{{ _self.action_button(childIcon, childValues, false) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<li>
|
||||
{{ _self.action_button(icon, values, false) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor -%}
|
||||
@@ -260,7 +255,7 @@
|
||||
<li class="divider"></li>
|
||||
{% endif %}
|
||||
<li class="delete">
|
||||
{{ macro.action_button('trash', trash, false) }}
|
||||
{{ _self.action_button('trash', trash, false) }}
|
||||
</li>
|
||||
{% endif -%}
|
||||
{% endapply %}
|
||||
@@ -269,8 +264,37 @@
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro list_group_actions(actions, highlightUrl) %}
|
||||
{% if actions|length > 0 %}
|
||||
<div class="list-group">
|
||||
{% for icon, values in actions %}
|
||||
{% if 'divider' in icon and values is null %}
|
||||
</div><div class="list-group">
|
||||
{# <a class="list-group-item disabled list-group-divider"></a> #}
|
||||
{% else %}
|
||||
{% if values is not iterable %}
|
||||
{% set values = {'url': values} %}
|
||||
{% endif %}
|
||||
{% if values['children'] is defined %}
|
||||
{{ _self.list_group_actions(values['children'], highlightUrl) }}
|
||||
{% else %}
|
||||
{% if values['title'] is not defined %}
|
||||
{% set values = values|merge({'title': icon|trans({}, 'actions')}) %}
|
||||
{% endif %}
|
||||
{% set class = 'list-group-item' %}
|
||||
{% if highlightUrl == values.url %}
|
||||
{% set class = class ~ ' active' %}
|
||||
{% endif %}
|
||||
{% set values = values|merge({'class': class}) %}
|
||||
{{ _self.action_button(icon, values, false) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro action_button(icon, values, type) %}
|
||||
{%- import _self as macro -%}
|
||||
{%- apply spaceless -%}
|
||||
{% set id = null %}
|
||||
{% set onclick = null %}
|
||||
@@ -281,6 +305,7 @@
|
||||
{% set title = null %}
|
||||
{% set disabled = false %}
|
||||
{% set attr = {} %}
|
||||
{% set translation_domain = 'messages' %}
|
||||
{% if type is same as (false) %}
|
||||
{% set class = "" %}
|
||||
{% elseif type is null %}
|
||||
@@ -289,7 +314,7 @@
|
||||
{% set class = "btn btn-" ~ type ~ " btn-" ~ icon ~ " " %}
|
||||
{% endif %}
|
||||
|
||||
{% if not values is iterable %}
|
||||
{% if values is not iterable %}
|
||||
{% set url = values %}
|
||||
{% if 'onclick:' in url %}
|
||||
{% set onclick = url|replace({'onclick:': ''}) %}
|
||||
@@ -314,6 +339,7 @@
|
||||
{% set title = values.title ?? null %}
|
||||
{% set class = class ~ ( values.class | default("")) %}
|
||||
{% set attr = values.attr ?? {} %}
|
||||
{% set translation_domain = values.translation_domain ?? translation_domain %}
|
||||
{% endif %}
|
||||
|
||||
{% if disabled is same as (true) %}
|
||||
@@ -332,30 +358,33 @@
|
||||
{{ ' ' ~ name }}={% if '"' in value %}'{{ value|raw }}'{% else %}"{{ value|raw }}"{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
>{% if title is not null %}{{ title }}{% else %}{{ macro.icon(icon) }}{% endif %}</a>
|
||||
>{% if title is not null %}{{ title|trans({}, translation_domain) }}{% else %}{{ _self.icon(icon) }}{% endif %}</a>
|
||||
{% endapply %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro button_group(actions, type) %}
|
||||
{%- import _self as macro -%}
|
||||
<div class="btn-group">
|
||||
{%- apply spaceless -%}
|
||||
{%- for icon,values in actions %}
|
||||
{% if values.children is defined %}
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
{{ macro.icon(icon) }}
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">{{ 'label.toggle_dropdown'|trans }}</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
{% for childIcon,childValues in values.children %}
|
||||
<li>{{ macro.action_button(childIcon, childValues, false) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if 'divider' in icon and values is null %}
|
||||
{# what to do here ? #}
|
||||
{% else %}
|
||||
{{ macro.action_button(icon, values, type) }}
|
||||
{% if values.children is defined %}
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
{{ _self.icon(icon) }}
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">{{ 'label.toggle_dropdown'|trans }}</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
{% for childIcon,childValues in values.children %}
|
||||
<li>{{ _self.action_button(childIcon, childValues, false) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
{{ _self.action_button(icon, values, type) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor -%}
|
||||
{% endapply %}
|
||||
@@ -416,7 +445,8 @@
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro team_list(teams, showTitle) %}
|
||||
{% macro team_list(teams, showTitle, collapseAt) %}
|
||||
{% set collapseAt = collapseAt ?? 5 %}
|
||||
{% if showTitle is null %}
|
||||
{% set showTitle = true %}
|
||||
{% endif %}
|
||||
@@ -447,12 +477,12 @@
|
||||
{{ macro.user_avatar(user) }}
|
||||
{% set counter = counter + 1 %}
|
||||
{% endif %}
|
||||
{% if userTeamCount > 5 and counter == 4 and loop.index != userTeamCount %}
|
||||
<a href="#" onclick="$('#{{ teamHiddenId }}').toggleClass('hidden');$(this).hide();return false;" class="badge">{{ 'label.plus_more'|trans({'%count%': (userTeamCount - 5)}) }}</a>
|
||||
{% if userTeamCount > collapseAt and counter == (collapseAt - 1) and loop.index != userTeamCount %}
|
||||
<a href="#" onclick="$('#{{ teamHiddenId }}').toggleClass('hidden');$(this).hide();return false;" class="badge">{{ 'label.plus_more'|trans({'%count%': (userTeamCount - collapseAt)}) }}</a>
|
||||
<span class="hidden" id="{{ teamHiddenId }}">
|
||||
{% set counter = counter + 1 %}
|
||||
{% endif %}
|
||||
{% if userTeamCount > 5 and counter != 4 and loop.index == userTeamCount %}
|
||||
{% if userTeamCount > collapseAt and counter != (collapseAt - 1) and loop.index == userTeamCount %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user