205 lines
7.3 KiB
Twig
205 lines
7.3 KiB
Twig
{% macro icon(icon) %}
|
||
<i class="{{ icon|icon(icon) }}"></i>
|
||
{% endmacro %}
|
||
|
||
{%- macro page_actions(tools) -%}
|
||
{% import _self as macro %}
|
||
<div class="breadcrumb">
|
||
<div class="box-tools">
|
||
{{ macro.button_group(tools) }}
|
||
</div>
|
||
</div>
|
||
{%- endmacro -%}
|
||
|
||
{% macro page_header(title) %}
|
||
<h2 class="page-header">{{ title|trans }}</h2>
|
||
{% endmacro %}
|
||
|
||
{% macro label_visible(visible) %}
|
||
{% import _self as macro %}
|
||
{% if visible %}
|
||
{{ macro.label('yes', 'success') }}
|
||
{% else %}
|
||
{{ macro.label('no', 'default') }}
|
||
{% endif %}
|
||
{% endmacro %}
|
||
|
||
{% macro label_role(role) %}
|
||
{% import _self as macro %}
|
||
{% if role == 'ROLE_SUPER_ADMIN' %}
|
||
{{ macro.label(role, 'danger') }}
|
||
{% else %}
|
||
{{ macro.label(role, 'primary') }}
|
||
{% endif %}
|
||
{% endmacro %}
|
||
|
||
{% macro username(user) %}
|
||
{{ user.alias|default(user.username) }}
|
||
{% endmacro %}
|
||
|
||
{% macro label_user(user) %}
|
||
{% import _self as macro %}
|
||
{{ macro.label(macro.username(user), 'primary') }}
|
||
{% endmacro %}
|
||
|
||
{% macro label_activity(activity) %}
|
||
{% import _self as macro %}
|
||
{% set isVisible = activity.visible %}
|
||
{% if isVisible and not activity.project is null %}
|
||
{% set isVisible = activity.project.visible %}
|
||
{% if isVisible and not activity.project.customer is null %}
|
||
{% set isVisible = activity.project.customer.visible %}
|
||
{% endif %}
|
||
{% endif %}
|
||
{% set type = (isVisible ? 'primary' : 'default') %}
|
||
<span class="label label-{{ type }}">{{ activity.name }}</span>
|
||
{% endmacro %}
|
||
|
||
{% macro label_project(project) %}
|
||
{% import _self as macro %}
|
||
{% set type = 'default' %}
|
||
{% if project.visible and project.customer.visible %}
|
||
{% set type = 'primary' %}
|
||
{% endif %}
|
||
<span class="label label-{{ type }}">{{ project.name }}</span>
|
||
{% endmacro %}
|
||
|
||
{% macro label_customer(customer) %}
|
||
{% import _self as macro %}
|
||
{% set type = 'default' %}
|
||
{% if customer.visible %}
|
||
{% set type = 'primary' %}
|
||
{% endif %}
|
||
<span class="label label-{{ type }}">{{ customer.name }}</span>
|
||
{% endmacro %}
|
||
|
||
{% macro badge_counter(count, url) %}
|
||
{% if url %}
|
||
<a href="{{ url }}"><span class="badge bg-blue">{{ count }}</span></a>
|
||
{% else %}
|
||
<span class="badge bg-blue">{{ count }}</span>
|
||
{% endif %}
|
||
{% endmacro %}
|
||
|
||
{% macro label(title, type, tooltip) %}
|
||
{# success, warning, danger, primary #}
|
||
<span {% if tooltip %}data-toggle="tooltip" data-placement="top" title="{{ tooltip }}" {% endif %}class="label label-{{ type|default('success') }}">{{ title|trans }}</span>
|
||
{% endmacro %}
|
||
|
||
{% macro badge(title, color) %}
|
||
{# black, green, blue, yellow #}
|
||
<span class="badge bg-{{ color|default('red') }}">{{ title|trans }}</span>
|
||
{% endmacro %}
|
||
|
||
{% macro alert(type, description, title, icon) %}
|
||
<div class="alert alert-{{ type|default('danger') }} alert-dismissible">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
{% if title %}<h4><i class="icon {{ icon|icon(icon) }}"></i> {{ title|trans }}</h4>{% endif %}
|
||
{{ description|trans }}
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
{% macro callout(type, description, title, icon) %}
|
||
<div class="callout callout-{{ type|default('danger') }} lead">
|
||
{% if title %}<h4>{% if icon %}<i class="{{ icon|icon(icon) }}">{% endif %}</i> {{ title|trans }}</h4>{% endif %}
|
||
<p>{{ description|trans }}</p>
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
{% macro info_box_progress(title, description, amount, percentage, icon, color) %}
|
||
<div class="info-box bg-{{ color|default(kimai_context.box_color) }}">
|
||
<span class="info-box-icon"><i class="{{ icon|icon(icon) }}"></i></span>
|
||
|
||
<div class="info-box-content">
|
||
<span class="info-box-text">{{ title|trans }}</span>
|
||
<span class="info-box-number">{{ amount }}</span>
|
||
|
||
<div class="progress">
|
||
<div class="progress-bar" style="width: {{ percentage }}%"></div>
|
||
</div>
|
||
<span class="progress-description">
|
||
{{ description }}
|
||
</span>
|
||
</div>
|
||
<!-- /.info-box-content -->
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
{% macro button_group_dropdown(title, actions) %}
|
||
<div class="btn-group">
|
||
<button type="button" class="btn btn-default">{{ title|trans }}</button>
|
||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||
<span class="caret"></span>
|
||
<span class="sr-only">{{ 'label.toggle_dropdown'|trans }}</span>
|
||
</button>
|
||
<ul class="dropdown-menu" role="menu">
|
||
{% for url, entry in actions %}
|
||
<li><a href="{{ url }}">{{ entry|trans }}</a></li>
|
||
{% endfor %}
|
||
</ul>
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
{% macro button_group(actions) %}
|
||
{% import _self as macro %}
|
||
<div class="btn-group">
|
||
{%- for icon,values in actions %}
|
||
{% spaceless %}
|
||
{% set id = null %}
|
||
{% set onclick = null %}
|
||
{% set modal = null %}
|
||
{% set toggle = null %}
|
||
{% set url = null %}
|
||
{% set target = null %}
|
||
{% set class = "btn btn-default btn-" ~ icon ~ " " %}
|
||
|
||
{% if not values is iterable %}
|
||
{% set url = values %}
|
||
{% if 'onclick:' in url %}
|
||
{% set onclick = url|replace({'onclick:': ''}) %}
|
||
{% set url = '#' %}
|
||
{% endif %}
|
||
{% if '#collapse' in url %}
|
||
{% set toggle = 'collapse' %}
|
||
{% endif %}
|
||
{% if '#modal' in url %}
|
||
{% set modal = url %}
|
||
{% set url = '#' %}
|
||
{% endif %}
|
||
{% else %}
|
||
{% set url = values.url ?? '#' %}
|
||
{% set onclick = values.onclick ?? null %}
|
||
{% set modal = values.modal ?? null %}
|
||
{% set toggle = values.toggle ?? null %}
|
||
{% set target = values.target ?? null %}
|
||
{% set id = values.id ?? null %}
|
||
{% set class = class ~ ( values.class | default("")) %}
|
||
{% endif %}
|
||
{% endspaceless %}
|
||
<a class="{{ class | trim }}" href="{{ url }}"
|
||
{%- if id is not empty -%}
|
||
id="{{ id }}"
|
||
{%- endif -%}
|
||
{%- if toggle is not empty -%}
|
||
data-toggle="{{ toggle }}"
|
||
{%- endif -%}
|
||
{%- if modal is not empty -%}
|
||
data-toggle="modal" data-target="{{ modal }}"
|
||
{%- endif -%}
|
||
{%- if onclick is not empty -%}
|
||
onclick="{{ onclick }}"
|
||
{%- endif -%}
|
||
{%- if target is not empty -%}
|
||
target="{{ target }}"
|
||
{%- endif -%}
|
||
>{{ macro.icon(icon) }}</a>
|
||
{% endfor -%}
|
||
</div>
|
||
{% endmacro %}
|
||
|
||
{% macro button_action(icon, url) %}
|
||
<a href="{{ url }}" class="btn btn-default btn-{{ icon }}">
|
||
{{ macro.icon(icon) }}
|
||
</a>
|
||
{% endmacro %}
|