Files
myapp-full/myapp/ns_profile/templates/profile_pages.html

104 lines
2.9 KiB
HTML
Raw Normal View History

2020-02-17 01:06:16 +03:00
{% extends "skeleton.html" %}
{% block content %}
<h3>Профиль</h3>
<hr />
{% include 'profile_menu.html' %}
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getPages"></pagination-component>
{% include 'inc/pages.html' %}
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getPages"></pagination-component>
<backtotop-component></backtotop-component>
{% endblock content %}
{% 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 type="text/javascript">
2022-05-03 22:34:52 +03:00
Object.assign(root.data, {
menuitem: 'pages',
raw_pages: [],
pagination: {{ pagedata['pagination']|tojson|safe }},
});
Object.assign(root.methods, {
2020-02-17 01:06:16 +03:00
filterApply: function() {},
filterPage: function(page) {
let vm = this;
if ( vm.filter.length<1 ) {
return true;
}
if ( page.title.toLowerCase().includes(vm.filter.toLowerCase()) ) {
return true;
}
return false;
},
getPages: function() {
/* Получить список статей */
let vm = this;
axios.post(
'/api',
{
"jsonrpc": "2.0",
"method": "pages",
"params": {
"page": vm.pagination.page
},
"id": 1
}
).then(
function(response) {
if ('result' in response.data) {
2022-05-03 22:34:52 +03:00
vm.raw_pages = response.data['result'];
2020-02-17 01:06:16 +03:00
}
}
);
},
},
created: function() {
let vm = this;
axios.post(
'/api',
[
{
"jsonrpc": "2.0",
"method": "profile.pages",
"params": {
"page": vm.pagination.page
},
"id": 1
},
{
"jsonrpc": "2.0",
"method": "profile.pages.count",
"params": {},
"id": 1
}
]
).then(
function(response) {
if ('result' in response.data[0]) {
2022-05-03 22:34:52 +03:00
vm.raw_pages = response.data[0]['result'];
2020-02-17 01:06:16 +03:00
}
if ('result' in response.data[1]) {
vm.pagination.size = response.data[1]['result'];
}
}
);
},
computed: {
2022-05-03 22:34:52 +03:00
pages: function() {
2020-02-17 01:06:16 +03:00
let vm = this;
2022-05-03 22:34:52 +03:00
return vm.raw_pages;
2020-02-17 01:06:16 +03:00
}
},
})
</script>
{% endblock script %}