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');
|
||||
|
||||
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'));
|
||||
} else if (selectedCategory !== '') {
|
||||
this.send('onDocumentFilter', 'category', selectedCategory);
|
||||
|
@ -67,20 +69,6 @@ export default Component.extend(AuthMixin, {
|
|||
},
|
||||
|
||||
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) {
|
||||
let self = this;
|
||||
let promises1 = [];
|
||||
|
@ -140,6 +128,7 @@ export default Component.extend(AuthMixin, {
|
|||
}
|
||||
});
|
||||
|
||||
this.set('categoryFilter', id);
|
||||
this.set('spaceSelected', false);
|
||||
this.set('uncategorizedSelected', false);
|
||||
break;
|
||||
|
@ -152,6 +141,7 @@ export default Component.extend(AuthMixin, {
|
|||
}
|
||||
});
|
||||
|
||||
this.set('categoryFilter', '');
|
||||
this.set('uncategorizedSelected', true);
|
||||
this.set('spaceSelected', false);
|
||||
break;
|
||||
|
@ -162,6 +152,7 @@ export default Component.extend(AuthMixin, {
|
|||
filtered.pushObject(d);
|
||||
});
|
||||
|
||||
this.set('categoryFilter', '');
|
||||
this.set('spaceSelected', true);
|
||||
this.set('uncategorizedSelected', false);
|
||||
break;
|
||||
|
|
|
@ -18,6 +18,8 @@ export default Controller.extend(NotifierMixin, {
|
|||
documentService: service('document'),
|
||||
folderService: service('folder'),
|
||||
localStorage: service('localStorage'),
|
||||
queryParams: ['category'],
|
||||
category: '',
|
||||
|
||||
actions: {
|
||||
onAddSpace(payload) {
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
categorySummary=model.categorySummary
|
||||
categoryMembers=model.categoryMembers
|
||||
rootDocCount=model.rootDocCount
|
||||
categoryFilter=category
|
||||
onRefresh=(action 'onRefresh')}}
|
||||
</div>
|
|
@ -10,13 +10,13 @@
|
|||
// https://documize.com
|
||||
|
||||
import { debounce } from '@ember/runloop';
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend({
|
||||
searchService: service('search'),
|
||||
filter: "",
|
||||
queryParams: ['filter', 'matchDoc', 'matchContent', 'matchTag', 'matchFile'],
|
||||
filter: '',
|
||||
results: [],
|
||||
matchDoc: true,
|
||||
matchContent: true,
|
||||
|
@ -30,12 +30,15 @@ export default Controller.extend({
|
|||
onMatchDoc: function () {
|
||||
debounce(this, this.fetch, 750);
|
||||
}.observes('matchDoc'),
|
||||
|
||||
onMatchContent: function () {
|
||||
debounce(this, this.fetch, 750);
|
||||
}.observes('matchContent'),
|
||||
|
||||
onMatchTag: function () {
|
||||
debounce(this, this.fetch, 750);
|
||||
}.observes('matchTag'),
|
||||
|
||||
onMatchFile: function () {
|
||||
debounce(this, this.fetch, 750);
|
||||
}.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"}}
|
||||
</div>
|
||||
<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>
|
||||
<button type="submit" class="btn btn-outline-secondary" {{action "onCancel"}}>Cancel</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-10 value">
|
||||
{{#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}}
|
||||
{{#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">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue