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

Upgrade to CKAN 2.11 #30

Merged
merged 18 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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
52 changes: 29 additions & 23 deletions ckanext/dms/assets/css/dms-main.css
Original file line number Diff line number Diff line change
Expand Up @@ -4133,8 +4133,9 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
margin-bottom: 0px;
border: 1px solid transparent;
justify-content: flex-start;
}
@media (min-width: 768px) {
.navbar {
Expand Down Expand Up @@ -4164,7 +4165,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
box-shadow: none;
}
.navbar-collapse.collapse {
display: block !important;
/* display: block !important; */
ntwalibas marked this conversation as resolved.
Show resolved Hide resolved
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
Expand Down Expand Up @@ -4256,17 +4257,17 @@ select[multiple].input-group-sm > .input-group-btn > .btn {
margin-left: -15px;
}
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-right: 15px;
margin-top: 8px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
.navbar-light .navbar-toggler {
color: #990005;
margin-left: auto;
border-color: transparent;
}
.navbar-light .navbar-toggler:focus,
.navbar-light .navbar-toggler:active {
box-shadow: none;
}
.navbar-light .navbar-toggler > .fa {
font-size: 14px;
}
.navbar-toggle:focus {
outline: 0;
Expand Down Expand Up @@ -7670,7 +7671,7 @@ select[data-module="autocomplete"] {
width: 100%;
height: auto;
}
.simple-input .field .btn-search {
.site-search .btn{
position: absolute;
display: block;
height: 17px;
Expand All @@ -7686,7 +7687,7 @@ select[data-module="autocomplete"] {
-o-transition: color 0.2s ease-in;
transition: color 0.2s ease-in;
}
.simple-input .field .btn-search:hover {
.site-search .btn:hover {
color: #000;
}
.editor textarea {
Expand Down Expand Up @@ -8513,8 +8514,8 @@ td.diff_header {
margin-bottom: 15px;
}
.search-form {
margin-bottom: 20px;
padding-bottom: 25px;
margin-bottom: 15px;
padding-bottom: 35px;
border-bottom: 1px dotted #dddddd;
}
.search-form .search-input {
Expand Down Expand Up @@ -9764,7 +9765,8 @@ h4 small {
float: left;
border-left: 1px solid #660003;
}
.account-masthead .account ul li a {
.account-masthead .account ul li a,
.account-masthead .account ul li button {
display: block;
color: #ecbfc1;
font-size: 13px;
Expand Down Expand Up @@ -9936,10 +9938,13 @@ h4 small {
margin-right: 0;
}
.masthead .debug {
position: absolute;
top: 37px;
left: 10px;
color: rgba(255, 255, 255, 0.5);
bottom: 0px;
right: 0px;
top: initial;
left: initial;
padding: 15px;
background-color: #990005;
border: none;
}
@media (min-width: 992px) {
.masthead .navbar-collapse {
Expand All @@ -9961,8 +9966,9 @@ h4 small {
padding-right: 15px;
}
.masthead .site-search {
display: none;
display: none !important;
}

}
@media (max-width: 767px) {
.masthead .navbar-collapse {
Expand Down
66 changes: 54 additions & 12 deletions ckanext/dms/assets/css/dms.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ p.small {
}

.masthead .navbar-collapse{
padding-top: 12px;
padding-top: 20px;
}

.masthead .navigation .nav-pills > li > a
.masthead .navbar .navbar-nav > li > a
{
font-style: normal;
font-weight: 700;
Expand All @@ -173,13 +173,25 @@ p.small {
background-color: transparent;
padding: 10px 0px;
margin-left: 30px;
}

@media only screen and (max-width: 991px) {
.masthead .navbar .navbar-nav > li > a {
margin-left: 0;
}
}

.masthead .navbar .navbar-nav > li:first-child > a {
padding-top: 0;
}

.masthead .navigation .nav-pills li a:hover,
.masthead .navigation .nav-pills li a:focus,
.masthead .navigation .nav-pills li.active a
.masthead .navbar .navbar-nav > li:last-child > a {
padding-bottom: 0;
}

.masthead .navbar .navbar-nav li:hover a,
.masthead .navbar .navbar-nav li:focus a,
.masthead .navbar .navbar-nav li.active a
{
color: #212121;
background-color: transparent;
Expand All @@ -188,6 +200,23 @@ p.small {

.masthead .site-search {
margin: 5px 0px 5px 30px;
display: inline-block !important;
position: relative;
}

@media (max-width: 991px) {
.masthead .main-navbar ul {
margin-right: 0;
width: 100%;
}

.masthead .site-search {
display: none !important;
}
}

@media (max-width: 769px) {

}

.masthead .site-search input {
Expand All @@ -196,7 +225,7 @@ p.small {
padding: 10px 14px;
}

.btn-search .fa-search {
.masthead .site-search .fa-search {
color: #990005;
font-size: 20px;
position: absolute;
Expand All @@ -215,7 +244,8 @@ p.small {
background: #EDE8E8;
}

.account-masthead .account ul li a {
.account-masthead .account ul li a,
.account-masthead .account ul li button {
font-style: normal;
font-weight: 400;
font-size: 14px;
Expand All @@ -226,7 +256,8 @@ p.small {
line-height: 40px;
}

.account-masthead .account ul li a:hover{
.account-masthead .account ul li a:hover,
.account-masthead .account ul li button:hover{
color: #212121;
background-color: transparent;
}
Expand Down Expand Up @@ -376,8 +407,8 @@ p.small {
border: none;
}

.dataset-resources li a.label,
.dataset-resources li a.label:hover{
.dataset-resources li a.badge,
.dataset-resources li a.badge:hover{
background-color: transparent;
color: #056839;
padding: 0px;
Expand Down Expand Up @@ -515,7 +546,7 @@ a.tag:hover {
text-decoration: underline;
}

@media only screen and (min-width: 769px) {
@media only screen and (min-width: 991px) {
.mobile-menu {
display: none;
}
Expand All @@ -535,7 +566,7 @@ a.tag:hover {
margin-bottom: 30px;
}

.main, .hero {
.main, .homepage .hero {
min-height: 80vh;
padding-top: 32px;
padding-bottom: 64px;
Expand Down Expand Up @@ -692,4 +723,15 @@ a.tag:hover {
background-color: #990005;
}

.module-narrow .nav-item > a, .module-narrow .nav-aside li a{
font-size: 14px;
}

.form-control.form-select{
appearance: auto;
}

.navbar-toggler .fa.fa-bars {
color: #990005 !important;
font-size: 22px;
}
14 changes: 13 additions & 1 deletion ckanext/dms/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ckan.logic as logic
import ckan.model as model
import ckan.logic as logic
from ckan.common import c, request, is_flask_request
ntwalibas marked this conversation as resolved.
Show resolved Hide resolved

# for datetime string conversion
Expand Down Expand Up @@ -84,3 +84,15 @@ def get_all_groups():
return logic.get_action('group_list')(
data_dict={'sort': 'title asc', 'all_fields': True})


def get_site_statistics() -> dict[str, int]:
'''This function used be a core helper but it was removed in CKAN 2.11.0
We reproduce it here to templates can continue working as usual.
'''
stats = {}
stats['dataset_count'] = logic.get_action('package_search')(
{}, {"rows": 1})['count']
ntwalibas marked this conversation as resolved.
Show resolved Hide resolved
stats['group_count'] = len(logic.get_action('group_list')({}, {}))
stats['organization_count'] = len(
ntwalibas marked this conversation as resolved.
Show resolved Hide resolved
logic.get_action('organization_list')({}, {}))
return stats
ntwalibas marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 4 additions & 3 deletions ckanext/dms/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def get_helpers(self):
'get_facet_items_dict': get_facet_items_dict,
'get_featured_datasets': ckanext.dms.helpers.get_featured_datasets,
'get_user_from_id': ckanext.dms.helpers.get_user_from_id,
'get_all_groups': ckanext.dms.helpers.get_all_groups
'get_all_groups': ckanext.dms.helpers.get_all_groups,
'get_site_statistics': ckanext.dms.helpers.get_site_statistics,
ntwalibas marked this conversation as resolved.
Show resolved Hide resolved
}

# IConfigurer
Expand All @@ -53,14 +54,14 @@ def dataset_facets(self, facet_dict, package_type):
return new_fd

# IResourceController
def before_create(self, context, resource):
def before_resource_create(self, context, resource):
if _data_dict_is_resource(resource):
_giftless_upload(context, resource)

_update_resource_last_modified_date(resource)
return resource

def before_update(self, context, current, resource):
def before_resource_update(self, context, current, resource):
if _data_dict_is_resource(resource):
_giftless_upload(context, resource, current=current)
_update_resource_last_modified_date(resource, current=current)
Expand Down
2 changes: 1 addition & 1 deletion ckanext/dms/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@babel/core": "^7.12.16",
"@babel/preset-env": "^7.12.16",
"@babel/preset-react": "^7.12.13",
"axios": "^0.21.1",
"axios": "^0.28.0",
"babel-loader": "^8.2.2",
"bluebird": "^3.7.2",
"core-js": "^3.9.1",
Expand Down
30 changes: 29 additions & 1 deletion ckanext/dms/react/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2740,6 +2740,15 @@ axios@^0.21.1:
dependencies:
follow-redirects "^1.10.0"

axios@^0.28.0:
version "0.28.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.28.1.tgz#2a7bcd34a3837b71ee1a5ca3762214b86b703e70"
integrity sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

axobject-query@^2.0.2:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
Expand Down Expand Up @@ -3611,7 +3620,7 @@ colorette@^1.2.1:
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b"
integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==

combined-stream@^1.0.6, combined-stream@~1.0.6:
combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
Expand Down Expand Up @@ -5303,6 +5312,11 @@ follow-redirects@^1.10.0:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.2.tgz#dd73c8effc12728ba5cf4259d760ea5fb83e3147"
integrity sha512-6mPTgLxYm3r6Bkkg0vNM0HTjfGrOEtsfbhagQvbxDEsEkpNhw582upBaoRZylzen6krEmxXJgt9Ju6HiI4O7BA==

follow-redirects@^1.15.0:
version "1.15.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1"
integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==

for-each@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
Expand Down Expand Up @@ -5346,6 +5360,15 @@ [email protected]:
tapable "^1.0.0"
worker-rpc "^0.1.0"

form-data@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48"
integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"

form-data@~2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6"
Expand Down Expand Up @@ -9289,6 +9312,11 @@ proxy-addr@~2.0.5:
forwarded "~0.1.2"
ipaddr.js "1.9.1"

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

prr@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
Expand Down
Loading
Loading