added more helpers

This commit is contained in:
Jon Lambson 2017-09-28 17:27:10 -06:00
parent 699e510a61
commit 7c5cd4e152
3 changed files with 36 additions and 11 deletions

View File

@ -307,6 +307,7 @@ app.controller('websiteCtrl', [
console.log(r); console.log(r);
}; };
vm.Sites.upload = function (r) { vm.Sites.upload = function (r) {
r.uploadPath = vm.autoPopulateWebPath;
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
//analyzeFile(r.newFile, r); //analyzeFile(r.newFile, r);
vm._uploadFile(pkg, r); vm._uploadFile(pkg, r);
@ -348,10 +349,10 @@ app.controller('websiteCtrl', [
vm.breadcrumbs = ['Root']; vm.breadcrumbs = ['Root'];
vm.breadcrumbsPath = ['/']; vm.breadcrumbsPath = ['/'];
vm.breadcrumbPathClicked = false; vm.breadcrumbPathClicked = false;
vm.webPathAutofill = '/';
vm.Sites.contents = function (r) { vm.Sites.contents = function (r) {
vm.siteResults = r; vm.siteResults = r;
vm.directoryPath = r.newPath; vm.directoryPath = r.newPath;
vm.showListFiles = true;
vm.siteDirectories = []; vm.siteDirectories = [];
vm.siteFiles = []; vm.siteFiles = [];
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
@ -362,12 +363,17 @@ app.controller('websiteCtrl', [
if (typeof path !== 'object') { if (typeof path !== 'object') {
vm.breadcrumbs.push(path); vm.breadcrumbs.push(path);
vm.breadcrumbsPath.push(path); vm.breadcrumbsPath.push(path);
vm.autoPopulateWebPath = vm.breadcrumbsPath;
vm.autoPopulateWebPath.push('/');
vm.autoPopulateWebPath = vm.autoPopulateWebPath.join('');
} }
if (vm.breadcrumbPathClicked) { if (vm.breadcrumbPathClicked) {
if (path === 'Root') { if (path === 'Root') {
vm.breadcrumbs = ['Root']; vm.breadcrumbs = ['Root'];
vm.breadcrumbsPath = ['/']; vm.breadcrumbsPath = ['/'];
vm.breadcrumbPathClicked = false; vm.breadcrumbPathClicked = false;
vm.autoPopulateWebPath = "/";
vm.showUploadContainer = false;
} else { } else {
var breadcrumbsPath = vm.breadcrumbsPath; var breadcrumbsPath = vm.breadcrumbsPath;
var breadcrumbs = vm.breadcrumbs; var breadcrumbs = vm.breadcrumbs;
@ -375,6 +381,9 @@ app.controller('websiteCtrl', [
var removeFromBreadcrumbs = breadcrumbs.indexOf(path) + 1; var removeFromBreadcrumbs = breadcrumbs.indexOf(path) + 1;
vm.breadcrumbsPath = breadcrumbsPath.splice(0,removeFromBreadcrumbsPath); vm.breadcrumbsPath = breadcrumbsPath.splice(0,removeFromBreadcrumbsPath);
vm.breadcrumbs = breadcrumbs.splice(0,removeFromBreadcrumbs); vm.breadcrumbs = breadcrumbs.splice(0,removeFromBreadcrumbs);
var updatebreadcrumbsPath = vm.breadcrumbsPath;
vm.autoPopulateWebPath = updatebreadcrumbsPath.join('');
vm.autoPopulateWebPath = vm.autoPopulateWebPath+"/";
} }
} }
} }
@ -569,11 +578,6 @@ app.controller('websiteCtrl', [
vm.websiteTiles = true; vm.websiteTiles = true;
vm.showBackBtn = true; vm.showBackBtn = true;
break; break;
case 'upload':
vm.showUploadContainer = true;
vm.websiteTiles = true;
vm.showBackBtn = true;
break;
default: default:
} }
}; };

View File

@ -12,7 +12,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ng-click="vm.showSharesList = false; vm.showListFiles = false;"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">Create a new Website</h4> <h4 class="modal-title">Create a new Website</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -11,7 +11,7 @@
<ul class="tree ls-none"> <ul class="tree ls-none">
<li class="directories-go-here" ng-repeat="directory in vm.siteDirectories track by $index"> <li class="directories-go-here" ng-repeat="directory in vm.siteDirectories track by $index">
<input type="checkbox" id="{{ r.challenge }}{{ $index }}" /> <input type="checkbox" id="{{ r.challenge }}{{ $index }}" />
<label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory)" data="{{ directory }}">{{ directory }}</label> <label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory); vm.showUploadContainer = false" data="{{ directory }}">{{ directory }}</label>
</li> </li>
</ul> </ul>
<ul class="tree files-only ls-none"> <ul class="tree files-only ls-none">
@ -19,11 +19,32 @@
<span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></button></span> <span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs"><i class="fa fa-trash"></i></button></span>
</li> </li>
<li class="move-back"> <li class="move-back">
<a><i class="fa fa-plus"></i> Add Files</a> <a ng-click="vm.showUploadContainer = true;"><i class="fa fa-plus"></i> Add Files</a>
</li> </li>
</ul> </ul>
<hr> <div class="upload-container" ng-show="vm.showUploadContainer">
<h1>ADD UPLOAD STUFF HERE</h1> <hr>
<h4 class="text-left">Upload Files:</h4>
<div>
<input type="file" ng-model="r.newFile" class="form-control" daplie-file-change="vm.Sites.setUpload(r)" />
<div ng-if="r.isZip"><label><input type="checkbox" ng-model="r.unzip" /> Unpack .zip</label></div>
<div ng-if="r.unzip"><label><input type="checkbox" ng-model="r.stripZip" /> Strip zip directory root</label></div>
<!-- div ng-if="vm.isZip" ><label>Unzip directory</label> <input type="text" ng-model="vm.unzipPath" /></div -->
<div ng-if="r.uploadTotal"><span ng-bind="r.uploadPercent">99</span>% | <span ng-bind="r.uploadProgress">1</span> MiB / <span ng-bind="r.uploadTotal">100</span> MiB</div>
<div>
<label>Web path</label>
<input type="text" class="form-control" ng-model="vm.autoPopulateWebPath" />
<!-- <input type="text" class="form-control" ng-model="r.uploadPath" placeholder="{{ vm.autoPopulateWebPath }}"/> -->
</div>
<button ng-click="vm.Sites.upload(r)" type="button" name="button" class="btn btn-default">Add File</button>
</div>
</div>
</div> </div>
<div class="col-lg-6"> <div class="col-lg-6">
<pre style="font-size: 10px;">{{ vm.folderStructure | stringify }}</pre> <pre style="font-size: 10px;">{{ vm.folderStructure | stringify }}</pre>