Add file deletion functionality

Adds route for file deletion
Add styles and images for this
This commit is contained in:
Maarten Engelen
2016-08-07 17:18:36 +02:00
parent 6316f97c06
commit 236680aab9
3 changed files with 29 additions and 1 deletions
+13
View File
@@ -221,6 +221,19 @@ module Precious
end
end
post '/deleteFile/*' do
forbid unless @allow_editing
wiki = wiki_new
filepath = params[:splat].first
unless filepath.nil?
commit = commit_message
commit[:message] = "Deleted #{filepath}"
wiki.delete_file(filepath, commit)
end
redirect to('/fileview')
end
post '/rename/*' do
wikip = wiki_page(params[:splat].first)
halt 500 if wikip.nil?
+16 -1
View File
@@ -85,6 +85,22 @@ ol.tree
margin-right: 7px;
vertical-align: text-top;
}
li.file form
{
vertical-align:middle;
display: inline-block;
}
li.file form button
{
vertical-align:middle;
height: 20px;
padding-left: 36px;
padding-right: 10px;
border: 0px solid #000000;
background: url("../images/fileview/trashcan.png") no-repeat 16px center;
cursor: pointer;
}
}
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
@@ -125,4 +141,3 @@ ol.tree
}
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB