Quellcode durchsuchen

some work on linked resources

joel
Simon Bowie vor 2 Jahren
Ursprung
Commit
a774098e25
3 geänderte Dateien mit 26 neuen und 5 gelöschten Zeilen
  1. +12
    -4
      web/app/resources.py
  2. +2
    -1
      web/app/static/styles/custom.css
  3. +12
    -0
      web/app/templates/resource.html

+ 12
- 4
web/app/resources.py Datei anzeigen

@@ -21,11 +21,19 @@ def get_resource(resource_id):

# function to retrieve linked resources
def get_linked_resources(resource_id):
relationships = Relationship.query.filter_by(first_resource_id=resource_id).first()
relationships = Relationship.query.filter_by(first_resource_id=resource_id).all()
if relationships:
resource_id = relationships.second_resource_id
resources = Resource.query.filter_by(id=resource_id).all()
return resources
for relationship in relationships:
resource_id = relationship.second_resource_id
links = Resource.query.filter_by(id=resource_id).all()
return links
else:
relationships = Relationship.query.filter_by(second_resource_id=resource_id).all()
if relationships:
for relationship in relationships:
resource_id = relationship.first_resource_id
links = Resource.query.filter_by(id=resource_id).all()
return links

# function to delete a single resource
def delete_resource(resource_id):

+ 2
- 1
web/app/static/styles/custom.css Datei anzeigen

@@ -534,7 +534,8 @@ textarea.form-control {
.layer-bg {
position: absolute;
bottom: 0;
left: 0
left: 0;
z-index:-1;
}

.progress-wrapper {

+ 12
- 0
web/app/templates/resource.html Datei anzeigen

@@ -135,6 +135,18 @@
<div class="row">
{% for link in links %}
<div class="col-md-4 col-sm-6 py-3">
{% if link['type'] == 'tool' %}
<div class="card text-dark bg-tool mb-3">
<div class="card-body">
<a href="{{ url_for('tool.show_tool', tool_id=link['id']) }}">
<h3 class="card-title text-center text-dark">{{ link['name'] }}</h3>
</a>
<p class="card-text">
{{ link['description']|truncate(100) }}
</p>
</div>
</div>
{% endif %}
{% if link['type'] == 'practice' %}
<div class="card text-dark bg-practice mb-3">
<div class="card-body">

Laden…
Abbrechen
Speichern