1
0
mirror of https://github.com/typemill/typemill.git synced 2025-10-17 07:36:24 +02:00

Version 1.2.4: Fixes, Optimizations, Browser-Support

This commit is contained in:
Sebastian
2018-09-22 07:08:19 +02:00
parent c2baf33f63
commit 98dd62798c
45 changed files with 336 additions and 169 deletions

View File

@@ -82,13 +82,55 @@ class Write
public function moveElement($item, $folderPath, $index)
{
$result = false;
$filetypes = array('md', 'txt');
# set new order as string
$newOrder = ($index < 10) ? '0' . $index : $index;
# create new path with foldername or filename but without file-type
$newPath = $this->basePath . 'content' . $folderPath . DIRECTORY_SEPARATOR . $newOrder . '-' . $item->name;
if($item->elementType == 'folder')
{
$newName = $newOrder . '-' . $item->name;
$oldPath = $this->basePath . 'content' . $item->path;
if(@rename($oldPath, $newPath))
{
return true;
}
return false;
}
# create old path but without filetype
$oldPath = substr($item->path, 0, strpos($item->path, "."));
$oldPath = $this->basePath . 'content' . $oldPath;
$result = true;
foreach($filetypes as $filetype)
{
$oldFilePath = $oldPath . '.' . $filetype;
$newFilePath = $newPath . '.' . $filetype;
#check if file with filetype exists and rename
if($oldFilePath != $newFilePath && file_exists($oldFilePath))
{
if(@rename($oldFilePath, $newFilePath))
{
$result = $result;
}
else
{
$result = false;
}
}
}
return $result;
/*
if($item->elementType == 'folder')
{
$newName = $newOrder . '-' . $item->name;
}
else
{
@@ -97,12 +139,22 @@ class Write
$oldPath = $this->basePath . 'content' . $item->path;
$newPath = $this->basePath . 'content' . $folderPath . DIRECTORY_SEPARATOR . $newName;
if(@rename($oldPath, $newPath))
{
$result = true;
}
foreach($filetypes as $filetype)
{
#check if file exists
if(file_exists($oldPath))
{
}
}
# if it is a txt file, check, if there is a corresponding .md file and move it
if($result && $item->elementType == 'file' && $item->fileType == 'txt')
{
@@ -124,5 +176,7 @@ class Write
}
return $result;
*/
}
}

View File

@@ -43,7 +43,7 @@ class Settings
'contentFolder' => 'content',
'cache' => true,
'cachePath' => $rootPath . 'cache',
'version' => '1.2.3',
'version' => '1.2.4',
'setup' => true,
'welcome' => true
];

View File

@@ -3,11 +3,21 @@
**********************/
a, a:link, a:visited, a:focus, a:hover, a:active, button, .button, input, .control-group, .sidebar-menu, .sidebar-menu--content, .menu-action, .button-arrow{
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
transition: all 0.2s ease;
-webkit-transition: color 0.2s ease;
-moz-transition: color 0.2s ease;
-o-transition: color 0.2s ease;
-ms-transition: color 0.2s ease;
transition: color 0.2s ease;
-webkit-transition: background-color 0.2s ease;
-moz-transition: background-color 0.2s ease;
-o-transition: background-color 0.2s ease;
-ms-transition: background-color 0.2s ease;
transition: border-color 0.2s ease;
-webkit-transition: border-color 0.2s ease;
-moz-transition: border-color 0.2s ease;
-o-transition: border-color 0.2s ease;
-ms-transition: border-color 0.2s ease;
transition: border-color 0.2s ease;
}
.navi-item a, .navi-item.folder a i, .navi-item.file a i{
-webkit-transition: all 0.1s ease;
@@ -1185,6 +1195,7 @@ label .help, .label .help{
position: absolute;
background: #e0474c;
color: #fff;
font-size: 0.9em;
width: 100%;
left: 0;
top: -25px;

View File

@@ -28,7 +28,7 @@
<div class="buttonset" id="publishController" data-published="{{ item.published }}" data-drafted="{{ item.drafted }}">
<div v-if="errors.message" class="message error">${ errors.message }</div>
<button @click.prevent="saveDraft" :class="draftResult" :disabled="draftDisabled"><span class="desktop">Save&nbsp;</span>Draft</button><button @click.prevent="publishDraft" :class="publishResult" :disabled="publishDisabled">Publish</button>
<button @click.prevent="saveDraft" id="draft" :class="draftResult" :disabled="draftDisabled"><span class="desktop">Save&nbsp;</span>Draft</button><button @click.prevent="publishDraft" id="publish" :class="publishResult" :disabled="publishDisabled">Publish</button>
<div class="secondary">
<div class="secondary--block">
<button @click.prevent="depublishArticle" class="button--secondary button--secondary__hightlight" :disabled="publishStatus"><span class="desktop">${publishLabel}</span><span class="mobile">ON</span></button><button @click.prevent="showModal" class="button--secondary"><span class="desktop">delete</span><span class="mobile">X</mobile></button>

View File

@@ -45,7 +45,7 @@
return xhr;
}
function sendJson(callback, getPost, url, jsonData, cors = false)
function sendJson(callback, getPost, url, jsonData, cors)
{
if(cors)
{

View File

@@ -25,7 +25,7 @@ let editor = new Vue({
publishStatus: document.getElementById("publishController").dataset.published ? false : true,
publishLabel: document.getElementById("publishController").dataset.published ? "online" : "offline",
},
mounted(){
mounted: function(){
autosize(document.querySelector('textarea'));
},
methods: {
@@ -50,6 +50,12 @@ let editor = new Vue({
sendJson(function(response, httpStatus)
{
if(httpStatus == 400)
{
self.publishDisabled = false;
self.publishResult = "fail";
self.errors.message = "You are probably logged out. Please backup your changes, login and then try again."
}
if(response)
{
var result = JSON.parse(response);
@@ -107,6 +113,12 @@ let editor = new Vue({
},
depublishArticle: function(e){
if(this.draftDisabled == false)
{
this.errors.message = 'Please save your changes as draft first.';
return;
}
var self = this;
self.errors = {title: false, content: false, message: false};

View File

@@ -3,23 +3,24 @@ const navcomponent = Vue.component('navigation', {
props: ['name', 'parent', 'active', 'filetype', 'element', 'folder', 'level', 'url', 'root', 'freeze'],
methods: {
checkMove : function(evt)
{
{
if(evt.dragged.classList.contains('folder') && evt.from.parentNode.id != evt.to.parentNode.id)
{
return false;
}
if(evt.dragged.firstChild.className == 'active' && !editor.draftDisabled)
{
editor.errors.message = "Please save your changes before you move the file";
return false;
}
return true;
},
onStart(evt)
onStart : function(evt)
{
/* delete error messages if exist */
var errorMessages = document.getElementById("navi-errors");
if(errorMessages)
{
errorMessages.parentNode.removeChild(errorMessages);
}
editor.errors.message = false;
},
onEnd(evt)
onEnd : function(evt)
{
var locator = {
'item_id': evt.item.id,
@@ -57,12 +58,7 @@ const navcomponent = Vue.component('navigation', {
if(result.errors)
{
var publishController = document.getElementById("publishController");
var errorMessage = document.createElement("div");
errorMessage.id = "navi-errors";
errorMessage.className = "message error";
errorMessage.innerHTML = result.errors;
publishController.insertBefore(errorMessage, publishController.childNodes[0]);
editor.errors.message = result.errors;
}
if(result.url)
{
@@ -111,7 +107,7 @@ const navcomponent = Vue.component('navigation', {
let navi = new Vue({
el: "#navi",
components: {
navcomponent
'navcomponent': navcomponent,
},
data: {
title: "Navigation",
@@ -121,10 +117,10 @@ let navi = new Vue({
modalWindow: "modal hide",
},
methods:{
onStart(evt){
onStart: function(evt){
this.$refs.draggit[0].onStart(evt);
},
onEnd(evt){
onEnd: function(evt){
this.$refs.draggit[0].onEnd(evt);
},
showModal: function(e){

View File

@@ -3,16 +3,16 @@
<div id="mobile-menu" class="menu-action">Menu <span class="button-arrow"></span></div>
<h3>Settings</h3>
<ul class="menu-list margin-bottom">
<li class="menu-item"><a href="{{ path_for('settings.show') }}"{{ (route == 'settings.show') ? 'class="active"' : '' }}>System</a></li>
<li class="menu-item"><a href="{{ path_for('themes.show') }}"{{ (route == 'themes.show') ? 'class="active"' : '' }}>Themes</a></li>
<li class="menu-item"><a href="{{ path_for('plugins.show') }}"{{ (route == 'plugins.show') ? 'class="active"' : '' }}>Plugins</a></li>
<li class="menu-item"><a href="{{ path_for('settings.show') }}"{{ (route == 'settings.show') ? ' class="active"' : '' }}>System</a></li>
<li class="menu-item"><a href="{{ path_for('themes.show') }}"{{ (route == 'themes.show') ? ' class="active"' : '' }}>Themes</a></li>
<li class="menu-item"><a href="{{ path_for('plugins.show') }}"{{ (route == 'plugins.show') ? ' class="active"' : '' }}>Plugins</a></li>
</ul>
<h3>Users</h3>
<ul class="menu-list">
<li class="menu-item"><a href="{{ path_for('user.list') }}"{{ (route == 'user.list') ? 'class="active"' : '' }}>All users</a></li>
<li class="menu-item"><a href="{{ path_for('user.new') }}"{{ (route == 'user.new') ? 'class="active"' : '' }}>Create user</a></li>
<li class="menu-item"><a href="{{ path_for('user.list') }}"{{ (route == 'user.list') ? ' class="active"' : '' }}>All users</a></li>
<li class="menu-item"><a href="{{ path_for('user.new') }}"{{ (route == 'user.new') ? ' class="active"' : '' }}>Create user</a></li>
{% for user in users %}
<li class="menu-item"><a href="{{ path_for('user.show', {'username' : user }) }}"{{ (username == user) ? 'class="active"' : '' }}>{{ user }}</a></li>
<li class="menu-item"><a href="{{ path_for('user.show', {'username' : user }) }}"{{ (username == user) ? ' class="active"' : '' }}>{{ user }}</a></li>
{% endfor %}
</ul>
{% endif %}