2017-08-29 12:00:36 +00:00
|
|
|
extends ../layout.pug
|
|
|
|
|
2018-01-27 11:07:36 +00:00
|
|
|
block meta
|
|
|
|
if article
|
|
|
|
meta(name="description", content=article.description)
|
|
|
|
meta(name="og:title", content=article.title)
|
|
|
|
meta(name="og:description", content=article.description)
|
|
|
|
meta(name="og:image", content="https://icynet.eu/static/image/icynet-icon.png")
|
|
|
|
meta(name="og:type", content="article")
|
|
|
|
meta(name="og:updated_time", content=article.updated_at)
|
|
|
|
meta(name="twitter:card", content="summary")
|
|
|
|
meta(name="twitter:title", content=article.title)
|
|
|
|
meta(name="twitter:description", content=article.description)
|
|
|
|
link(rel="alternate", href="/news/atom.xml", title="Icy Network News", type="application/atom+xml")
|
|
|
|
|
2017-08-29 12:00:36 +00:00
|
|
|
block append links
|
|
|
|
if editing
|
|
|
|
script(src="//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.7.2/ckeditor.js")
|
|
|
|
|
|
|
|
block title
|
|
|
|
if article
|
|
|
|
|Icy Network - News - #{article.title}
|
|
|
|
else
|
|
|
|
|Icy Network - News - 404
|
|
|
|
|
|
|
|
block body
|
2018-01-28 19:15:53 +00:00
|
|
|
.container.mt-4
|
|
|
|
if !article
|
|
|
|
span.error No such article
|
|
|
|
else
|
|
|
|
nav(aria-label="breadcrumb")
|
|
|
|
ol.breadcrumb
|
2018-02-07 17:03:57 +00:00
|
|
|
li.breadcrumb-item
|
2018-01-28 19:15:53 +00:00
|
|
|
a(href="/") Home
|
2018-02-07 17:03:57 +00:00
|
|
|
li.breadcrumb-item
|
2018-01-28 19:15:53 +00:00
|
|
|
a(href="/news") News
|
|
|
|
li.breadcrumb-item.active(aria-current="page")= article.title
|
|
|
|
|
|
|
|
.news-article
|
|
|
|
if user && user.privilege && user.privilege > 0 && !editing
|
|
|
|
a.btn.btn-primary.float-right(href="?edit=1") Edit
|
|
|
|
h1.news-title= article.title
|
|
|
|
p.news-meta Published by
|
|
|
|
span #{article.author.display_name}
|
|
|
|
|at #{new Date(article.created_at)}
|
|
|
|
if editing
|
|
|
|
.content(contenteditable="true" id="editor1")!= article.content
|
|
|
|
else
|
|
|
|
.content!= article.content
|
|
|
|
if editing
|
|
|
|
.btn.btn-success(id="done") Done editing
|
|
|
|
br
|
|
|
|
script.
|
|
|
|
CKEDITOR.disableAutoInline = true;
|
|
|
|
CKEDITOR.inline('editor1');
|
|
|
|
$('#done').click(function (e) {
|
|
|
|
let data = CKEDITOR.instances.editor1.getData();
|
|
|
|
$.post({
|
|
|
|
url: '/api/news/edit/#{article.id}',
|
|
|
|
data: {content: data},
|
|
|
|
success: function () {
|
|
|
|
window.location.href = '/news/#{article.id}-#{article.slug}'
|
|
|
|
},
|
|
|
|
error: function (e) {
|
|
|
|
if (e.responseJSON && e.responseJSON.error) {
|
|
|
|
alert(e.responseJSON.error);
|
2017-08-29 12:00:36 +00:00
|
|
|
}
|
2018-01-28 19:15:53 +00:00
|
|
|
}
|
2017-08-29 12:00:36 +00:00
|
|
|
});
|
2018-01-28 19:15:53 +00:00
|
|
|
});
|