mirror of
https://github.com/ail-project/ail-framework.git
synced 2025-01-31 06:26:14 +00:00
chg: [chat explorer] show files tags
This commit is contained in:
parent
16bd61a559
commit
18dbd0002f
3 changed files with 25 additions and 5 deletions
|
@ -193,14 +193,14 @@ class Message(AbstractObject):
|
||||||
for it in self.get_correlation_iter('file-name', '', file_name, 'item'):
|
for it in self.get_correlation_iter('file-name', '', file_name, 'item'):
|
||||||
if file_name not in files:
|
if file_name not in files:
|
||||||
files[file_name] = []
|
files[file_name] = []
|
||||||
files[file_name].append(it[1:])
|
files[file_name].append({'obj': it[1:], 'tags': self.get_obj_tags('item', '', it[1:])})
|
||||||
s_files.add(it[1:])
|
s_files.add(it[1:])
|
||||||
nb_files += 1
|
nb_files += 1
|
||||||
if nb_files < self.get_nb_files():
|
if nb_files < self.get_nb_files():
|
||||||
files['undefined'] = []
|
files['undefined'] = []
|
||||||
for f in self.get_correlation('item').get('item'):
|
for f in self.get_correlation('item').get('item'):
|
||||||
if f[1:] not in s_files:
|
if f[1:] not in s_files:
|
||||||
files['undefined'].append(f[1:])
|
files['undefined'].append({'obj': f[1:], 'tags': self.get_obj_tags('item', '', f[1:])})
|
||||||
return files
|
return files
|
||||||
|
|
||||||
def get_reactions(self):
|
def get_reactions(self):
|
||||||
|
|
|
@ -109,6 +109,12 @@ class AbstractObject(ABC):
|
||||||
tags = list(tags)
|
tags = list(tags)
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
|
def get_obj_tags(self, obj_type, subtype, obj_id, r_list=False):
|
||||||
|
tags = Tag.get_object_tags(obj_type, obj_id, subtype)
|
||||||
|
if r_list:
|
||||||
|
tags = list(tags)
|
||||||
|
return tags
|
||||||
|
|
||||||
def add_tag(self, tag):
|
def add_tag(self, tag):
|
||||||
Tag.add_object_tag(tag, self.type, self.id, subtype=self.get_subtype(r_str=True))
|
Tag.add_object_tag(tag, self.type, self.id, subtype=self.get_subtype(r_str=True))
|
||||||
|
|
||||||
|
|
|
@ -134,15 +134,29 @@
|
||||||
{% if message['files'][file_name] | length > 1 %}
|
{% if message['files'][file_name] | length > 1 %}
|
||||||
<div class="flex-shrink-1 bg-white border-primary text-secondary rounded py-2 px-3 ml-4 mb-3" style="overflow-x: auto">
|
<div class="flex-shrink-1 bg-white border-primary text-secondary rounded py-2 px-3 ml-4 mb-3" style="overflow-x: auto">
|
||||||
<i class="far fa-file fa-3x"></i> {{ file_name }}
|
<i class="far fa-file fa-3x"></i> {{ file_name }}
|
||||||
{% for item in message['files'][file_name] %}
|
{% for obj in message['files'][file_name] %}
|
||||||
<br>
|
<br>
|
||||||
<a href="{{ url_for('objects_item.showItem') }}?id={{ item }}"><i class="far fa-file"></i> {{ loop.index }}</a>
|
<a href="{{ url_for('objects_item.showItem') }}?id={{ obj['obj'] }}"><i class="far fa-file"></i> {{ loop.index }}</a>
|
||||||
|
{% if obj['tags'] %}
|
||||||
|
<div>
|
||||||
|
{% for tag in obj['tags'] %}
|
||||||
|
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }}</span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ url_for('objects_item.showItem') }}?id={{ message['files'][file_name][0] }}">
|
<a href="{{ url_for('objects_item.showItem') }}?id={{ message['files'][file_name][0]['obj'] }}">
|
||||||
<div class="flex-shrink-1 bg-white border-primary text-primary rounded py-2 px-3 ml-4 mb-3" style="overflow-x: auto">
|
<div class="flex-shrink-1 bg-white border-primary text-primary rounded py-2 px-3 ml-4 mb-3" style="overflow-x: auto">
|
||||||
<i class="far fa-file fa-3x"></i> {{ file_name }}
|
<i class="far fa-file fa-3x"></i> {{ file_name }}
|
||||||
|
{% if message['files'][file_name][0]['tags'] %}
|
||||||
|
<div>
|
||||||
|
{% for tag in message['files'][file_name][0]['tags'] %}
|
||||||
|
<span class="badge badge-{{ bootstrap_label[loop.index0 % 5] }}">{{ tag }}</span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue