Update profile
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
<h3>Профиль</h3>
|
||||
<hr />
|
||||
|
||||
{% include 'profile_menu.html' %}
|
||||
|
||||
<p>Зарегистрирован: {{ user.created }}</p>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
17
myapp/ns_profile/templates/profile_menu.html
Normal file
17
myapp/ns_profile/templates/profile_menu.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
<div class="btn-group">
|
||||
<div class="btn btn-outline-secondary disabled mb-2" v-if="menuitem===null"><i class="fa fa-bars"></i></div>
|
||||
<a class="btn btn-outline-secondary mb-2" href="/profile" v-else><i class="fa fa-bars"></i></a>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-outline-secondary mb-2" href="/profile/favorite">Избранное</a>
|
||||
|
||||
<a class="btn btn-outline-secondary mb-2" href="/profile/passwd">Сменить пароль</a>
|
||||
<a class="btn btn-outline-secondary mb-2" href="/profile/pages">Ваши документы</a>
|
||||
<a class="btn btn-outline-secondary mb-2" href="/notes">Ваши заметки</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
111
myapp/ns_profile/templates/profile_pages.html
Normal file
111
myapp/ns_profile/templates/profile_pages.html
Normal file
@@ -0,0 +1,111 @@
|
||||
{% 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">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
filter: '',
|
||||
menuitem: 'pages',
|
||||
pages: [],
|
||||
pagination: {{ pagedata['pagination']|tojson|safe }},
|
||||
},
|
||||
methods: {
|
||||
filterApply: function() {},
|
||||
filterClear: function() {
|
||||
/* Очистить фильтр */
|
||||
let vm = this;
|
||||
vm.filter = '';
|
||||
},
|
||||
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) {
|
||||
vm.pages = response.data['result'];
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
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]) {
|
||||
vm.pages = response.data[0]['result'];
|
||||
}
|
||||
if ('result' in response.data[1]) {
|
||||
vm.pagination.size = response.data[1]['result'];
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
computed: {
|
||||
filteredPages: function() {
|
||||
let vm = this;
|
||||
return vm.pages;
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
{% endblock script %}
|
||||
@@ -20,3 +20,22 @@ def profile():
|
||||
pagedata['title'] = 'Мой профиль - {}'.format(app.config['TITLE'])
|
||||
body = render_template('profile.html', pagedata=pagedata)
|
||||
return body
|
||||
|
||||
|
||||
@app.route('/profile/pages')
|
||||
@login_required
|
||||
def profile_pages():
|
||||
"""
|
||||
Личный профиль пользователя
|
||||
"""
|
||||
pagedata = {}
|
||||
pagedata['title'] = 'Мой профиль - {}'.format(app.config['TITLE'])
|
||||
|
||||
pagedata['pagination'] = {
|
||||
"page": 1,
|
||||
"per_page": app.config['ITEMS_ON_PAGE'],
|
||||
"size": 0
|
||||
}
|
||||
|
||||
body = render_template('profile_pages.html', pagedata=pagedata)
|
||||
return body
|
||||
|
||||
Reference in New Issue
Block a user