Move badge code to separate file
This commit is contained in:
20
_includes/badge.html
Normal file
20
_includes/badge.html
Normal file
@ -0,0 +1,20 @@
|
||||
{% if include.link %}
|
||||
<a
|
||||
href="{{ link }}" class="badge badge-{{ include.color | default: "info" }}"
|
||||
{% if include.tooltip %}
|
||||
data-toggle="tooltip"
|
||||
title="{{ include.tooltip }}"><i class="{{ include.icon | default: "far fa-question-circle"}}"></i> {{ include.text }}
|
||||
{% else %}><i class="{{ include.icon | default: "fas fa-external-link-alt"}}"></i> {{ include.text }}{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<span
|
||||
class="badge badge-{{ include.color | default: "info" }}"
|
||||
{% if include.tooltip %}
|
||||
data-toggle="tooltip"
|
||||
title="{{ include.tooltip }}"
|
||||
> <i class="{{ include.icon | default: "far fa-question-circle"}}"></i> {{include.text}}
|
||||
{% else %}
|
||||
> {% if include.icon %}<i class="{{ include.icon }}"></i>{% endif %} {{include.text}}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
@ -45,7 +45,7 @@
|
||||
{% assign label_data = label | split:"::" %}
|
||||
{% for label_attr in label_data %}
|
||||
{% assign attr = label_attr | split:"==" %}
|
||||
{% if attr[0] == "color" }
|
||||
{% if attr[0] == "color" %}
|
||||
{% assign color = attr[1] %}
|
||||
{% elsif attr[0] == "link" %}
|
||||
{% assign link = attr[1] %}
|
||||
@ -57,26 +57,13 @@
|
||||
{% assign tooltip = attr[1] %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if link %}
|
||||
<a
|
||||
href="{{ link }}" class="badge badge-{{ color | default: "info" }}"
|
||||
{% if tooltip %}
|
||||
data-toggle="tooltip"
|
||||
title="{{ tooltip }}"><i class="{{ icon | default: "far fa-question-circle"}}"></i> {{ text }}
|
||||
{% else %}><i class="{{ icon | default: "fas fa-external-link-alt"}}"></i> {{ text }}{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<span
|
||||
class="badge badge-{{ color | default: "info" }}"
|
||||
{% if tooltip %}
|
||||
data-toggle="tooltip"
|
||||
title="{{ tooltip }}"
|
||||
> <i class="{{ icon | default: "far fa-question-circle"}}"> {{text}}
|
||||
{% else %}
|
||||
> {% if icon %}<i class="{{ icon }}"></i>{% endif %} {{text}}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% include badge.html
|
||||
link=link
|
||||
color=color
|
||||
text=text
|
||||
icon=icon
|
||||
tooltip=tooltip
|
||||
%}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
Reference in New Issue
Block a user