implemented video uploading, updated styles and templates
parent
3c52bca8ba
commit
f24a6b5099
@ -0,0 +1,45 @@
|
||||
<label>
|
||||
{{ page.title }}
|
||||
</label>
|
||||
<div id="options">
|
||||
{% if page.menu == 'true' %}
|
||||
{% set menu = "true" %}
|
||||
{% else %}
|
||||
{% set menu = "false" %}
|
||||
{% endif %}
|
||||
{% if page.published == 'true' %}
|
||||
{% set published = "true" %}
|
||||
{% else %}
|
||||
{% set published = "false" %}
|
||||
{% endif %}
|
||||
{% if page.featured == 'true' %}
|
||||
{% set featured = "true" %}
|
||||
{% else %}
|
||||
{% set featured = "false" %}
|
||||
{% endif %}
|
||||
<div id="option-left">
|
||||
|
||||
<button data-active="{{ menu }}">
|
||||
<svg>
|
||||
<use xlink:href="/assets/images/global/sprite.svg#entypo-add-to-list"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button data-active="{{ published }}">
|
||||
<svg>
|
||||
<use xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button data-active="{{ featured }}">
|
||||
<svg>
|
||||
<use xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div id="option-right">
|
||||
<span>
|
||||
{{ page.updated }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
@ -1,94 +1,86 @@
|
||||
import StringUtils from "../utils/StringUtils";
|
||||
import StringUtils from '../utils/StringUtils';
|
||||
export default class PostActions {
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
collectInfo(files) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let pageInfo = new FormData();
|
||||
let txt = document.createElement("textarea");
|
||||
txt.innerHTML = document.getElementById("highlight-content").innerHTML;
|
||||
let html = txt.value;
|
||||
html = html.replace(/<\/?span[^>]*>/g, ""); //removes prism styling
|
||||
html = html.replace(/<\/?br[^>]*>/g, "\n"); //convert back to encoded line break for storage
|
||||
pageInfo.append(
|
||||
"id",
|
||||
document.getElementById("post-edit-index").getAttribute("data-index")
|
||||
);
|
||||
pageInfo.append(
|
||||
"uuid",
|
||||
document.getElementById("post-edit-index").getAttribute("data-uuid")
|
||||
);
|
||||
pageInfo.append(
|
||||
"layout",
|
||||
document.getElementById("post-edit-index").getAttribute("data-layout")
|
||||
);
|
||||
pageInfo.append(
|
||||
"current_title",
|
||||
document.getElementById("post-edit-index").getAttribute("data-slug")
|
||||
);
|
||||
pageInfo.append("content", html);
|
||||
pageInfo.append("title", document.getElementById("post_title").value);
|
||||
pageInfo.append(
|
||||
"created",
|
||||
document.getElementById("post-date").getAttribute("data-raw")
|
||||
);
|
||||
pageInfo.append(
|
||||
"slug",
|
||||
new StringUtils().cleanString(
|
||||
document.getElementById("post_title").value
|
||||
)
|
||||
);
|
||||
pageInfo.append("tags", document.getElementById("post_tags").value);
|
||||
pageInfo.append(
|
||||
"menu",
|
||||
document.getElementById("option-menu-pin").getAttribute("data-active")
|
||||
);
|
||||
pageInfo.append(
|
||||
"featured",
|
||||
document.getElementById("option-feature").getAttribute("data-active")
|
||||
);
|
||||
pageInfo.append(
|
||||
"published",
|
||||
document.getElementById("option-published").getAttribute("data-active")
|
||||
);
|
||||
pageInfo.append(
|
||||
"layout",
|
||||
document.getElementById("page-templates").value
|
||||
);
|
||||
pageInfo.append(
|
||||
"form_token",
|
||||
document.getElementById("form_token").value
|
||||
);
|
||||
if (files.length > 0 && files != null) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var file = files[i];
|
||||
if (file.type.match("image.*")) {
|
||||
pageInfo.append("page_files[]", file, file.name);
|
||||
} else {
|
||||
reject("Not an image file");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//check to see if image exists
|
||||
if (document.getElementById("featured-image")) {
|
||||
var imageURL = document.getElementById("featured-image").src;
|
||||
imageURL != null || imageURL != undefined
|
||||
? pageInfo.append("feature_image", imageURL)
|
||||
: pageInfo.append("feature_image", null);
|
||||
} else {
|
||||
//pageInfo.append("feature_image", null);
|
||||
}
|
||||
}
|
||||
//console.log("FILES", files);
|
||||
resolve(pageInfo);
|
||||
});
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
//--------------------------
|
||||
// constructor
|
||||
//--------------------------
|
||||
constructor() {}
|
||||
//--------------------------
|
||||
// methods
|
||||
//--------------------------
|
||||
collectInfo(files) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let pageInfo = new FormData();
|
||||
let txt = document.createElement('textarea');
|
||||
txt.innerHTML = document.getElementById('highlight-content').innerHTML;
|
||||
let html = txt.value;
|
||||
html = html.replace(/<\/?span[^>]*>/g, ''); //removes prism styling
|
||||
html = html.replace(/<\/?br[^>]*>/g, '\n'); //convert back to encoded line break for storage
|
||||
pageInfo.append(
|
||||
'id',
|
||||
document.getElementById('post-edit-index').getAttribute('data-index')
|
||||
);
|
||||
pageInfo.append(
|
||||
'uuid',
|
||||
document.getElementById('post-edit-index').getAttribute('data-uuid')
|
||||
);
|
||||
pageInfo.append(
|
||||
'layout',
|
||||
document.getElementById('post-edit-index').getAttribute('data-layout')
|
||||
);
|
||||
pageInfo.append(
|
||||
'current_title',
|
||||
document.getElementById('post-edit-index').getAttribute('data-slug')
|
||||
);
|
||||
pageInfo.append('content', html);
|
||||
pageInfo.append('title', document.getElementById('post_title').value);
|
||||
pageInfo.append(
|
||||
'created',
|
||||
document.getElementById('post-date').getAttribute('data-raw')
|
||||
);
|
||||
pageInfo.append(
|
||||
'slug',
|
||||
new StringUtils().cleanString(document.getElementById('post_title').value)
|
||||
);
|
||||
pageInfo.append('tags', document.getElementById('post_tags').value);
|
||||
pageInfo.append(
|
||||
'menu',
|
||||
document.getElementById('option-menu-pin').getAttribute('data-active')
|
||||
);
|
||||
pageInfo.append(
|
||||
'featured',
|
||||
document.getElementById('option-feature').getAttribute('data-active')
|
||||
);
|
||||
pageInfo.append(
|
||||
'published',
|
||||
document.getElementById('option-published').getAttribute('data-active')
|
||||
);
|
||||
pageInfo.append('layout', document.getElementById('page-templates').value);
|
||||
pageInfo.append('form_token', document.getElementById('form_token').value);
|
||||
if (files.length > 0 && files != null) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var file = files[i];
|
||||
if (file.type.match('image.*') || file.type.match('video.mp4')) {
|
||||
pageInfo.append('page_files[]', file, file.name);
|
||||
} else {
|
||||
reject('Not an image file');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//check to see if image exists
|
||||
if (document.getElementById('featured-image')) {
|
||||
var imageURL = document.getElementById('featured-image').src;
|
||||
imageURL != null || imageURL != undefined
|
||||
? pageInfo.append('feature_image', imageURL)
|
||||
: pageInfo.append('feature_image', null);
|
||||
} else {
|
||||
//pageInfo.append("feature_image", null);
|
||||
}
|
||||
}
|
||||
//console.log("FILES", files);
|
||||
resolve(pageInfo);
|
||||
});
|
||||
}
|
||||
//--------------------------
|
||||
// event handlers
|
||||
//--------------------------
|
||||
}
|
||||
|
Loading…
Reference in New Issue