Skip to content

Commit

Permalink
[update][l]: dataset and homepage updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sneha-sharma12 committed Apr 7, 2024
1 parent 0e1b085 commit a59b0c2
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 39 deletions.
22 changes: 19 additions & 3 deletions ckanext/ubdc/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7681,6 +7681,10 @@ a.tag:hover {
padding: 7px 25px;
}

.nav-item > a > span.item-label {
text-transform: capitalize;
}

.nav-item.active,
.nav-aside li.active {
background-color: #f6f6f6;
Expand Down Expand Up @@ -8583,8 +8587,16 @@ select[data-module=autocomplete] {

.dataset-item {
border-bottom: 1px dotted #ddd;
padding-bottom: 20px;
margin-bottom: 20px;
padding-bottom: 4rem;
margin-bottom: 4rem;
}
.dataset-item a {
color: #000000;
text-decoration: none;
}
.dataset-item:hover {
background-color: rgba(0, 0, 0, 0.04);
cursor: pointer;
}

@media (max-width: 991px) {
Expand Down Expand Up @@ -8663,7 +8675,7 @@ select[data-module=autocomplete] {
border-radius: 3px;
}
.resource-item:hover {
background-color: #eee;
background-color: transparent;
}

.resource-item .heading {
Expand Down Expand Up @@ -9098,6 +9110,10 @@ td.diff_header {
margin-bottom: 10px;
}

.dataset-count {
margin-top: 3.5rem;
}

@media (min-width: 992px) {
.search-form .control-order-by {
float: right;
Expand Down
14 changes: 11 additions & 3 deletions ckanext/ubdc/public/base/scss/_dataset.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
.dataset-item {
border-bottom: 1px dotted $genericBorderColor;
padding-bottom: 20px;
margin-bottom: 20px;
padding-bottom: 4rem;
margin-bottom: 4rem;
a {
color: $black;
text-decoration: none;
}
&:hover {
background-color: $dark-overlay-color;
cursor: pointer;
}
}

@media (max-width: $screen-sm-max) {
Expand Down Expand Up @@ -82,7 +90,7 @@
margin-bottom: 0px;
@include border-radius(3px);
&:hover {
background-color: $layoutBackgroundColor;
background-color: transparent;
}
}

Expand Down
4 changes: 4 additions & 0 deletions ckanext/ubdc/public/base/scss/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
padding: 7px ($gutterX);
}

.nav-item > a > span.item-label {
text-transform: capitalize;
}

.nav-item.active,
.nav-aside li.active {
background-color: $navActiveBackgroundColor;
Expand Down
4 changes: 4 additions & 0 deletions ckanext/ubdc/public/base/scss/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
}
}

.dataset-count {
margin-top: 3.5rem;
}

@media (min-width: $screen-md-min) {
.search-form .control-order-by {
float: right;
Expand Down
2 changes: 2 additions & 0 deletions ckanext/ubdc/public/base/scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,5 @@ $activityColorDelete: #B95252;

// Navigation
$zindex-navbar: 1;

$dark-overlay-color: rgba(0, 0, 0, 0.04);
2 changes: 1 addition & 1 deletion ckanext/ubdc/templates/home/snippets/popular.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>- {{ _('Most Popular Datasets') }} - </h3>
</a>
{% endfor %}
</div>
<p class="more"><a href="/dataset/">More Datasets →</a> </p>
<p class="more"><a href="/datasets/">More Datasets →</a> </p>
</div>
</div>
</section>
46 changes: 30 additions & 16 deletions ckanext/ubdc/templates/scheming/package/read.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
{% ckan_extends %}
{% block primary_content_inner %}

{% block package_notes %}
{% set licensed=['notspecified','other-at','other-closed','other-nc'] %}
{% if pkg.license_id and pkg.license_id in licensed %}
<div class="access-request-container">
<a class="btn btn-primary" href="{{ h.url_for('ubdc.access_request') }}" title="{{ _('Form') }}">
<i class="fa fa-key"></i>
{{ _("Request data") }}
</a>
</div>
{% endif %}

{% block package_notes %}
{% set licensed=['notspecified','other-at','other-closed','other-nc'] %}
{% if pkg.license_id and pkg.license_id in licensed %}
<div class="access-request-container">
<a class="btn btn-primary" href="{{ h.url_for('ubdc.access_request') }}" title="{{ _('Form') }}">
<i class="fa fa-key"></i>
{{ _("Request data") }}
</a>
</div>
{% endif %}
{% block package_resources %}
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources, is_activity_archive=is_activity_archive %}
{% endblock %}

{% if pkg.notes %}
<div class="notes embedded-content">
{{ h.render_markdown(h.get_translated(pkg, 'notes')) }}
</div>
{% endif %}
{% endblock %}
{% if pkg.notes %}
<div class="notes embedded-content">
{{ h.render_markdown(h.get_translated(pkg, 'notes')) }}
</div>
{% endif %}
{% endblock %}
{% block package_tags %}
{% snippet "package/snippets/tags.html", tags=pkg.tags %}
{% endblock %}

{% block package_additional_info %}

{{ super ()}}
{% endblock %}
{% endblock %}
97 changes: 83 additions & 14 deletions ckanext/ubdc/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,85 @@
{% ckan_extends %}
{#
Displays a single of dataset.

package - A package to display.
item_class - The class name to use on the list item.
hide_resources - If true hides the resources (default: false).
banner - If true displays a popular banner (default: false).
truncate - The length to trucate the description to (default: 180)
truncate_title - The length to truncate the title to (default: 80).

Example:

{% snippet 'snippets/package_item.html', package=c.datasets[0] %}

#}
{% set truncate = truncate or 180 %}
{% set truncate_title = truncate_title or 80 %}
{% set title = package.title or package.name %}
{% set notes = h.markdown_extract(package.notes, extract_length=truncate) %}
{% set ga_tag_id = ['ga-dataset-', package.name] | join('') %}

{% set ga_tag_id = ['ga-dataset-', package.name] | join('') %}

{% block package_item %}
<li class="{{ item_class or "dataset-item" }}">
{% block content %}
<a href="{{ h.url_for('%s.read' % package.type, id=package.name ) }}" title="{{ title }}">

{% block heading_title %}
{{ h.link_to(h.truncate(title, truncate_title), h.url_for('%s.read' % package.type, id=package.name ), id=ga_tag_id) }}
{% endblock %}


{% block resources_inner %}
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<li>
<span id={{ga_tag_id}} class="label label-default" data-format="{{ resource.lower() }}">{{ resource }}</span>
</li>
{% endfor %}
{% endblock %}
<div class="dataset-content">
{% block heading %}
<h2 class="dataset-heading">
{% block heading_private %}
{% if package.private %}
<span class="dataset-private label label-inverse">
<i class="fa fa-lock"></i>
{{ _('Private') }}
</span>
{% endif %}
{% endblock %}

{% block heading_title %}
{{ h.truncate(title, truncate_title) }}
{% endblock %}
{% block heading_meta %}
{% if package.get('state', '').startswith('draft') %}
<span class="label label-info">{{ _('Draft') }}</span>
{% elif package.get('state', '').startswith('deleted') %}
<span class="label label-danger">{{ _('Deleted') }}</span>
{% endif %}
{{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }}
{% endblock %}
</h2>

{% endblock %}
{% block banner %}
{% if banner %}
<span class="banner">{{ _('Popular') }}</span>
{% endif %}
{% endblock %}
{% block notes %}
{% if notes %}
<div>{{ notes|urlize }}</div>
{% else %}
<p class="empty">{{ _("This dataset has no description") }}</p>
{% endif %}
{% endblock %}
</div>
{% block resources %}
{% if package.resources and not hide_resources %}
{% block resources_outer %}
<ul class="dataset-resources list-unstyled">
{% block resources_inner %}
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<li>
<span id={{ga_tag_id}} class="label label-default" data-format="{{ resource.lower() }}">{{ resource }}</span>
</li>
{% endfor %}
{% endblock %}
</ul>
{% endblock %}
{% endif %}
{% endblock %}
</a>
{% endblock %}
</li>
{% endblock %}
2 changes: 1 addition & 1 deletion ckanext/ubdc/templates/snippets/search_form.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% ckan_extends %}

{% block search_title %}
<h4>
<h4 class="dataset-count">
{% if not error %}
{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}
{% else %}
Expand Down
8 changes: 7 additions & 1 deletion ckanext/ubdc/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ def org_redirect(path):
return redirect("/providers/{}".format(path))


@ubdc.route("/dataset")
@ubdc.route("/dataset/")
def dataset_redirect_root():
return redirect("/datasets")
original_query = tk.request.query_string.decode("utf-8")
if original_query:
target_url = '/datasets' + '?' + original_query
else:
target_url = '/datasets'
return redirect(target_url)


@ubdc.route("/dataset/<path:path>")
Expand Down

0 comments on commit a59b0c2

Please sign in to comment.