mirror of
https://github.com/DerTyp7/tealcode-django-python.git
synced 2025-11-01 13:42:30 +01:00
added tags
This commit is contained in:
18
TealCode/main/migrations/0004_topic_tags.py
Normal file
18
TealCode/main/migrations/0004_topic_tags.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.9 on 2021-11-11 07:15
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0003_topic_version'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='topic',
|
||||||
|
name='tags',
|
||||||
|
field=models.CharField(blank=True, max_length=200),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -16,6 +16,7 @@ class Topic(models.Model):
|
|||||||
date_created = models.DateTimeField(default=timezone.now)
|
date_created = models.DateTimeField(default=timezone.now)
|
||||||
category = models.ForeignKey(Category, on_delete=models.CASCADE)
|
category = models.ForeignKey(Category, on_delete=models.CASCADE)
|
||||||
version = models.CharField(max_length=100, blank=True)
|
version = models.CharField(max_length=100, blank=True)
|
||||||
|
tags = models.CharField(max_length=200, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.category.title + " - " + self.title
|
return self.category.title + " - " + self.title
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ body main #main-content .note p{
|
|||||||
|
|
||||||
#button-content div{
|
#button-content div{
|
||||||
height: 60px;
|
height: 60px;
|
||||||
width: 200px;
|
width: 150px;
|
||||||
margin-left: 25px;
|
margin-left: 60px;
|
||||||
display: block;
|
display: block;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
@@ -150,8 +150,8 @@ body main #main-content .note p{
|
|||||||
font-size: 13pt;
|
font-size: 13pt;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding-top: 15px;
|
padding-top: 10px;
|
||||||
padding-bottom: 15px;
|
padding-bottom: 10px;
|
||||||
background-color: rgba(95, 255, 175, 0.1);
|
background-color: rgba(95, 255, 175, 0.1);
|
||||||
border: 5px solid rgb(34, 102, 71);
|
border: 5px solid rgb(34, 102, 71);
|
||||||
transition: 0.1s;
|
transition: 0.1s;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<div class="list-item" onclick="openTopic('{{ topic.title }}')">
|
<div class="list-item" onclick="openTopic('{{ topic.title }}')">
|
||||||
<!--<img src="c_icon.png"/>-->
|
<!--<img src="c_icon.png"/>-->
|
||||||
<p>{{ topic.title }}</p>
|
<p>{{ topic.title }}</p>
|
||||||
|
<small style="display:none;">{{ topic.tags }}</small>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -33,10 +34,12 @@
|
|||||||
for (let index = 0; index < items.length; index++) {
|
for (let index = 0; index < items.length; index++) {
|
||||||
const item = items[index];
|
const item = items[index];
|
||||||
const p = item.getElementsByTagName("p")[0];
|
const p = item.getElementsByTagName("p")[0];
|
||||||
|
const tags = item.getElementsByTagName("small")[0].innerHTML;
|
||||||
|
var value = input.value.toLowerCase().replace(".", "").replace(";", "").replace(",", "").replace(" ", "")
|
||||||
|
|
||||||
item.style.display = "none";
|
item.style.display = "none";
|
||||||
|
|
||||||
if(p.innerHTML.toLowerCase().includes(input.value.toLowerCase())){
|
if(p.innerHTML.toLowerCase().includes(value) || tags.toLowerCase().includes(value)){
|
||||||
item.style.display = "block";
|
item.style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user