app/views/blazer/queries/home.html.erb in blazer-1.7.2 vs app/views/blazer/queries/home.html.erb in blazer-1.7.3
- old
+ new
@@ -36,11 +36,11 @@
</tr>
</thead>
<tbody class="list" v-cloak>
<tr v-for="query in visibleItems">
<td>
- <span :class="{dashboard: query.dashboard}"><a :href="itemPath(query)">{{ query.name }}</a></span>
+ <a :href="itemPath(query)" :class="{dashboard: query.dashboard}">{{ query.name }}</a>
<span class="vars">{{ query.vars }}</span>
</td>
<td class="creator">{{ query.creator }}</td>
</tr>
</tbody>
@@ -49,14 +49,18 @@
<p v-if="more" class="text-muted">Loading...</p>
</div>
<script>
var prepareSearch = function (list) {
- var i, q
+ var i, q, searchStr
for (i = 0; i < list.length; i++) {
q = list[i]
- q.searchStr = prepareQuery(q.name + q.creator)
+ searchStr = q.name + q.creator
+ if (q.creator === "You") {
+ searchStr += "mine me"
+ }
+ q.searchStr = prepareQuery(searchStr)
}
}
var prepareQuery = function (str) {
return str.toLowerCase().replace(/\W+/g, "")
@@ -80,11 +84,11 @@
}
if (this.more) {
var _this = this
- $.getJSON(Routes.blazer_queries_path(), function (data) {
+ $.getJSON(Routes.queries_path(), function (data) {
var i, j, newValues, val, size = 500;
var newValues = []
for (j = 0; j < data.length; j++) {
val = data[j]
@@ -111,30 +115,33 @@
var q, i
if (this.searchTerm.length > 0) {
var term = prepareQuery(this.searchTerm)
var items = []
+ var fuzzyItems = []
for (i = 0; i < this.listItems.length; i++) {
q = this.listItems[i]
if (q.searchStr.indexOf(term) !== -1) {
items.push(q)
if (items.length == pageSize) {
break
}
+ } else if (fuzzysearch(term, q.searchStr)) {
+ fuzzyItems.push(q)
}
}
- return items
+ return items.concat(fuzzyItems).slice(0, pageSize)
} else {
return this.listItems.slice(0, pageSize)
}
}
},
methods: {
itemPath: function (item) {
if (item.dashboard) {
- return Routes.blazer_dashboard_path(item.to_param)
+ return Routes.dashboard_path(item.to_param)
} else {
- return Routes.blazer_query_path(item.to_param)
+ return Routes.query_path(item.to_param)
}
}
}
})
</script>