Skip to content

Commit

Permalink
DMS-109 Remove group from dataset (#27)
Browse files Browse the repository at this point in the history
* DMS-109 Button to remove a dataset from a group

* DMS-109 Set fixed height for category boxes
  • Loading branch information
jonathansberry authored Nov 2, 2022
1 parent 675789f commit 9f68770
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
13 changes: 13 additions & 0 deletions ckanext/dms/assets/css/dms.css
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ p.small {
border-radius: 4px;
margin-bottom: 24px;
padding: 20px;
height: 110px;
}

.category-box .group-thumbnail {
Expand Down Expand Up @@ -355,6 +356,16 @@ p.small {
height: 50px;
}

.category-box .btn-delete {
background: transparent;
color: #990005;
font-size: 20px;
padding: 20px;
position: absolute;
bottom: 10px;
right: 10px;
}

.dataset-resources li{
padding: 2px 6px;
background: #E9F1ED;
Expand Down Expand Up @@ -680,3 +691,5 @@ a.tag:hover {
.recently-updated .view-all-btn{
background-color: #990005;
}


29 changes: 29 additions & 0 deletions ckanext/dms/templates/group/snippets/group_item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% ckan_extends %}

{% set type = group.type or 'group' %}
{% set url = h.url_for(type ~ '.read', id=group.name) %}
{% block item %}

<div class="col-lg-4 col-md-6 col-xs-12">
<div class="category-box">
<img src="{{ group.image_display_url or h.url_for_static('/base/images/placeholder-group.png') }}" alt="{{ group.name }}" class="media-image group-thumbnail">
<div class="group-text">
<div class="title">
<a href="{{ url }}">{{ group.title }}</a>
</div>
{% if group.package_count %}
<div class="desc">{{ ungettext('{num} Dataset', '{num} Datasets', group.package_count).format(num=group.package_count) }}</div>
{% endif %}
{% if group.user_member %}
<button name="group_remove.{{ group.id }}"
type="submit"
class="btn btn-delete btn-sm media-edit"
title="{{_('Remove dataset from this group')}}"/>
<i class="fa fa-remove"> </i>
</button>
{% endif %}
</div>
</div>
</div>

{% endblock %}
12 changes: 1 addition & 11 deletions ckanext/dms/templates/group/snippets/group_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@
{% set groups = groups %}
<div class="row">
{% for group in groups %}
<div class="col-lg-4 col-md-6 col-xs-12">
<div class="category-box">
<img src="{{ group.image_display_url or h.url_for_static('/base/images/placeholder-group.png') }}" alt="{{ group.name }}" class="media-image group-thumbnail">
<div class="group-text">
<div class="title">
<a href="{{ h.url_for('/group/' + group.name) }}">{{ group.title }}</a>
</div>
<div class="desc">{{ h.markdown_extract(group.description, extract_length=70) }}</div>
</div>
</div>
</div>
{% snippet "group/snippets/group_item.html", group=group, position=loop.index %}
{% endfor %}
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion ckanext/dms/templates/package/group_list.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "package/read_base.html" %}
{% ckan_extends %}
{% import 'macros/form.html' as form %}

{% block primary_content_inner %}
Expand Down

0 comments on commit 9f68770

Please sign in to comment.