Skip to content

Commit 316fd3b

Browse files
authored
Add image size to fix image uploader (#649)
* Add image size to fix image uploader * Fix image/icon alignment
1 parent ed20a80 commit 316fd3b

File tree

11 files changed

+63
-26
lines changed

11 files changed

+63
-26
lines changed

ckanext/querytool/assets/css/public-query-tool.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ckanext/querytool/assets/less/public-query-tool.less

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ div[class^="dt-header"] {
889889
margin-right: 0;
890890
margin-left: 0;
891891
--bs-gutter-x: 0;
892+
margin-bottom: 25px;
892893
}
893894

894895
.home-groups {
@@ -898,3 +899,39 @@ div[class^="dt-header"] {
898899
.home-groups-col {
899900
width: 100%;
900901
}
902+
903+
.querytool-thumbnail {
904+
max-width: 100px !important;
905+
float: left;
906+
margin-right: 30px;
907+
padding-top: 25px;
908+
}
909+
910+
.querytool-thumbnail-groups {
911+
max-width: 100px !important;
912+
float: left;
913+
margin-right: 15px;
914+
margin-top: 4px;
915+
}
916+
917+
.querytool-thumbnail-groups-report {
918+
max-width: 100px !important;
919+
margin-top: 8px;
920+
}
921+
922+
.querytool-thumbnail-default {
923+
float: left;
924+
margin-right: 30px;
925+
padding-top: 25px;
926+
}
927+
928+
.box-content.bc-querytool {
929+
display: flex;
930+
align-items: flex-start
931+
}
932+
933+
h3.media-heading {
934+
margin-bottom: 6px !important;
935+
font-weight: bold !important;
936+
font-size: 1.5em !important;
937+
}

ckanext/querytool/assets/style.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,9 +1279,7 @@ body {
12791279
margin-right: 20px;
12801280
}
12811281
.group-image img {
1282-
max-width: 100% !important;
12831282
max-height: 100% !important;
1284-
margin: 0 auto !important;
12851283
}
12861284
.tool-title {
12871285
margin: 0 0 0 0 !important;

ckanext/querytool/controllers/querytool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def line_attr_search(data, id, line_attr):
652652
.format(
653653
id),
654654
'False')
655-
upload.upload(uploader)
655+
upload.upload(uploader.get_max_image_size())
656656
image_url = upload.filename
657657

658658
image['url'] = image_url

ckanext/querytool/logic/action/update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def querytool_update(context, data_dict):
126126
upload.update_data_dict(
127127
data_dict, 'image_url', 'image_upload', 'clear_upload'
128128
)
129-
upload.upload(uploader)
129+
upload.upload(uploader.get_max_image_size())
130130
data_dict['image_display_url'] = upload.filename
131131
data['image_display_url'] = upload.filename
132132
else:
@@ -187,7 +187,7 @@ def querytool_visualizations_update(context, data_dict):
187187
upload.update_data_dict(
188188
new_data, "image_url", "image_upload", "clear_upload"
189189
)
190-
upload.upload(uploader)
190+
upload.upload(uploader.get_max_image_size())
191191

192192
if not visualizations:
193193
visualizations = CkanextQueryToolVisualizations()

ckanext/querytool/templates/group/reports.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% if h.get_groups_for_user(userobj, report.group) and (member_type == 'member' or member_type == 'admin' or userobj.sysadmin) %}
2020
<div class="applicaitons-box">
2121

22-
<div class="thumb">
22+
<div class="querytool-thumbnail-groups">
2323
{% if report.image_display_url %}
2424
{% if 'http' in report.image_display_url %}
2525
<img src="{{ report.image_display_url }}" alt="{{ report.name }}" style="max-width: 100% !important;" />
@@ -40,7 +40,7 @@
4040
{{ _('Private') }}
4141
</span>
4242
{% endif %}
43-
<h2>{{ report.title }}</h2>
43+
<h3 class="media-heading">{{ report.title }}</h3>
4444

4545
<p class="muted">{{ h.markdown_extract(report.description, extract_length=150) }}</p>
4646
<p>{{_('Used dataset:')}} <a href="{{ h.url_for('dataset.read', id=report.dataset_name)}}">{{ report.dataset_name }}</a></p>
@@ -87,7 +87,7 @@ <h2>{{ report.title }}</h2>
8787
{{ _('Private') }}
8888
</span>
8989
{% endif %}
90-
<h2>{{ report.title }}</h2>
90+
<h3 class="media-heading">{{ report.title }}</h3>
9191

9292
<p class="muted">{{ h.markdown_extract(report.description, extract_length=150) }}</p>
9393
<p>{{_('Used dataset:')}} <a href="{{ h.url_for('dataset.read', id=report.dataset_name)}}">{{ report.dataset_name }}</a></p>

ckanext/querytool/templates/group/snippets/group_item.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{% block item %}
1717
<li style="border-bottom: 1px solid rgb(191, 191, 191); padding-bottom: 20px; padding-top: 20px;">
1818
{% block item_inner %}
19-
<div class="group-image" style="margin-top:15px;">
19+
<div class="group-image" style="margin-top:22px;">
2020
{% block image %}
2121
<img src="{{ group.image_display_url or h.url_for_static('/base/images/folder-icon-2.svg') }}" alt="{{ group.name }}" >
2222
{% endblock %}

ckanext/querytool/templates/querytool/public/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
{% block page_header_bg %}{% endblock %}
2424

25-
{% block page_header_icon %}<img class="thumbnail" src="{{ group.image_display_url }}" style="width: 100px;">{% endblock %}
25+
{% block page_header_icon %}<img class="thumbnail" src="{{ group.image_display_url }}" style="width: 100px; margin-bottom: 30px;">{% endblock %}
2626

2727
{% block page_header_title %}<h1>{{ group.title }}</h1>{% endblock %}
2828

ckanext/querytool/templates/querytool/public/snippets/query_tool_list_item.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,36 @@
22
The title of the querytool. name - Name of the tool Example usage: {% snippet
33
'querytool/public/snippets/query_tool.html', querytool=data %} #}
44
<div class="group-box">
5-
<div class="box-content">
5+
<div class="box-content bc-querytool">
66
{% if querytool.image_display_url %}
77
{% if 'http' in querytool.image_display_url %}
8-
<img
8+
<img class="querytool-thumbnail"
99
src="{{ querytool.image_display_url }}"
10-
alt="{{ querytool.image_url }}" style="max-width: 100px !important; float: left; margin-right: 20px; margin-top: 15px;" />
10+
alt="{{ querytool.image_url }}" />
1111
{% else %}
12-
<img
12+
<img class="querytool-thumbnail"
1313
src="/uploads/querytool/{{ querytool.image_display_url }}"
14-
alt="{{ querytool.image_url }}" style="max-width: 100px !important; float: left; margin-right: 20px; margin-top: 15px;" />
14+
alt="{{ querytool.image_url }}" />
1515
{% endif %}
1616
{% elif querytool.image_url %}
1717
{% if 'http' in querytool.image_url %}
18-
<img
18+
<img class="querytool-thumbnail"
1919
src="{{ querytool.image_url }}"
20-
alt="{{ querytool.image_url }}" style="max-width: 100px !important; float: left; margin-right: 20px; margin-top: 15px;" />
20+
alt="{{ querytool.image_url }}" />
2121
{% else %}
22-
<img
22+
<img class="querytool-thumbnail"
2323
src="/uploads/querytool/{{ querytool.image_url }}"
24-
alt="{{ querytool.image_url }}" style="max-width: 100px !important; float: left; margin-right: 20px; margin-top: 15px;" />
24+
alt="{{ querytool.image_url }}" />
2525
{% endif %}
2626
{% elif querytool.icon %}
2727
<i class="thumbnail fa-3x {{ querytool.icon }}"></i>
2828
{% else %}
29-
<img class="thumbnail"
29+
<img class="querytool-thumbnail-default"
3030
src="/base/images/folder-icon-2.svg"
3131
width="70"
32-
alt="" style="max-width: 100% !important;" />
32+
alt="" />
3333
{% endif %}
34+
<div>
3435
{% set tool = "/querytool/public/{{ querytool.name }}?parent={{ parent }}&from_parent=True&title={{ parent_title | safe }}" %}
3536
{% if parent and from_parent and parent_title %}
3637
<a class="query-tool"
@@ -40,6 +41,7 @@
4041
{% endif %}
4142
<span class="short-desc">{{ h.render_markdown(h.get_translated(querytool, 'description') , True,
4243
True) }}</span>
44+
</div>
4345
</div>
4446
<p class="clearfix"></p>
4547
</div>

ckanext/querytool/templates/report/snippets/report_item.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
{% if report.image_display_url %}
1818
{% if 'http' in report.image_display_url %}
19-
<img src="{{ report.image_display_url }}" alt="{{ report.name }}" />
19+
<img class="querytool-thumbnail-groups-report" src="{{ report.image_display_url }}" alt="{{ report.name }}" />
2020
{% else %}
21-
<img src="/uploads/querytool/{{ report.image_display_url }}" alt="{{ report.name }}" />
21+
<img class="querytool-thumbnail-groups-report" src="/uploads/querytool/{{ report.image_display_url }}" alt="{{ report.name }}" />
2222
{% endif %}
2323
{% else %}
24-
<img src="/base/images/icon-1.svg" alt="{{ report.name }}" />
24+
<img class="querytool-thumbnail-groups-report" src="/base/images/icon-1.svg" alt="{{ report.name }}" />
2525
{% endif %}
2626
{% endblock %}
2727
</div>

0 commit comments

Comments
 (0)