Skip to content

Commit

Permalink
Restrict the dataset search to only those that belong to a the same org
Browse files Browse the repository at this point in the history
  • Loading branch information
NTaherifar committed May 28, 2024
1 parent c5cbcb0 commit a4221ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ this.ckan.module('parent-sample-selector-module', function ($, _) {

initializeSelect2: function () {
var self = this;

this.org_id = this.options.group;
this.inputElement.select2({
placeholder: "Select Parent of Sample",
minimumInputLength: 3,
minimumInputLength: 0,
ajax: {
url: '/api/3/action/package_search',
dataType: 'json',
quietMillis: 500,
data: function (term, page) {
return {
q: term,
include_private: true
include_private: true,
fq: 'owner_org:' + self.org_id // filter query for organization id
};
},
results: function (data, page) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<div data-module="parent-sample-selector-module" class="form-group" id="parent">
<div
data-module="parent-sample-selector-module"
data-module-group={{data['group']}}
class="form-group" id="parent">

<label class="form-label" for="field-parent">Parent Sample</label>
<input class="form-control" id="field-parent" name="parent" value="{{data['parent']}}" autocomplete="off">
{% if errors['parent'] %}
Expand Down

0 comments on commit a4221ea

Please sign in to comment.