118 lines
3.1 KiB
HTML
118 lines
3.1 KiB
HTML
{% extends "private/skeleton.html" %}
|
|
{% block content %}
|
|
|
|
<h3>
|
|
<div class="float-right">
|
|
<a class="btn btn-outline-success" href="/note/add"><i class="fa fa-plus"></i></a>
|
|
</div>
|
|
<button type="button" class="btn btn-outline-secondary" v-on:click="panel_show(panels.filter)"><i class="fa fa-filter"></i></button>
|
|
|
|
Заметки
|
|
</h3>
|
|
<hr />
|
|
|
|
{% include 'inc/filter.html' %}
|
|
|
|
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getNotes"></pagination-component>
|
|
|
|
{% include 'inc/notes.html' %}
|
|
|
|
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getNotes"></pagination-component>
|
|
|
|
<backtotop-component></backtotop-component>
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
|
<script type="text/javascript" src="/static/components/backtotop.js"></script>
|
|
<link rel="stylesheet" href="/static/components/backtotop.css"></link>
|
|
<script type="text/javascript" src="/static/components/pagination.js"></script>
|
|
|
|
<script>
|
|
Object.assign(root.data, {
|
|
raw_notes: [],
|
|
pagination: {{ pagedata['pagination']|tojson|safe }},
|
|
});
|
|
Object.assign(root.data.panels, {
|
|
order_by: {
|
|
visible: false,
|
|
field: 'title',
|
|
order: 'asc'
|
|
},
|
|
});
|
|
Object.assign(root.methods, {
|
|
filterApply: function() {},
|
|
filterNote: function(note) {
|
|
let vm = this;
|
|
let value = vm.panels.filter.value;
|
|
if ( value.length<1 ) {
|
|
return true;
|
|
}
|
|
if ( note.title.toLowerCase().includes(value.toLowerCase()) ) {
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
getNotes: function() {
|
|
/* Получить список заметок */
|
|
let vm = this;
|
|
axios.post(
|
|
'/api',
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"method": "notes",
|
|
"params": {
|
|
"page": vm.pagination.page
|
|
},
|
|
"id": 1
|
|
}
|
|
).then(
|
|
function(response) {
|
|
if ('result' in response.data) {
|
|
vm.raw_notes = response.data['result'];
|
|
}
|
|
}
|
|
);
|
|
},
|
|
});
|
|
root.created = function() {
|
|
let vm = this;
|
|
axios.post(
|
|
'/api',
|
|
[
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"method": "notes",
|
|
"params": {
|
|
"page": vm.pagination.page
|
|
},
|
|
"id": 1
|
|
},
|
|
{
|
|
"jsonrpc": "2.0",
|
|
"method": "notes.count",
|
|
"params": {},
|
|
"id": 1
|
|
}
|
|
]
|
|
).then(
|
|
function(response) {
|
|
if ('result' in response.data[0]) {
|
|
vm.raw_notes = response.data[0]['result'];
|
|
}
|
|
if ('result' in response.data[1]) {
|
|
vm.pagination.size = response.data[1]['result'];
|
|
}
|
|
}
|
|
);
|
|
};
|
|
Object.assign(root.computed, {
|
|
notes: function() {
|
|
/* Отфильтрованный список */
|
|
let vm = this;
|
|
var result = vm.raw_notes.filter(vm.filterNote);
|
|
return result;
|
|
},
|
|
});
|
|
</script>
|
|
{% endblock %}
|