More project setup panel improvements in the editor.
This commit is contained in:
parent
bd28a5f438
commit
ea654dcc6e
@ -1,7 +1,18 @@
|
||||
internal error: Template 'project/sys/get_folder.html' not found in runtime:0
|
||||
compile error: unknown filter len in partials/sys/folders-select.html:21
|
||||
Context: if folder.folder|len > <-- there
|
||||
Lua stack traceback:
|
||||
editor\twig/aspect\error.lua:103: in function 'new'
|
||||
editor\twig/aspect\template.lua:395: in function 'render'
|
||||
editor\twig/aspect\error.lua:49: in function 'compiler_error'
|
||||
editor\twig/aspect\compiler.lua:656: in function 'parse_filters'
|
||||
editor\twig/aspect\compiler.lua:739: in function 'parse_value'
|
||||
editor\twig/aspect\ast.lua:85: in function 'parse'
|
||||
editor\twig/aspect\compiler.lua:749: in function 'parse_expression'
|
||||
editor\twig/aspect\tags.lua:616: in function <editor\twig/aspect\tags.lua:613>
|
||||
editor\twig/aspect\compiler.lua:259: in function <editor\twig/aspect\compiler.lua:202>
|
||||
[C]: in function 'pcall'
|
||||
editor\twig/aspect\compiler.lua:126: in function 'run'
|
||||
editor\twig/aspect\template.lua:232: in function 'compile'
|
||||
editor\twig/aspect\template.lua:311: in function 'get_view'
|
||||
editor\twig/aspect\template.lua:393: in function 'render'
|
||||
.\editor\twig\twig.lua:40: in function 'parse'
|
||||
.\editor\routes\xml.lua:15: in function 'process_requests'
|
||||
.\lua\https-server.lua:309: in function <.\lua\https-server.lua:275>
|
||||
.\lua\https-server.lua:297: in function <.\lua\https-server.lua:266>
|
||||
@ -83,6 +83,7 @@ local posts_assetloaddata = {
|
||||
end,
|
||||
}
|
||||
|
||||
-- Technically this gets files and folders, but we only show folders and slp's
|
||||
local posts_projectsysgetfolder = {
|
||||
pattern = "/project/sys/get_folder$",
|
||||
func = function(matches, stream, headers, body)
|
||||
@ -92,14 +93,18 @@ local posts_projectsysgetfolder = {
|
||||
end
|
||||
|
||||
local cdata = json.decode(body)
|
||||
print("Folder selected: ", cdata.folder)
|
||||
|
||||
if(cdata.folder) then
|
||||
|
||||
if(cdata.folder == "..") then
|
||||
route.ecs_server.projectmgr.sys.current_folder = dirtools.get_parent(route.ecs_server.projectmgr.sys.current_folder)
|
||||
else
|
||||
route.ecs_server.projectmgr.sys.current_folder = dirtools.combine_path(route.ecs_server.projectmgr.sys.current_folder, cdata.folder)
|
||||
local path, name, ext = dirtools.fileparts(cdata.folder)
|
||||
if(ext ~= "slp") then
|
||||
route.ecs_server.projectmgr.sys.current_folder = dirtools.combine_path(route.ecs_server.projectmgr.sys.current_folder, cdata.folder)
|
||||
end
|
||||
end
|
||||
route.ecs_server.projectmgr.sys.folders = dirtools.get_folderslist(route.ecs_server.projectmgr.sys.current_folder, true)
|
||||
route.ecs_server.projectmgr.sys.folders = dirtools.get_dirlist(route.ecs_server.projectmgr.sys.current_folder, true, "slp")
|
||||
end
|
||||
return route.http_server.json("success")
|
||||
end,
|
||||
@ -114,7 +119,6 @@ local posts_projectsysgetdrive = {
|
||||
end
|
||||
|
||||
local cdata = json.decode(body)
|
||||
print("Drive selected: ", cdata.drive)
|
||||
if(cdata.drive) then
|
||||
route.ecs_server.projectmgr.sys.current_folder = cdata.drive
|
||||
route.ecs_server.projectmgr.sys.folders = dirtools.get_folderslist(cdata.drive)
|
||||
|
||||
@ -369,7 +369,7 @@ function template:render_view(view, vars, options)
|
||||
out:push_view(view)
|
||||
end
|
||||
ok, error = pcall(view.body, out, vars)
|
||||
print(ok,error)
|
||||
--print(ok,error)
|
||||
if ok then
|
||||
return out:finish()
|
||||
elseif err.is(error) then
|
||||
|
||||
@ -703,9 +703,23 @@ table.dataTable thead .sorting:after {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sys-folders-list th {
|
||||
padding: 0!important;
|
||||
border-bottom: 0!important;
|
||||
}
|
||||
|
||||
.sys-folders-list th > form > div {
|
||||
margin-bottom: 2px!important;
|
||||
}
|
||||
|
||||
.sys-folders-list tbody {
|
||||
overflow-y: scroll;
|
||||
height: 28vh;
|
||||
}
|
||||
|
||||
.sys-folders-list-project button {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
@ -8,38 +8,6 @@
|
||||
<h4 class="modal-title" id="myModalLabel">Projects</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
Project Load
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>Creating a New Project will create a folder with the project name in the selected Folder Path.</p>
|
||||
<p> <i>Note: The project name does not support symbols.</i></p>
|
||||
|
||||
<form role="form">
|
||||
<div class="form-group input-group">
|
||||
<span class="input-group-addon">Project Name</span>
|
||||
<input type="text" class="form-control" placeholder="MegaProject">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p>Configuration for the project can be modified after the project has been created.</p>
|
||||
|
||||
<p>
|
||||
Drives:
|
||||
{% for drive in projectmgr.sys.drives %}
|
||||
<button type="button" class="btn btn-primary drive-select" data="{{ drive }}">{{ drive }}</button>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<div id="sys-folders-select" class="sys-folders"></div>
|
||||
</div>
|
||||
<div class="panel-footer modal-footer">
|
||||
<button type="button" class="btn btn-primary">New Project</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-lg-6 -->
|
||||
|
||||
<div class="row">
|
||||
<div class="panel panel-primary">
|
||||
@ -76,6 +44,37 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-lg-6 -->
|
||||
|
||||
<div class="row">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
Create or Open Project
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>Creating a New Project will create a folder with the project name in the selected Folder Path.</p>
|
||||
<p> <i>Note: The project name does not support symbols.</i></p>
|
||||
|
||||
<form role="form">
|
||||
<div class="form-group input-group">
|
||||
<span class="input-group-addon">New Project Name</span>
|
||||
<input type="text" class="form-control" placeholder="MegaProject">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p>Configuration for the project can be modified after the project has been created.</p>
|
||||
|
||||
<p>
|
||||
Drives:
|
||||
{% for drive in projectmgr.sys.drives %}
|
||||
<button type="button" class="btn btn-primary drive-select" data="{{ drive }}">{{ drive }}</button>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<div id="sys-folders-select" class="sys-folders"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col-lg-6 -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -2,6 +2,12 @@
|
||||
|
||||
<script>
|
||||
|
||||
function updateFolders(data) {
|
||||
$("#sys-folders-select").load( "/partials/sys/folders-select.html", null, function() {
|
||||
checkFolderSelect();
|
||||
});
|
||||
}
|
||||
|
||||
function postData( url, data, success )
|
||||
{
|
||||
var jqxhr = $.ajax({
|
||||
@ -18,11 +24,7 @@ function checkFolderSelect()
|
||||
{
|
||||
$(".sys-select-folder").on("click", function(evt){
|
||||
var jdata = { folder: $(this).text()};
|
||||
postData("/project/sys/get_folder", jdata, function(data){
|
||||
$("#sys-folders-select").load( "/partials/sys/folders-select.html", null, function() {
|
||||
checkFolderSelect();
|
||||
})
|
||||
});
|
||||
postData("/project/sys/get_folder", jdata, updateFolders);
|
||||
});
|
||||
}
|
||||
|
||||
@ -31,11 +33,7 @@ $(document).ready(function () {
|
||||
$(".drive-select").on("click", function(evt){
|
||||
console.log($(this).attr("data"));
|
||||
var jdata = { drive: $(this).attr("data")};
|
||||
postData("/project/sys/get_drive", jdata, function(data){
|
||||
$("#sys-folders-select").load( "/partials/sys/folders-select.html", null, function() {
|
||||
checkFolderSelect();
|
||||
});
|
||||
});
|
||||
postData("/project/sys/get_drive", jdata, updateFolders);
|
||||
evt.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
@ -4,13 +4,25 @@
|
||||
<table class="table table-striped table-bordered table-hover sys-folders-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Folder Path: {{ projectmgr.sys.current_folder }} </th>
|
||||
<th>
|
||||
<form role="form">
|
||||
<div class="form-group btn-group input-group">
|
||||
<span class="input-group-addon">Folder Path</span>
|
||||
<input type="text" class="form-control" placeholder="{{ projectmgr.sys.current_folder }}">
|
||||
<div class="input-group-btn"><button type="button" class="btn btn-primary">Create</button></div>
|
||||
</div>
|
||||
</form>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for folder in projectmgr.sys.folders %}
|
||||
<tr>
|
||||
{% if folder.folder or folder.name == ".." %}
|
||||
<td class="sys-select-folder">{{ folder.name }}</td>
|
||||
{% else %}
|
||||
<td class="sys-folders-list-project">{{ folder.name }} <button type="button" class="btn btn-primary"><i class="fa fa-arrow-right fa-fw"></i></button></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@ -15,6 +15,7 @@ local projectmanager = {
|
||||
sys = {
|
||||
drives = dirtools.get_drives(),
|
||||
folders = dirtools.get_folderslist("."),
|
||||
current_folder = dirtools.get_app_path(),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
0
projects/test/project_name.slp
Normal file
0
projects/test/project_name.slp
Normal file
@ -33,10 +33,10 @@ local tconcat = table.concat
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
local allfolders_cmd = "dir /ON /AD /B %s"
|
||||
if(ffi.os ~= "Windows") then allfolders_cmd = "ls -p %s | grep /" end
|
||||
local allfiles_cmd = "dir /ON /A-D /B %s"
|
||||
if(ffi.os ~= "Windows") then allfiles_cmd = "ls -p %s | grep -v /" end
|
||||
local allfolders_cmd = [[dir /ON /AD /B "%s"]]
|
||||
if(ffi.os ~= "Windows") then allfolders_cmd = [[ls -p "%s" | grep /]] end
|
||||
local allfiles_cmd = [[dir /ON /A-D /B "%s"]]
|
||||
if(ffi.os ~= "Windows") then allfiles_cmd = [[ls -p "%s" | grep -v /]] end
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
|
||||
@ -169,7 +169,7 @@ end
|
||||
if(ffi.os == "Windows") then
|
||||
dirtools.is_folder = function(path)
|
||||
|
||||
local fh = io.popen("attrib "..path, "r")
|
||||
local fh = io.popen([[attrib "]]..path..[["]], "r")
|
||||
if(fh) then
|
||||
local res = fh:read("*a")
|
||||
local fileattr = string.sub(res, 1, 20)
|
||||
@ -198,8 +198,8 @@ end
|
||||
dirtools.make_folder = function(folderpath)
|
||||
|
||||
if(dirtools.is_folder(folderpath) == false) then
|
||||
local cmd = "mkdir -f "..folderpath
|
||||
if(ffi.os == "Windows") then cmd = "mkdir "..folderpath end
|
||||
local cmd = [[mkdir -f "]]..folderpath..[["]]
|
||||
if(ffi.os == "Windows") then cmd = [[mkdir "]]..folderpath..[["]] end
|
||||
local fh = io.popen(cmd, "r")
|
||||
if(fh) then
|
||||
local data = fh:read("*a")
|
||||
@ -249,7 +249,7 @@ dirtools.get_app_path = function( expected_root_folder )
|
||||
base_dir = ""
|
||||
end
|
||||
end
|
||||
-- print("Base Directory: "..base_dir)
|
||||
-- log_info("Base Directory: "..base_dir)
|
||||
return base_dir
|
||||
end
|
||||
|
||||
@ -294,7 +294,7 @@ end
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
dirtools.get_dirlist = function(path, cache_update)
|
||||
dirtools.get_dirlist = function(path, cache_update, extfilter)
|
||||
|
||||
-- Check path first. If its a drive on windows then no caching
|
||||
if(ffi.os == "Windows") then
|
||||
@ -307,7 +307,7 @@ dirtools.get_dirlist = function(path, cache_update)
|
||||
end
|
||||
|
||||
-- Get all the folders first
|
||||
local files = dirtools.get_folderslist(path)
|
||||
local files = dirtools.get_folderslist(path, cache_update)
|
||||
|
||||
-- Add the files to the list.
|
||||
local res = ""
|
||||
@ -326,10 +326,17 @@ dirtools.get_dirlist = function(path, cache_update)
|
||||
end
|
||||
|
||||
for f in string.gmatch(res, "(.-)\n") do
|
||||
local newfile = { name = ffi.string(f), folder = nil }
|
||||
newfile.select = ffi.new("int[1]")
|
||||
newfile.select[0] = 0
|
||||
table.insert(files, newfile)
|
||||
-- Only match with filter on end of filename
|
||||
local add_file = true
|
||||
if(extfilter) then
|
||||
add_file = string.match(f, extfilter.."$")
|
||||
end
|
||||
if(add_file) then
|
||||
local newfile = { name = ffi.string(f), folder = nil }
|
||||
newfile.select = ffi.new("int[1]")
|
||||
newfile.select[0] = 0
|
||||
table.insert(files, newfile)
|
||||
end
|
||||
end
|
||||
|
||||
list_cache[path] = files
|
||||
@ -362,7 +369,7 @@ local function windows_dir( folder )
|
||||
if f then
|
||||
result = f:read("*a")
|
||||
else
|
||||
print("[Error] failed to read - "..tostring(folder))
|
||||
log_error("failed to read - "..tostring(folder))
|
||||
end
|
||||
return result
|
||||
end
|
||||
@ -375,7 +382,7 @@ local function unix_dir( folder )
|
||||
if f then
|
||||
result = f:read("*a")
|
||||
else
|
||||
print("[Error] failed to read - "..tostring(folder))
|
||||
log_error("failed to read - "..tostring(folder))
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user