entries filter

This commit is contained in:
antelle 2016-07-31 21:38:08 +03:00
parent 8093279b95
commit 39b5451bfd
3 changed files with 24 additions and 10 deletions

View File

@ -9,7 +9,14 @@ let AutoTypeFilter = function(windowInfo, appModel) {
};
AutoTypeFilter.prototype.getEntries = function() {
return this.appModel.getEntries(); // TODO
let filter = {
text: this.text
};
if (!this.ignoreWindowInfo) {
filter.title = this.title; // TODO
filter.url = this.url; // TODO
}
return this.appModel.getEntriesByFilter(filter); // TODO: sort entries
};
module.exports = AutoTypeFilter;

View File

@ -214,16 +214,16 @@ var AppModel = Backbone.Model.extend({
},
getEntries: function() {
var filter = this.prepareFilter();
let entries = this.getEntriesByFilter(filter);
let entries = this.getEntriesByFilter(this.filter);
entries.sortEntries(this.sort);
if (filter.trash) {
if (this.filter.trash) {
this.addTrashGroups(entries);
}
return entries;
},
getEntriesByFilter: function(filter) {
filter = this.prepareFilter(filter);
var entries = new EntryCollection();
this.files.forEach(file => {
file.forEachEntry(filter, entry => entries.push(entry));
@ -242,8 +242,8 @@ var AppModel = Backbone.Model.extend({
});
},
prepareFilter: function() {
var filter = _.clone(this.filter);
prepareFilter: function(filter) {
filter = _.clone(filter);
if (filter.text) {
filter.textLower = filter.text.toLowerCase();
}

View File

@ -62,12 +62,19 @@
width: 100%;
overflow: hidden;
border-collapse: collapse;
table-layout: fixed;
tr.at-select__item {
border-right-width: 3px;
}
td, th {
padding: $base-padding;
&:first-of-type {
width: 1em;
text-align: center;
}
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
&:first-of-type { width: 1em; text-align: center; }
&:nth-of-type(2) { width: 50%; }
&:nth-of-type(3) { width: 25%; }
&:nth-of-type(4) { width: 25%; }
}
}
&__item {