mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
filter docs by category, search query params
This commit is contained in:
parent
666ab3151e
commit
9fd53142f3
6 changed files with 18 additions and 19 deletions
|
@ -58,7 +58,9 @@ export default Component.extend(AuthMixin, {
|
||||||
this.set('categoryLinkName', categories.length > 0 ? 'manage' : 'add');
|
this.set('categoryLinkName', categories.length > 0 ? 'manage' : 'add');
|
||||||
|
|
||||||
schedule('afterRender', () => {
|
schedule('afterRender', () => {
|
||||||
if (this.get('rootDocCount') > 0) {
|
if (this.get('categoryFilter') !== '') {
|
||||||
|
this.send('onDocumentFilter', 'category', this.get('categoryFilter'));
|
||||||
|
} else if (this.get('rootDocCount') > 0) {
|
||||||
this.send('onDocumentFilter', 'space', this.get('folder.id'));
|
this.send('onDocumentFilter', 'space', this.get('folder.id'));
|
||||||
} else if (selectedCategory !== '') {
|
} else if (selectedCategory !== '') {
|
||||||
this.send('onDocumentFilter', 'category', selectedCategory);
|
this.send('onDocumentFilter', 'category', selectedCategory);
|
||||||
|
@ -67,20 +69,6 @@ export default Component.extend(AuthMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
zonMoveDocumentz(documents, targetSpaceId) {
|
|
||||||
let self = this;
|
|
||||||
|
|
||||||
documents.forEach(function (documentId) {
|
|
||||||
self.get('documentService').getDocument(documentId).then(function (doc) {
|
|
||||||
doc.set('folderId', targetSpaceId);
|
|
||||||
doc.set('selected', false);
|
|
||||||
self.get('documentService').save(doc).then(function () {
|
|
||||||
self.attrs.onRefresh();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onMoveDocument(documents, targetSpaceId) {
|
onMoveDocument(documents, targetSpaceId) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let promises1 = [];
|
let promises1 = [];
|
||||||
|
@ -140,6 +128,7 @@ export default Component.extend(AuthMixin, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.set('categoryFilter', id);
|
||||||
this.set('spaceSelected', false);
|
this.set('spaceSelected', false);
|
||||||
this.set('uncategorizedSelected', false);
|
this.set('uncategorizedSelected', false);
|
||||||
break;
|
break;
|
||||||
|
@ -152,6 +141,7 @@ export default Component.extend(AuthMixin, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.set('categoryFilter', '');
|
||||||
this.set('uncategorizedSelected', true);
|
this.set('uncategorizedSelected', true);
|
||||||
this.set('spaceSelected', false);
|
this.set('spaceSelected', false);
|
||||||
break;
|
break;
|
||||||
|
@ -162,6 +152,7 @@ export default Component.extend(AuthMixin, {
|
||||||
filtered.pushObject(d);
|
filtered.pushObject(d);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.set('categoryFilter', '');
|
||||||
this.set('spaceSelected', true);
|
this.set('spaceSelected', true);
|
||||||
this.set('uncategorizedSelected', false);
|
this.set('uncategorizedSelected', false);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,6 +18,8 @@ export default Controller.extend(NotifierMixin, {
|
||||||
documentService: service('document'),
|
documentService: service('document'),
|
||||||
folderService: service('folder'),
|
folderService: service('folder'),
|
||||||
localStorage: service('localStorage'),
|
localStorage: service('localStorage'),
|
||||||
|
queryParams: ['category'],
|
||||||
|
category: '',
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onAddSpace(payload) {
|
onAddSpace(payload) {
|
||||||
|
|
|
@ -19,5 +19,6 @@
|
||||||
categorySummary=model.categorySummary
|
categorySummary=model.categorySummary
|
||||||
categoryMembers=model.categoryMembers
|
categoryMembers=model.categoryMembers
|
||||||
rootDocCount=model.rootDocCount
|
rootDocCount=model.rootDocCount
|
||||||
|
categoryFilter=category
|
||||||
onRefresh=(action 'onRefresh')}}
|
onRefresh=(action 'onRefresh')}}
|
||||||
</div>
|
</div>
|
|
@ -10,13 +10,13 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { debounce } from '@ember/runloop';
|
import { debounce } from '@ember/runloop';
|
||||||
|
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
searchService: service('search'),
|
searchService: service('search'),
|
||||||
filter: "",
|
queryParams: ['filter', 'matchDoc', 'matchContent', 'matchTag', 'matchFile'],
|
||||||
|
filter: '',
|
||||||
results: [],
|
results: [],
|
||||||
matchDoc: true,
|
matchDoc: true,
|
||||||
matchContent: true,
|
matchContent: true,
|
||||||
|
@ -30,12 +30,15 @@ export default Controller.extend({
|
||||||
onMatchDoc: function () {
|
onMatchDoc: function () {
|
||||||
debounce(this, this.fetch, 750);
|
debounce(this, this.fetch, 750);
|
||||||
}.observes('matchDoc'),
|
}.observes('matchDoc'),
|
||||||
|
|
||||||
onMatchContent: function () {
|
onMatchContent: function () {
|
||||||
debounce(this, this.fetch, 750);
|
debounce(this, this.fetch, 750);
|
||||||
}.observes('matchContent'),
|
}.observes('matchContent'),
|
||||||
|
|
||||||
onMatchTag: function () {
|
onMatchTag: function () {
|
||||||
debounce(this, this.fetch, 750);
|
debounce(this, this.fetch, 750);
|
||||||
}.observes('matchTag'),
|
}.observes('matchTag'),
|
||||||
|
|
||||||
onMatchFile: function () {
|
onMatchFile: function () {
|
||||||
debounce(this, this.fetch, 750);
|
debounce(this, this.fetch, 750);
|
||||||
}.observes('matchFile'),
|
}.observes('matchFile'),
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
{{focus-input id="document-name" type="text" value=docName class=(if hasNameError 'form-control mousetrap is-invalid' 'form-control mousetrap') placeholder="Title" autocomplete="off"}}
|
{{focus-input id="document-name" type="text" value=docName class=(if hasNameError 'form-control mousetrap is-invalid' 'form-control mousetrap') placeholder="Title" autocomplete="off"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{input id="document-excerpt" type="text" value=docExcerpt class=(if hasExcerptError 'form-control mousetrap is-invalid' 'form-control mousetrap') placeholder="Excerpt" autocomplete="off"}}
|
{{textarea id="document-excerpt" rows="2" value=docExcerpt class=(if hasExcerptError 'form-control mousetrap is-invalid' 'form-control mousetrap') placeholder="Excerpt" autocomplete="off"}}
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-outline-secondary" {{action "onCancel"}}>Cancel</button>
|
<button type="submit" class="btn btn-outline-secondary" {{action "onCancel"}}>Cancel</button>
|
||||||
<button type="submit" class="btn btn-success" {{action "onSave"}}>Save</button>
|
<button type="submit" class="btn btn-success" {{action "onSave"}}>Save</button>
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
<div class="col-2 heading">Tags</div>
|
<div class="col-2 heading">Tags</div>
|
||||||
<div class="col-10 value">
|
<div class="col-10 value">
|
||||||
{{#each tagz as |t index|}}
|
{{#each tagz as |t index|}}
|
||||||
<a href="/search?tag={{t}}">{{concat '#' t}}</a>
|
{{#link-to 'search' (query-params filter=t matchTag=true)}}
|
||||||
|
{{concat '#' t}}
|
||||||
|
{{/link-to}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if canSelectCategory}}
|
{{#if canSelectCategory}}
|
||||||
<div class="action-button button-icon-gray button-icon-small align-middle" data-toggle="modal" data-target="#document-tags-modal" data-backdrop="static">
|
<div class="action-button button-icon-gray button-icon-small align-middle" data-toggle="modal" data-target="#document-tags-modal" data-backdrop="static">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue