From: Christian Weiske Date: Tue, 3 Apr 2012 21:23:36 +0000 (+0200) Subject: deleting files works now X-Git-Tag: v0.1.0~57 X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/cdc99846c94bacdd7a2a0681d77bac3de45c4f2a deleting files works now --- diff --git a/README.rst b/README.rst index af8b42e..f5c7b78 100644 --- a/README.rst +++ b/README.rst @@ -13,6 +13,9 @@ Features ======== - every paste is a git repository - paste editing + + - add new files + - delete existing files - multiple files in one paste - syntax highlighting with GeSHi - rST rendering diff --git a/data/templates/edit-file.htm b/data/templates/edit-file.htm index 37f9253..b0a4848 100644 --- a/data/templates/edit-file.htm +++ b/data/templates/edit-file.htm @@ -14,5 +14,18 @@ +
+
+   + +
+
+ + +
+
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 828dbad..1b60752 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -44,6 +44,7 @@ class Repository_Post } $bNew = false; + $bDelete = false; if (!isset($orignalName) || $orignalName == '') { //new file $bNew = true; @@ -51,6 +52,8 @@ class Repository_Post //unknown file //FIXME: Show error message continue; + } else if (isset($arFile['delete']) && $arFile['delete'] == 1) { + $bDelete = true; } else if ($orignalName != $name) { //FIXME: what to do with overwrites? $vc->getCommand('mv') @@ -61,7 +64,12 @@ class Repository_Post } $file = $this->repo->getFileByName($name, false); - if ($bNew || $file->getContent() != $arFile['content']) { + if ($bDelete) { + $command = $vc->getCommand('rm') + ->addArgument($file->getFilename()) + ->execute(); + $bChanged = true; + } else if ($bNew || $file->getContent() != $arFile['content']) { file_put_contents($file->getPath(), $arFile['content']); $command = $vc->getCommand('add') ->addArgument($file->getFilename()) diff --git a/www/phorkie.css b/www/phorkie.css index a09aef1..f9f3ad0 100644 --- a/www/phorkie.css +++ b/www/phorkie.css @@ -62,4 +62,8 @@ form input#description { box-sizing: border-box; height: 2em; width: 100%; +} + +form label.inline { + display: inline; } \ No newline at end of file