Add tag support
This commit is contained in:
parent
ce10245c51
commit
ae440be40c
24 changed files with 475 additions and 15 deletions
|
|
@ -23,7 +23,9 @@
|
|||
<li class="level-1--item sub-menu">
|
||||
<span class="sub-menu--link">Taxonomy</span>
|
||||
<menu class="level-2">
|
||||
<li class="level-2--item"><a href="/brain/category/list">All Categories</a></li>
|
||||
<li class="level-2--item"><a href="/brain/category/new">Add New Category</a></li>
|
||||
<li class="level-2--item"><a href="/brain/tag/list">All Tags</a></li>
|
||||
<li class="level-2--item"><a href="/brain/tag/new">Add New Tag</a></li>
|
||||
</menu>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
<div class="row">
|
||||
{{ form_row(form.category) }}
|
||||
</div>
|
||||
<div class="row">
|
||||
{{ form_row(form.tags) }}
|
||||
</div>
|
||||
<div class="row">
|
||||
{{ form_row(form.thumbnail) }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
<div class="row">
|
||||
{{ form_row(form.category) }}
|
||||
</div>
|
||||
{# <div class="row">
|
||||
<div class="row">
|
||||
{{ form_row(form.tags) }}
|
||||
</div> #}
|
||||
</div>
|
||||
<div class="row">
|
||||
{{ form_row(form.url) }}
|
||||
</div>
|
||||
|
|
|
|||
23
templates/brain/taxonomy/create.html.twig
Normal file
23
templates/brain/taxonomy/create.html.twig
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{% extends 'brain/base.html.twig' %}
|
||||
|
||||
{% block title %}{{ action|capitalize }} {{ type }} {% endblock %}
|
||||
|
||||
{% block page_title %}<h1>Add New {{ type }}</h1>{% endblock %}
|
||||
|
||||
{# {% block actions%}Actions here{% endblock %} #}
|
||||
|
||||
{% block admin %}
|
||||
<section class="add-new--{{type|lower}}">
|
||||
{{ form_start(form) }}
|
||||
<div class="form-errors">
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
<div class="row">
|
||||
{{ form_row(form.title) }}
|
||||
</div>
|
||||
<div class="row">
|
||||
{{ form_rest(form) }}
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
</section>
|
||||
{% endblock %}
|
||||
27
templates/brain/taxonomy/index.html.twig
Normal file
27
templates/brain/taxonomy/index.html.twig
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{% extends 'brain/base.html.twig' %}
|
||||
|
||||
{% block title %}{{ type }} {% endblock %}
|
||||
|
||||
{% block page_title %}<h1>All {{ type }}</h1>{% endblock %}
|
||||
|
||||
{# {% block actions%}Actions here{% endblock %} #}
|
||||
|
||||
{% block admin %}
|
||||
<div class="list">
|
||||
<h2><a href="/brain/{{type|lower}}/new">New {{ type }}</a></h2>
|
||||
<table class="posts">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Title</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for term in taxonomy %}
|
||||
<tr>
|
||||
<td>{{term.title}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{% extends 'home.html.twig' %}
|
||||
|
||||
{% block title %}Hello | Alex Daniels{% endblock %}
|
||||
{% block title %}Alex Daniels{% endblock %}
|
||||
|
||||
|
||||
{% block nav %}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,13 @@
|
|||
<div class="text">
|
||||
{{ post.text|raw }}
|
||||
</div>
|
||||
<div class="tags">
|
||||
<ul class="list">
|
||||
<p>More like this:</p>
|
||||
{% for tag in post.tags %}
|
||||
<li class="tag"><a href="/tags/{{tag.getUrlSafeTitle()}}">{{ tag.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul
|
||||
</div>
|
||||
</article>
|
||||
{% endblock %}
|
||||
|
|
|
|||
28
templates/front/tag/detail.html.twig
Normal file
28
templates/front/tag/detail.html.twig
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Tags | Alex Daniels{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<section class="tag">
|
||||
{% if posts|length %}
|
||||
<div class="posts">
|
||||
<h2>Posts</h2>
|
||||
<ul>
|
||||
{% for post in posts %}
|
||||
<li><a href="/words/{{post.url}}">{{post.title}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if photos|length %}
|
||||
<div class="photos">
|
||||
<h2>Photos</h2>
|
||||
<ul>
|
||||
{% for photo in photos %}
|
||||
<li><a href="/photos/{{photo.url}}">{{photo.title}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
16
templates/front/tag/index.html.twig
Normal file
16
templates/front/tag/index.html.twig
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Tags | Alex Daniels{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<section class="tags">
|
||||
<h2>Tags</h2>
|
||||
<ul>
|
||||
{% for tag in tags %}
|
||||
<li>
|
||||
<a href="/tags/{{tag['urlSafeTitle']}}">{{tag['title']}} ({{tag['count']}})</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue