Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SXDEDPCXZIC-206 / Improve historical data view #238

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
31bb118
SXDEDPCXZIC-149 / upgrade ckanext-check-link
smotornyuk May 5, 2023
ceafd31
SXDEDPCXZIC-149 / override button label
smotornyuk May 5, 2023
ff0ca18
Merge remote-tracking branch 'origin/release-2.2.0' into release-2.3.0
mutantsan May 30, 2023
31ad1eb
SXDEDPCXZIC-164 / Save data record before adding data resources
mutantsan May 30, 2023
ad28fc3
SXDEDPCXZIC-161 / Display Data Visualisation on Record page for CSVs
mutantsan May 30, 2023
795252f
SXDEDPCXZIC-174_DATAVIC-537 / configurable org uploads
smotornyuk Jun 16, 2023
4b02a65
Merge pull request #206 from dpc-sdp/SXDEDPCXZIC-161
smotornyuk Jun 19, 2023
85bd9ff
SXDEDPCXZIC-178 / fix 500 error when resource has no views
smotornyuk Jun 19, 2023
dc91b41
Merge pull request #205 from dpc-sdp/SXDEDPCXZIC-164
joelwigley Jul 5, 2023
2fe4d6b
SXDEDPCXZIC-200 / changes to datatables
aleks-iv Aug 7, 2023
1d274e9
SXDEDPCXZIC-196 / fix html language attribute
aleks-iv Aug 7, 2023
6acf0d5
move gtm to the new GA extension
iaroslav13 Aug 8, 2023
f3c88fb
move gtm to the new GA extension
iaroslav13 Aug 8, 2023
df58804
move gtm to the new GA extension
iaroslav13 Aug 8, 2023
55d4416
move GTM to the new GA extension
iaroslav13 Aug 8, 2023
c5400fe
move gtm to the new ga extension
iaroslav13 Aug 8, 2023
6b05ba6
move gtm to the new ga extension
iaroslav13 Aug 8, 2023
18d5437
SXDEDPCXZIC-196 / fix html language attribute
aleks-iv Aug 8, 2023
e3db656
Merge pull request #232 from dpc-sdp/SXDEDPCXZIC-196
joelwigley Aug 8, 2023
4de510f
Merge pull request #229 from dpc-sdp/SXDEDPCXZIC-200
joelwigley Aug 9, 2023
eeb7b47
SXDEDPCXZIC-202_DATAVIC-598 / add search autosuggest
alexmorev Aug 13, 2023
7a42a16
SXDEDPCXZIC-206 / Improve historical data view
mutantsan Aug 18, 2023
34d8174
Merge branch 'master' into SXDEDPCXZIC-206
mutantsan Aug 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ckanext/datavic_iar_theme/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
CONFIG_HOTJAR_ENABLED = "ckan.tracking.hotjar_enabled"
CONFIG_HOTJAR_HJID = "ckan.tracking.hotjar.hjid"
CONFIG_HOTJAR_HJSV = "ckan.tracking.hotjar.hjsv"
CONFIG_GTM_CONTAINER_ID = "ckan.google_tag_manager.gtm_container_id"


def get_parent_site_url() -> str:
Expand All @@ -27,6 +26,3 @@ def get_hotjar_hsid() -> str | None:
def get_hotjar_hjsv() -> str | None:
return tk.config.get(CONFIG_HOTJAR_HJSV)


def get_gtm_container_id() -> str | None:
return tk.config.get(CONFIG_GTM_CONTAINER_ID)
81 changes: 81 additions & 0 deletions ckanext/datavic_iar_theme/grunt/sass/_datatables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
.dataTables_wrapper {
.dt-buttons {
.btn-secondary {
background-color: #f6f6f6;
padding: 16px 16px;
}

button[title="Table/List toggle"],
button[title="Toggle column visibility"],
button[title="Share current view"] {
display: none;
visibility: hidden;
}

button[title="Copy to clipboard"] {
border-top-left-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}

button[title="Print"] {
border-top-right-radius: 0.25rem !important;
border-top-right-radius: 0.25rem !important;
}

.btn-secondary {
background-color: #f6f6f6;
border: #dee2e6 solid 1px;
}
}

#dtprv_filter {
display: block;
text-align: left;
margin-top: 0;
float: none;

#filterinfoicon {
display: none;
}

label {
display: flex;
align-items: center;

input {
width: 100%;
}

&::after {
content: "";
}
}

}

.sortinfo, .resourceinfo {
display: none;
}

.dataTables_scroll
.dtr-control:before {
background-color: #3A833A !important;
}

#dtprv_paginate {
ul {
li {
&.active {
a {
background-color: #3A833A !important;
}
}
}
}
}

.pagination {
padding-top: 2.5rem;
}

}
36 changes: 36 additions & 0 deletions ckanext/datavic_iar_theme/grunt/sass/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,39 @@ $break-stages-text-small: 545px;
select.form-control {
appearance: auto;
}


.dataset-form {

.form-actions {
display: flex;
flex-direction: column;
gap: 10px;

.action-info {
margin: 0;
}

.btn {
width: 100%;
display: block;
}
}

@media (min-width: 768px) {
.form-actions {
flex-direction: row;
align-items: center;

.action-info {
min-width: 250px;
margin-right: 35px;
}

.btn {
height: fit-content;
max-width: 260px;
}
}
}
}
1 change: 1 addition & 0 deletions ckanext/datavic_iar_theme/grunt/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@
@import 'reporting';
@import 'login';
@import 'activity';
@import 'datatables';
39 changes: 26 additions & 13 deletions ckanext/datavic_iar_theme/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ def get_hotjar_hjsv():
return conf.get_hotjar_hjsv()


@helper
def get_gtm_container_id():
return conf.get_gtm_container_id()


@helper
def linked_user(user: str, maxlength: int = 0, avatar: int = 20):
"""Custom linked_user helper"""
Expand Down Expand Up @@ -127,17 +122,35 @@ def visibility_list() -> list[dict[str, str]]:

@helper
def featured_resource_preview(package: dict[str, Any]) -> Optional[dict[str, Any]]:
"""Return a featured resource preview if exists for a specific dataset"""
"""Return a featured resource preview
- It takes only CSV resources with an existing preview
- Only resources uploaded to datastore
- Only not historical resources
"""

featured_preview = None
if package.get("nominated_view_id", None):

resource_groups: list[list[dict[str, Any]]] = tk.h.group_resources_by_temporal_range(
package.get("resources", [])
)

resources = resource_groups[0] if resource_groups else []

for resource in resources:
if resource.get("format", "").lower() != "csv":
continue

if not resource.get("datastore_active"):
continue

try:
resource_view = tk.get_action("resource_view_show")(
{}, {"id": package["nominated_view_id"]}
)
resource = tk.get_action("resource_show")(
{}, {"id": resource_view["resource_id"]}
resource_views = tk.get_action("resource_view_list")(
{}, {"id": resource["id"]}
)
featured_preview = {"preview": resource_view, "resource": resource}
except tk.ObjectNotFound:
pass
else:
if resource_views:
featured_preview = {"preview": resource_views[0], "resource": resource}

return featured_preview
14 changes: 8 additions & 6 deletions ckanext/datavic_iar_theme/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
{% block head_extras %}
{{ super() }}

{% if h.vic_iar_get_gtm_container_id() %}
{% snippet "snippets/gtm_include.html" %}
{% endif %}

{% if h.vic_iar_hotjar_tracking_enabled() %}
{% snippet "snippets/hotjar.html" %}
{% endif %}
Expand All @@ -25,6 +21,12 @@
{% endblock %}

{%- block htmltag -%}
<!--[if IE 9]> <html lang="en_AU" class="ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en_AU"> <!--<![endif]-->
{% set lang = h.lang() %}

{% if lang == 'en_AU' %}
{% set lang = 'en-au' %}
{% endif %}

<!--[if IE 9]> <html lang="en-au" class="ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{{ lang }}"> <!--<![endif]-->
{%- endblock -%}
9 changes: 9 additions & 0 deletions ckanext/datavic_iar_theme/templates/check_link/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% ckan_extends %}

{% block check_link_action_download_csv %}
<li>
<a class="btn btn-primary" href="{{ h.remove_url_param("format", null, "csv") }}">
{{ _("Download link report") }}
</a>
</li>
{% endblock check_link_action_download_csv %}
13 changes: 13 additions & 0 deletions ckanext/datavic_iar_theme/templates/organization/edit_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% ckan_extends %}

{% block content_action %}
{% if organization and h.check_access('datavic_toggle_organization_uploads', {'id': organization.id}) %}
<form method="POST" class="d-inline" action="{{ h.url_for("datavicmain.toggle_organization_uploads", id=organization.id) }}">
<button type="submit" class="btn btn-default bg-warning">
<i class="fa fa-upload"></i>
{{ _("Disable uploads" if h.datavic_org_uploads_allowed(organization.id) else "Enable uploads") }}
</button>
</form>
{% endif %}
{{ super() }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% set resource_view = h.vic_iar_featured_resource_preview(pkg) %}

{% if request.args.get('no_preview') != '1' and resource_view %}
{% if resource_view %}
<section class="datapreview">
<h3>{{ _('Data preview') }}</h3>
<h3>{{ _('Data preview') }} - {{ resource_view.resource.name }}</h3>
<div class="resource-view">
{% snippet 'package/snippets/resource_view.html',
resource_view=resource_view['preview'],
resource=resource_view['resource'],
resource_view=resource_view.preview,
resource=resource_view.resource,
package=pkg
%}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,25 @@ <h1 class="header">
{%- endtrans -%}
</p>
{% endblock %}

{% block delete_button %}
{% if h.check_access('package_delete', {'id': data.id}) and not data.state == 'deleted' %}
<a class="btn btn-danger pull-left" href="{% url_for 'dataset.delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ confirmation_text }}{{ _('Are you sure you want to delete this dataset?') }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %}
{% endblock %}

{% block save_button %}
{% if form_style == 'edit' and is_dataset_harvested %}
{% asset 'ckanext-datavicmain/datavicmain-confirm-action' %}
<input type="hidden" name="save" value="true" />
<button class="btn btn-primary" type="submit" data-module="datavicmain-confirm-action" data-module-with-data=true data-module-content="{{ confirmation_text }}{{ _('Are you sure you want to update?') }}">{{ _('Update Dataset') }}</button>
{% elif form_style == "edit" and not is_dataset_harvested %}
<button class="btn btn-primary" type="submit" name="save">
{{ h.humanize_entity_type('package', pkg_dict.type, 'update label') or _('Update Dataset') }}
</button>
{% else %}
<button class="btn btn-primary" type="submit" name="save" >{% block save_button_text %}{{ _('Next: Add Data') }}{% endblock %}</button>
<button class="btn btn-primary" type="submit" name="save" value="save-without-resource">{{ _('Save record') }}</button>
<button class="btn btn-primary" type="submit" name="save" value="add-resources">{{ _('Save and add data') }}</button>
{% endif %}
{% endblock %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,8 @@
{% endif %}

<li class="{% if is_selected %} active{% endif %}" data-id="{{ view.id }}">

<a href="{{ url }}" data-id="{{ view.id }}">
<i class="fa icon fa-{{ h.resource_view_icon(view) }}"></i>
{{ view.title }}
</a>

{% if pkg.nominated_view_id == view.id %}
{% set url_denominate = h.url_for('datavicmain.denominate_view', package_id=pkg.id, view_id=view.id) %}
<form action="{{url_denominate}}" method="post">
{{ h.csrf_input() }}

<button type="submit" class="btn btn-danger">
{{ _('Stop showing this preview on Dataset page') }}
</button>
</form>
{% else %}

{% set url_nominate = h.url_for('datavicmain.nominate_view', package_id=pkg.id, view_id=view.id) %}
<form action="{{url_nominate}}" method="post">
{{ h.csrf_input() }}

<button type="submit" class="btn btn-success">
{{ _('Show this preview on Dataset page') }}
</button>
</form>
{% endif %}


</li>
3 changes: 0 additions & 3 deletions ckanext/datavic_iar_theme/templates/page.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% ckan_extends %}

{% block skip %}
{% if h.vic_iar_get_gtm_container_id() %}
{% snippet "snippets/gtm_include_noscript.html" %}
{% endif %}
{{ super() }}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,32 @@ <h2>
<form {% if form_id %}id="{{ form_id }}" {% endif %}class="rpl-form" action="{{ h.url_for('dataset.search') }}" method="get">
<input type="hidden" id="field-order-by" name="sort" value="{{ sorting_selected }}" />
<input type="hidden" id="field-visibility" name="visibility" value="{{ visibility_selected }}" />
<div class="rpl-search-form__field">
<div class="rpl-search-form__field" data-module="ckanext-search-autocomplete" data-module-suggestion-box="#search-autocomplete--suggestion-box" data-module-autocomplete-input="#search-query">
<label for="search-query">
<span class="rpl-search-form__label-text">Search for</span>
<input id="search-query" type="text" name="q" value="{{ query }}" autocomplete="off" placeholder="{{ placeholder }}" class="rpl-search-form__input">
</label>
{% block search_input_button %}
<button class="rpl-search-form__btn">
<span class="">Search</span>
<svg focusable="false" aria-hidden="true" class="rpl-icon rpl-icon--search rpl-icon--color_light_primary" style="width:24px;height:24px;" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path id="search-vector" fill-rule="evenodd" clip-rule="evenodd" d="M10.9895 9.24258C12.587 6.79233 12.2144 3.42261 9.85748 1.40991C7.58966 -0.526184 4.13776 -0.45993 1.94049 1.55707C-0.581665 3.87222 -0.645325 7.81287 1.75031 10.2102C3.79315 12.2547 6.95502 12.503 9.2771 10.967C9.30811 10.9465 9.37885 10.8841 9.47473 10.7944L13.8181 14.9887C14.192 15.3498 14.7879 15.3394 15.1489 14.9655C15.51 14.5916 15.4996 13.9958 15.1257 13.6347L10.8018 9.45914C10.8997 9.35345 10.9681 9.27545 10.9895 9.24258ZM2.96704 8.99216C1.3045 7.3284 1.3045 4.62128 2.96704 2.95752C4.62952 1.29376 7.33447 1.29334 8.99695 2.95752C10.6594 4.62128 10.6594 7.3284 8.99695 8.99216C7.33447 10.6559 4.62952 10.6559 2.96704 8.99216Z"
fill="inherit" />
</svg>
</button>
<button class="rpl-search-form__btn">
<span class="">Search</span>
<svg focusable="false" aria-hidden="true" class="rpl-icon rpl-icon--search rpl-icon--color_light_primary" style="width:24px;height:24px;" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path id="search-vector" fill-rule="evenodd" clip-rule="evenodd" d="M10.9895 9.24258C12.587 6.79233 12.2144 3.42261 9.85748 1.40991C7.58966 -0.526184 4.13776 -0.45993 1.94049 1.55707C-0.581665 3.87222 -0.645325 7.81287 1.75031 10.2102C3.79315 12.2547 6.95502 12.503 9.2771 10.967C9.30811 10.9465 9.37885 10.8841 9.47473 10.7944L13.8181 14.9887C14.192 15.3498 14.7879 15.3394 15.1489 14.9655C15.51 14.5916 15.4996 13.9958 15.1257 13.6347L10.8018 9.45914C10.8997 9.35345 10.9681 9.27545 10.9895 9.24258ZM2.96704 8.99216C1.3045 7.3284 1.3045 4.62128 2.96704 2.95752C4.62952 1.29376 7.33447 1.29334 8.99695 2.95752C10.6594 4.62128 10.6594 7.3284 8.99695 8.99216C7.33447 10.6559 4.62952 10.6559 2.96704 8.99216Z"
fill="inherit" />
</svg>
</button>
<ul id="search-autocomplete--suggestion-box" class="suggestion-box">
{% set suggestion_groups = [
('datasets', 'Relevant datasets'),
('categories','Browse filters')
]
%}

{% for section, label in suggestion_groups %}
<li data-section="{{ section }}" class="suggestion-section">
<ul class="suggestions" data-label="{{ _(label) }}"></ul>
</li>
{% endfor %}
</ul>
{% endblock %}
</div>
{% if facets %}
Expand Down
7 changes: 0 additions & 7 deletions ckanext/datavic_iar_theme/templates/snippets/gtm_include.html

This file was deleted.

This file was deleted.

Loading