1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-24 05:43:10 +02:00

feat(admin-plugin): add ability to set individual icons #250

- for entries and entries collections
- for entries fieldsets
This commit is contained in:
Awilum
2019-10-09 17:22:36 +03:00
parent a65648ce01
commit e22f947751
8 changed files with 45 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
title: About
default_field: title
icon: 'far fa-file-alt'
sections:
main:
title: Main
@@ -37,11 +38,7 @@ sections:
menu_item_target:
title: admin_menu_item_target
type: select
options:
_self: _self
_blank: _blank
_parent: _parent
_top: _top
options: { _self: _self, _blank: _blank, _parent: _parent, _top: _top }
size: 4/12
menu_item_order:
title: admin_menu_item_order

View File

@@ -1,5 +1,6 @@
title: Blog Post
title: 'Blog Post'
default_field: title
icon: 'far fa-file-alt'
sections:
main:
title: Main

View File

@@ -1,5 +1,6 @@
title: Blog
default_field: title
icon: 'far fa-newspaper'
sections:
main:
title: Main
@@ -33,11 +34,7 @@ sections:
menu_item_target:
title: admin_menu_item_target
type: select
options:
_self: _self
_blank: _blank
_parent: _parent
_top: _top
options: { _self: _self, _blank: _blank, _parent: _parent, _top: _top }
size: 4/12
menu_item_order:
title: admin_menu_item_order

View File

@@ -1,5 +1,6 @@
title: Default
default_field: title
icon: 'far fa-file-alt'
sections:
main:
title: Main

View File

@@ -1,5 +1,6 @@
title: Gallery Item
title: 'Gallery Item'
default_field: title
icon: 'far fa-image'
sections:
main:
title: Main

View File

@@ -1,5 +1,6 @@
title: Gallery
default_field: title
icon: 'far fa-images'
sections:
main:
title: Main
@@ -29,11 +30,7 @@ sections:
menu_item_target:
title: admin_menu_item_target
type: select
options:
_self: _self
_blank: _blank
_parent: _parent
_top: _top
options: { _self: _self, _blank: _blank, _parent: _parent, _top: _top }
size: 4/12
menu_item_order:
title: admin_menu_item_order

View File

@@ -7,20 +7,35 @@
<table class="table no-margin">
<thead>
<tr>
<th>{{ tr('admin_entry') }}</th>
<th colspan="2">{{ tr('admin_entry') }}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for entry in entries_list %}
<tr>
<td>
<td style="width: 50px; text-align:center;">
{% if entry.fieldset %}
{% set fieldset_path = PATH_FIELDSETS ~ '/' ~ entry.fieldset ~ '.yaml' %}
{% if filesystem_has(fieldset_path) %}
{% set fieldset = yaml_decode(filesystem_read(fieldset_path)) %}
{% if fieldset.icon %}
<i class="{{ fieldset.icon }}"></i>
{% else %}
<i class="far fa-file-alt"></i>
{% endif %}
{% else %}
<i class="far fa-file-alt"></i>
{% endif %}
{% else %}
<i class="far fa-file-alt"></i>
{% endif %}
</td>
<td style="padding-left:0px;">
{% set _entries = entries.fetchAll(entry.slug, {'order_by': {field: 'slug', direction: 'asc'}}) %}
<a href="{% if _entries|length > 0 %}{{ path_for('admin.entries.index') }}?id={{ entry.slug }}{% else %}{{ path_for('admin.entries.edit') }}?id={{ entry.slug }}&type=editor{% endif %}">
{% if entry.fieldset %}
{% set fieldset_path = PATH_FIELDSETS ~ '/' ~ entry.fieldset ~ '.yaml' %}
{% if filesystem_has(fieldset_path) %}
{% set fieldset = yaml_decode(filesystem_read(fieldset_path)) %}
{% if fieldset.default_field %}
{% if entry[fieldset.default_field] != '' %}
{{ entry[fieldset.default_field] }}

View File

@@ -5,14 +5,27 @@
<table class="table no-margin">
<thead>
<tr>
<th>{{ tr('admin_name') }}</th>
<th colspan="2">{{ tr('admin_name') }}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for id, title in fieldsets_list %}
<tr>
<td>
<td style="width: 50px; text-align:center;">
{% set fieldset_path = PATH_FIELDSETS ~ '/' ~ id ~ '.yaml' %}
{% if filesystem_has(fieldset_path) %}
{% set fieldset = yaml_decode(filesystem_read(fieldset_path)) %}
{% if fieldset.icon %}
<i class="{{ fieldset.icon }}"></i>
{% else %}
<i class="far fa-file-alt"></i>
{% endif %}
{% else %}
<i class="far fa-file-alt"></i>
{% endif %}
</td>
<td style="padding-left:0px;">
<a href="{{ path_for('admin.fieldsets.edit') }}?id={{ id }}">{{ title }}</a>
</td>
<td class="text-right">