Skip to content

Commit

Permalink
Init UI update for resources detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpirix committed Oct 11, 2024
1 parent d323db9 commit 7b0e567
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 87 deletions.
9 changes: 0 additions & 9 deletions qgis-app/templates/base/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ <h2 xmlns="http://www.w3.org/1999/html">QGIS {{ resource_name }}</h2>
<style>
div.style-polaroid{
width: 100%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-align: center;
margin-top: 23px;
}
div.style-polaroid, div.span12.license {
margin-left: 1em;
}
div.span12.license {
margin-bottom: 5em;
}
.style-title {
margin-bottom: 0;
padding-bottom: 0;
}
</style>
{% endblock %}

Expand Down
104 changes: 63 additions & 41 deletions qgis-app/templates/base/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,72 @@
{% endblock %}

{% block content %}
<h3 class="style-title">{{ object_detail.name }}</h3>
{% if user == object_detail.creator or user.is_staff %}
<div class="row pull-right">
<a class="btn btn-primary btn-mini" href="{% url url_update object_detail.id %}" title="{% trans "Edit" %}"><i class="icon-pencil icon-white"></i></a>&nbsp
<a class="btn btn-danger btn-mini" href="{% url url_delete object_detail.id %}" title="{% trans "Delete" %}"><i class="icon-remove icon-white"></i></a>&nbsp
</div>
{% endif %}
<hr />
<div class="row">
<div class="span4 mb-5 view-resource">
<div class="style-polaroid">
{% if object_detail.thumbnail_image and object_detail.thumbnail_image.file %}
{% thumbnail object_detail.thumbnail_image "420x420" format="PNG" as im %}
<img class="image-resource" alt="{% trans "image" %}" src="{{ im.url }}" width="{{ im.x }}" height="{{ im.y }}" />
{% endthumbnail %}
{% endif %}
{% if is_3d_model %}
{% include "base/includes/wavefront/detail_3dviewer.html" %}
{% else %}
</div>
{% endif %}
</div>
<div class="span6 info-resource">
<dl class="dl-horizontal">
{% include "base/includes/detail_object.html" %}
<dt>{{ resource_name }} File</dt>
<dd>
<div>
{% if object_detail.file and object_detail.file.file %}
<a class="btn btn-primary btn-mini" href="{% url url_download object_detail.id %}" title="{% trans "Download" %}"><i class="icon-download-alt"></i> Download</a>
{% else %}
<em>File missing: The resource file couldn't be located.</em>
{% endif %}
</div>
</dd>
</dl>
</div>

{% if license_template %}
{% include license_template %}
<div class="box-content">
<div class="columns">
<div class="column is-6">
<h3 class="title is-4">{{ object_detail.name }}</h3>
</div>
<div class="column is-6 has-text-right">
{% if user == object_detail.creator or user.is_staff %}
<div>
<a class="button is-success is-small is-outlined" href="{% url url_update object_detail.id %}" title="{% trans "Edit" %}">
<span class="icon is-small">
<i class="fas fa-pencil-alt"></i>
</span>
</a>
<a class="button is-danger is-small is-outlined" href="{% url url_delete object_detail.id %}" title="{% trans "Delete" %}">
<span class="icon is-small">
<i class="fas fa-trash-alt"></i>
</span>
</a>
{% if object_detail.file and object_detail.file.file %}
<button class="button is-small"
onclick="location.href='{% url url_download object_detail.id %}'"
title="{% trans "Download" %}">
<span class="icon is-small">
<i class="fas fa-download"></i>
</span>
<span>{% trans "Download" %}</span>
</button>
{% else %}
<button class="button is-small"
title="{% trans "File missing: The resource file couldn't be located." %}"
disabled>
<span class="icon is-small">
<i class="fas fa-exclamation-triangle"></i>
</span>
<span>{% trans "File missing" %}</span>
</button>
{% endif %}

</div>
{% endif %}
</div>
</div>
<hr />
<div class="columns">
<div class="column is-6 is-flex is-justify-content-center is-align-items-start">
<div class="style-polaroid">
{% if object_detail.thumbnail_image and object_detail.thumbnail_image.file %}
{% thumbnail object_detail.thumbnail_image "420x420" format="PNG" as im %}
<img class="image-resource" alt="{% trans "image" %}" src="{{ im.url }}" width="{{ im.x }}" height="{{ im.y }}" />
{% endthumbnail %}
{% endif %}
{% if is_3d_model %}
{% include "base/includes/wavefront/detail_3dviewer.html" %}
{% endif %}
</div>

</div>
<div class="column is-6">
{% include "base/includes/detail_object.html" %}

</div>
</div>
<hr />
{% if license_template %}
{% include license_template %}
{% endif %}
</div>

{% for js_src in js %}
<script type="{% if not js_src.type %}text/javascript{% else %}{{ js_src.type }}{% endif %}" src="{% static js_src.src %}"></script>
Expand Down
83 changes: 57 additions & 26 deletions qgis-app/templates/base/includes/detail_object.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,58 @@
{% load i18n resources_custom_tags%}

<dd></dd>
<dt>Name</dt>
<dd>{{ object_detail.name }}</dd>
<dt>Description</dt>
<dd>{{ object_detail.description|md_to_html }}</dd>
<dt>Uploaded Date</dt>
<dd>{{ object_detail.upload_date|date:"d F Y" }}</dd>
{% if object_detail.review_set.last.review_date and object_detail.approved%}
<dt>Approved Date</dt>
<dd>{{ object_detail.review_set.last.review_date|date:"d F Y"}}</dd>
{% endif %}
<dt>Modified Date</dt>
<dd>{{ object_detail.modified_date|date:"d F Y" }}</dd>
<dt>Creator</dt>
<dd>{{ object_detail.get_creator_name|title }}</dd>
{% if is_qlr %}
{% include "base/includes/layerdefinition/detail_datasource.html" %}
{% endif %}
{# for style app sharing only #}
{% if object_detail.style_type %}
<dt>Type</dt>
<dd>
{{ object_detail.style_type.name }}
</dd>
{% endif %}
<div class="columns is-multiline">
<div class="column is-12">
<label class="label">{% trans "Description" %}:</label>
<div>
{{ object_detail.description|md_to_html }}
</div>
</div>
<div class="column is-6">
<div class="field">
<label class="label">{% trans "Uploaded Date" %}:</label>
<div class="control truncate">
{{ object_detail.upload_date|date:"d F Y" }}
</div>
</div>
</div>
{% if object_detail.review_set.last.review_date and object_detail.approved %}
<div class="column is-6">
<div class="field">
<label class="label">{% trans "Approved Date" %}:</label>
<div class="control truncate">
{{ object_detail.review_set.last.review_date|date:"d F Y" }}
</div>
</div>
</div>
{% endif %}
<div class="column is-6">
<div class="field">
<label class="label">{% trans "Modified Date" %}:</label>
<div class="control truncate">
{{ object_detail.modified_date|date:"d F Y" }}
</div>
</div>
</div>
<div class="column is-6">
<div class="field">
<label class="label">{% trans "Creator" %}:</label>
<div class="control truncate">
{{ object_detail.get_creator_name|title }}
</div>
</div>
</div>
{% if is_qlr %}
<div class="column is-6">
{% include "base/includes/layerdefinition/detail_datasource.html" %}
</div>
{% endif %}
{% if object_detail.style_type %}
<div class="column is-6">
<div class="field">
<label class="label">{% trans "Type" %}:</label>
<div class="control truncate">
{{ object_detail.style_type.name }}
</div>
</div>
</div>
{% endif %}
</div>
24 changes: 14 additions & 10 deletions qgis-app/templates/base/includes/license.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{% load static %}
<div class="span12 license">
<div class="media" style="margin-top: 2rem">
<a class="pull-left" href="#">
<img src="{% static 'images/cc-zero.svg' %}">
</a>
<div class="media-body">
<p>This {{ resource_name }} is made available under the <a href="https://creativecommons.org/publicdomain/zero/1.0/" target="_blank">CC-0 license</a>.</p>
</div>
</div>
</div>
<div>
<div class="media" style="margin-top: 2rem">
<figure class="ml-0 mb-0">
<p class="image">
<img src="{% static 'images/cc-zero.svg' %}">
</p>
</figure>
<div class="media-content">
<div class="content">
<p>This {{ resource_name }} is made available under the <a href="https://creativecommons.org/publicdomain/zero/1.0/" target="_blank">CC-0 license</a>.</p>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
<img alt="{% trans "image" %}" src="{% static 'wavefront/img/cube-3d.png' %}" width="{{ im.x }}" height="{{ im.y }}" />
{% endthumbnail %}
</div>
</div>
<div id="urlView" data-url="{{ obj_url }}" data-mtl-url="{{ mtl_url }}"></div>

0 comments on commit 7b0e567

Please sign in to comment.