Update
This commit is contained in:
@@ -1,36 +1,24 @@
|
||||
{% extends "/public/skeleton.html" %}
|
||||
{% block content %}
|
||||
{% raw %}
|
||||
|
||||
<a href="/pages">Назад</a>
|
||||
<h3>
|
||||
<a class="btn btn-outline-secondary" href="/pages"><i class="fa fa-chevron-left"></i></a>
|
||||
{{ page.title }}</h3>
|
||||
{{ pagedata['page'].title }}</h3>
|
||||
<hr />
|
||||
|
||||
<div class="row">
|
||||
<div class="col small text-muted">
|
||||
<span v-for="(tag, tagIdx) in page.tags">
|
||||
<i class="fa fa-tag"></i> <a class="text-monospace" :href="'/tag/' + tag.id">{{ tag.name }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{% for tagLink in pagedata['page'].tags %}
|
||||
<a href="/tag/{{ tagLink.tag.id }}">{{ tagLink.tag.name }}</a>;
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
<span v-html="page.body"></span>
|
||||
{{ pagedata['page'].body|safe }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col small text-muted">
|
||||
<i class="fa fa-user"></i> <a class="text-monospace" :href="'/user/' + page.user.id">{{ page.user.name }}</a>
|
||||
Создано: {{ page.created }}
|
||||
Обновлено: {{ page.updated }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endraw %}
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
<ul>
|
||||
<li><a href="/"><i class="fa fa-home"></i></a></li>
|
||||
<li><a href="/">Домой</a></li>
|
||||
<li><a href="/pages">Список статей</a></li>
|
||||
<li>{{ pagedata['page'].title }}</li>
|
||||
</ul>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<h3>Статьи</h3>
|
||||
<hr />
|
||||
|
||||
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getPages"></pagination-component>
|
||||
|
||||
<div class="row" v-if="firstAlpha">
|
||||
<div class="col py-2 text-center">
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
{% extends "/private/skeleton.html" %}
|
||||
{% block content %}
|
||||
|
||||
|
||||
<h3>
|
||||
<a class="btn btn-outline-secondary" href="/pages"><i class="fa fa-chevron-left"></i></a>
|
||||
Новая страница
|
||||
</h3>
|
||||
<hr />
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="title">Заголовок</label>
|
||||
<input class="form-control" id="title" name="title" type="text" v-model="page.title">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="body">Текст</label>
|
||||
<textarea class="form-control" cols="40" id="body" name="body" rows="8" v-model="page.body"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-outline-success pull-right" v-on:click="send"><i class="fa fa-plus"></i> Добавить</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
{% raw %}
|
||||
<ol class="breadcrumb mt-3">
|
||||
<li class="breadcrumb-item"><a href="/"><i class="fa fa-home"></i></a></li>
|
||||
<li class="breadcrumb-item"><a href="/pages">Статьи</a></li>
|
||||
<li class="breadcrumb-item active">Новая статья</li>
|
||||
</ol>
|
||||
{% endraw %}
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
page: {
|
||||
title: '',
|
||||
body: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
send: function () {
|
||||
/* Сохранить */
|
||||
let vm = this;
|
||||
/* editor.getValue('"body"', 'vm.page.body', type='tinymce') */
|
||||
axios.post(
|
||||
'/api',
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "page.add",
|
||||
"params": {
|
||||
"title": vm.page.title,
|
||||
"body": vm.page.body
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
).then(
|
||||
function(response) {
|
||||
if ('result' in response.data) {
|
||||
window.location.href = '/page/' + response.data['result'].id;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -33,22 +33,15 @@
|
||||
</div>
|
||||
<!-- Конец: Панель сортировки -->
|
||||
|
||||
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getPages"></pagination-component>
|
||||
|
||||
<div class="row" v-if="firstAlpha">
|
||||
<div class="col py-2 text-center">
|
||||
от <span class="text-danger" v-html="firstAlpha"></span> до <span class="text-danger" v-html="lastAlpha"></span>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'pagination-curl.html' %}
|
||||
|
||||
{% include 'inc/pages.html' %}
|
||||
|
||||
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getPages"></pagination-component>
|
||||
{% include 'pagination-curl.html' %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
<script type="text/javascript" src="/static/components/pagination.js"></script>
|
||||
|
||||
<script>
|
||||
Object.assign(root.data, {
|
||||
|
||||
@@ -11,6 +11,11 @@ def pages(page):
|
||||
"""
|
||||
pagedata = {'title': 'Статьи - ' + app.config['TITLE']}
|
||||
|
||||
pages = models.db_session.query(
|
||||
models.Page
|
||||
).all()
|
||||
pagedata['pages'] = pages
|
||||
|
||||
pagedata['pagination'] = {
|
||||
"page": page,
|
||||
"per_page": app.config['ITEMS_ON_PAGE'],
|
||||
|
||||
@@ -73,5 +73,5 @@ def page_add():
|
||||
"""
|
||||
pagedata = {}
|
||||
pagedata['title'] = 'Новый документ - ' + app.config['TITLE']
|
||||
body = render_template('user/page_add.html', pagedata=pagedata)
|
||||
body = render_template('/private/skeleton.html', pagedata=pagedata)
|
||||
return body
|
||||
|
||||
Reference in New Issue
Block a user