forked from ckan/ckan-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from AuScope/dev-sample
Dev sample
- Loading branch information
Showing
36 changed files
with
1,897 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/assets/js/facet-select-module.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
this.ckan.module('facet-select-module', function ($, _) { | ||
return { | ||
initialize: function () { | ||
this.inputElements = this.el.find('.facet-select'); | ||
this.title = this.el.data('title'); | ||
if (this.inputElements.length > 0) { | ||
this.initializeSelect2(); | ||
} else { | ||
setTimeout(this.initialize.bind(this), 500); | ||
} | ||
}, | ||
|
||
initializeSelect2: function () { | ||
var self = this; | ||
this.inputElements.each(function () { | ||
var $element = $(this); | ||
$element.select2({ | ||
placeholder: "Select " + self.title, | ||
allowClear: true, | ||
width: 'resolve' | ||
}).on("change", function (e) { | ||
self.updateQueryString($element); | ||
}); | ||
}); | ||
}, | ||
|
||
updateQueryString: function ($element) { | ||
var selectedValues = $element.val(); | ||
var url = new URL(window.location.href); | ||
var params = new URLSearchParams(url.search); | ||
params.delete($element.attr('name')); | ||
|
||
if (selectedValues) { | ||
selectedValues.forEach(function (value) { | ||
params.append($element.attr('name'), value); | ||
}); | ||
} | ||
|
||
url.search = params.toString(); | ||
window.history.pushState({}, '', url.toString()); | ||
|
||
// Hide the select2 container and show loading indicator | ||
$element.select2('destroy'); | ||
this.el.find('.loading-indicator').show(); | ||
$element.hide(); | ||
|
||
// Delay the page reload to ensure the loading indicator is visible | ||
setTimeout(function () { | ||
window.location.reload(); | ||
}, 500); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+75 Bytes
(100%)
ckan/src/ckanext-igsn-theme/ckanext/igsn_theme/i18n/en_AU/LC_MESSAGES/ckan.mo
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.