hotfix for images in editor uploads
This commit is contained in:
parent
9baaed6d50
commit
aa3301fb66
4 changed files with 8689 additions and 165 deletions
|
@ -4,6 +4,7 @@ namespace brain\api\v1;
|
||||||
|
|
||||||
use brain\data\Member;
|
use brain\data\Member;
|
||||||
use brain\data\Settings;
|
use brain\data\Settings;
|
||||||
|
use brain\utility\FileUploader;
|
||||||
|
|
||||||
class ImagesAPI
|
class ImagesAPI
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,178 +4,178 @@
|
||||||
if not, just make them empty
|
if not, just make them empty
|
||||||
#}
|
#}
|
||||||
{% if mode == 'edit' %}
|
{% if mode == 'edit' %}
|
||||||
{% set id = page['id'] %}
|
{% set id = page['id'] %}
|
||||||
{% set uuid = page['uuid'] %}
|
{% set uuid = page['uuid'] %}
|
||||||
{% set slug = page['slug'] %}
|
{% set slug = page['slug'] %}
|
||||||
{% set layout = page['layout'] %}
|
{% set layout = page['layout'] %}
|
||||||
{% set feature = page['feature'] %}
|
{% set feature = page['feature'] %}
|
||||||
{% set _title = page['title'] %}
|
{% set _title = page['title'] %}
|
||||||
{% set tags = page['tags'] %}
|
{% set tags = page['tags'] %}
|
||||||
{% set content = page['content'] %}
|
{% set content = page['content'] %}
|
||||||
{% set date = page['created'] %}
|
{% set date = page['created'] %}
|
||||||
{% set updated = page['updated'] %}
|
{% set updated = page['updated'] %}
|
||||||
{% set media = page['media'] %}
|
{% set media = page['media'] %}
|
||||||
{% set files = page['docs'] %}
|
{% set files = page['docs'] %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set id = '' %}
|
{% set id = '' %}
|
||||||
{% set uuid = '' %}
|
{% set uuid = '' %}
|
||||||
{% set slug = '' %}
|
{% set slug = '' %}
|
||||||
{% set layout = 'page' %}
|
{% set layout = 'page' %}
|
||||||
{% set feature = '' %}
|
{% set feature = '' %}
|
||||||
{% set title = '' %}
|
{% set title = '' %}
|
||||||
{% set tags = '' %}
|
{% set tags = '' %}
|
||||||
{% set content = '' %}
|
{% set content = '' %}
|
||||||
{% set date = '' %}
|
{% set date = '' %}
|
||||||
{% set updated = '' %}
|
{% set updated = '' %}
|
||||||
{% set media = '' %}
|
{% set media = '' %}
|
||||||
{% set files = '' %}
|
{% set files = '' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ title }}
|
{{ title }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=vbhj">
|
<link rel="stylesheet" type="text/css" href="/assets/css/dash.css?=vbhj">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block mainContent %}
|
{% block mainContent %}
|
||||||
<div id="post-edit-index" data-index="{{ id }}" data-uuid="{{ uuid }}" data-slug="{{ slug }}" data-layout="{{ layout }}">
|
<div id="post-edit-index" data-index="{{ id }}" data-uuid="{{ uuid }}" data-slug="{{ slug }}" data-layout="{{ layout }}">
|
||||||
<div id="post-edit-index-wrapper">
|
<div id="post-edit-index-wrapper">
|
||||||
<div id="post-feature">
|
<div id="post-feature">
|
||||||
{% if page['feature'] == null %}
|
{% if page['feature'] == null %}
|
||||||
<div id="page-file-manager">
|
<div id="page-file-manager">
|
||||||
<div id="page-file-wrapper">
|
<div id="page-file-wrapper">
|
||||||
<div id="page-file-drop">
|
<div id="page-file-drop">
|
||||||
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
|
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
|
||||||
</div>
|
</div>
|
||||||
IMAGES AND VIDEO
|
IMAGES AND VIDEO
|
||||||
<div id="page-images-list"></div>
|
<div id="page-images-list"></div>
|
||||||
FILES
|
FILES
|
||||||
<div id="page-files-list"></div>
|
<div id="page-files-list"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div id="page-file-manager">
|
<div id="page-file-manager">
|
||||||
<div id="page-file-wrapper">
|
<div id="page-file-wrapper">
|
||||||
<div id="page-file-drop">
|
<div id="page-file-drop">
|
||||||
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
|
<label for="page-files-upload">DRAG AND DROP FILES OR CLICK TO SELECT</label>
|
||||||
</div>
|
</div>
|
||||||
IMAGES AND VIDEO
|
IMAGES AND VIDEO
|
||||||
<div id="page-images-list">
|
<div id="page-images-list">
|
||||||
{% if media|length > 1 %}
|
{% if media|length > 1 %}
|
||||||
{% for item in media %}
|
{% for item in media %}
|
||||||
{% if item.type == "mp4"%}
|
{% if item.type == "mp4"%}
|
||||||
<div id="{{loop.index0}}" class="video-item" data-source="{{ item.file }}"></div>
|
<div id="{{loop.index0}}" class="video-item" data-source="{{ item.file }}"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div id="{{loop.index0}}" class="img-item" style="background: url({{ item.file }}) no-repeat center center / cover"></div>
|
<div id="{{loop.index0}}" class="img-item" style="background: url({{ item.file }}) no-repeat center center / cover"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if media[0] != '' %}
|
{% if media[0] != '' %}
|
||||||
{% if media[0].type == "mp4"%}
|
{% if media[0].type == "mp4"%}
|
||||||
<div id="0" class="video-item" data-source="{{ media[0].file }}"></div>
|
<div id="0" class="video-item" data-source="{{ media[0].file }}"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div id="0" class="img-item" style="background: url({{ media[0].file }}) no-repeat center center / cover"></div>
|
<div id="0" class="img-item" style="background: url({{ media[0].file }}) no-repeat center center / cover"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
FILES
|
FILES
|
||||||
<div id="page-files-list">
|
<div id="page-files-list">
|
||||||
{% if files|length > 1 %}
|
{% if files|length > 1 %}
|
||||||
{% for item in files %}
|
{% for item in files %}
|
||||||
{% if item.type == "mp3"%}
|
{% if item.type == "mp3"%}
|
||||||
<div id="{{loop.index0}}" class="audio-item" data-source="{{ item.file }}"></div>
|
<div id="{{loop.index0}}" class="audio-item" data-source="{{ item.file }}"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div id="{{loop.index0}}" class="file-item" data-source="{{ item.file }}"></div>
|
<div id="{{loop.index0}}" class="file-item" data-source="{{ item.file }}"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if files[0] != '' %}
|
{% if files[0] != '' %}
|
||||||
{% if files[0].type == "mp3"%}
|
{% if files[0].type == "mp3"%}
|
||||||
<div id="0" class="audio-item" data-source="{{ files[0].file }}"></div>
|
<div id="0" class="audio-item" data-source="{{ files[0].file }}"></div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div id="0" class="file-item" data-source="{{ files[0].file }}"></div>
|
<div id="0" class="file-item" data-source="{{ files[0].file }}"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="post-header">
|
<div id="post-header">
|
||||||
<div id="post-header-wrapper" class="columns">
|
<div id="post-header-wrapper" class="columns">
|
||||||
<div id="post-title" class="column">
|
<div id="post-title" class="column">
|
||||||
<label>TITLE</label>
|
<label>TITLE</label>
|
||||||
<textarea id="post_title" type="text" name="post_title" class="post-edit" placeholder="TITLE">
|
<textarea id="post_title" type="text" name="post_title" class="post-edit" placeholder="TITLE">
|
||||||
{{- _title -}}
|
{{- _title -}}
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
||||||
<div id="layouts">
|
<div id="layouts">
|
||||||
<label>LAYOUTS</label>
|
<label>LAYOUTS</label>
|
||||||
<select id="page-templates">
|
<select id="page-templates">
|
||||||
{% for view in views %}
|
{% for view in views %}
|
||||||
{% if view == page['layout'] %}
|
{% if view == page['layout'] %}
|
||||||
<option value={{ view }} selected>{{ view }}</option>
|
<option value={{ view }} selected>{{ view }}</option>
|
||||||
{% else %}
|
{% else %}
|
||||||
<option value={{ view }}>{{ view }}</option>
|
<option value={{ view }}>{{ view }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<label>CREATED</label>
|
<label>CREATED</label>
|
||||||
<span id="post-date" type="text">
|
<span id="post-date" type="text">
|
||||||
{{ date }}
|
{{ date }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="post-meta" class="column">
|
<div id="post-meta" class="column">
|
||||||
<label>TAGS</label>
|
<label>TAGS</label>
|
||||||
<textarea id="post_tags" type="text" name="post_tags" class="form-control" placeholder="tags [comma seperated]">
|
<textarea id="post_tags" type="text" name="post_tags" class="form-control" placeholder="tags [comma seperated]">
|
||||||
{{- tags -}}
|
{{- tags -}}
|
||||||
</textarea>
|
</textarea>
|
||||||
<label>OPTIONS</label>
|
<label>OPTIONS</label>
|
||||||
{% apply spaceless %}
|
{% apply spaceless %}
|
||||||
{{ include("dash/partials/options.twig") }}
|
{{ include("dash/partials/options.twig") }}
|
||||||
{% endapply %}
|
{% endapply %}
|
||||||
<label>UPDATED</label>
|
<label>UPDATED</label>
|
||||||
<span id="post-date" type="text">
|
<span id="post-date" type="text">
|
||||||
{{ updated }}
|
{{ updated }}
|
||||||
</span>
|
</span>
|
||||||
<input id="page-files-upload" type="file" name="page-files-upload" multiple/>
|
<input id="page-files-upload" type="file" name="page-files-upload" multiple/>
|
||||||
<input id="post-image-upload" type="file" name="post-image-upload"/>
|
<input id="post-image-upload" type="file" name="post-image-upload"/>
|
||||||
<input id="form_token" name="token" type="hidden" value="{{ token }}">
|
<input id="form_token" name="token" type="hidden" value="{{ token }}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="edit-post">
|
<div id="edit-post">
|
||||||
{% apply spaceless %}
|
{% apply spaceless %}
|
||||||
{{ include("dash/partials/editor.twig") }}
|
{{ include("dash/partials/editor.twig") }}
|
||||||
{% endapply %}
|
{% endapply %}
|
||||||
<div id="edit-post-wrapper">
|
<div id="edit-post-wrapper">
|
||||||
<textarea id="edit" spellcheck="false">{{- content -}}</textarea>
|
<textarea id="edit" spellcheck="false">{{- content -}}</textarea>
|
||||||
<pre id="highlight">
|
<pre id="highlight">
|
||||||
<code id="highlight-content" class="language-md">
|
<code id="highlight-content" class="language-md">
|
||||||
|
|
||||||
</code>
|
</code>
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block javascripts %}
|
{% block javascripts %}
|
||||||
<script src="/assets/scripts/Start.js?=erty" type="text/javascript"></script>
|
<script src="/assets/scripts/Start.js?=dfdfvd" type="text/javascript"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,7 @@ export default class PostEditor {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
constructor() {
|
constructor() {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
let self = "this";
|
let self = 'this';
|
||||||
this.admin = new FipamoAdminAPI(null, document.getElementById('notify-progress'));
|
this.admin = new FipamoAdminAPI(null, document.getElementById('notify-progress'));
|
||||||
this.mm = new Maintenance(null, null, document.getElementById('notify-progress'));
|
this.mm = new Maintenance(null, null, document.getElementById('notify-progress'));
|
||||||
this.urlPieces = document.URL.split('/');
|
this.urlPieces = document.URL.split('/');
|
||||||
|
@ -43,8 +43,8 @@ export default class PostEditor {
|
||||||
this.editor = new TextEditor(
|
this.editor = new TextEditor(
|
||||||
document.getElementById('edit'),
|
document.getElementById('edit'),
|
||||||
document.getElementById('header').offsetHeight +
|
document.getElementById('header').offsetHeight +
|
||||||
document.getElementById('post-header').offsetHeight +
|
document.getElementById('post-header').offsetHeight +
|
||||||
document.getElementById('post-feature').offsetHeight
|
document.getElementById('post-feature').offsetHeight
|
||||||
);
|
);
|
||||||
this.editor.addListener(
|
this.editor.addListener(
|
||||||
EditorEvent.EDITOR_DELETE,
|
EditorEvent.EDITOR_DELETE,
|
||||||
|
@ -69,7 +69,7 @@ export default class PostEditor {
|
||||||
document.getElementById('post-image-upload').addEventListener(
|
document.getElementById('post-image-upload').addEventListener(
|
||||||
'change',
|
'change',
|
||||||
e => {
|
e => {
|
||||||
self.handleImageUpload(e.target.id, e.target.files);
|
this.handleImageUpload(e.target.id, e.target.files);
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -194,7 +194,7 @@ export default class PostEditor {
|
||||||
notify.alert(err, false);
|
notify.alert(err, false);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
// Do nothing!
|
// Do nothing!
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue