Files
LeafWeb/WebCms/Views/LeafInput/Create.cshtml
T
2019-12-15 21:18:51 -05:00

164 lines
7.1 KiB
Plaintext

@using ClientDependency.Core.Mvc
@using LeafWeb.WebCms.Controllers
@using Umbraco.Web
@model LeafInputCreate
@{
Html.RequiresCss("~/backload/blueimp/bootstrap/BasicPlusUI/css");
Html.RequiresJs("~/scripts/jquery.autocomplete.min.js", 2);
Html.RequiresJs("~/scripts/jquery.validate.min.js", 2);
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.min.js", 2);
Html.RequiresJs("~/scripts/jquery.validate.unobtrusive.bootstrap.min.js", 2);
Html.RequiresJs("~/scripts/jquery.validate.custom.js", 2);
Html.RequiresJs("~/scripts/LeafInputCreate.js", 3);
var user = Membership.GetUser();
}
<div class="container-lg">
<div class="row">
<div class="col-md-8 card card-body bg-light">
@Html.Partial("_ValidationSummary")
<form id="fileupload" action="/Backload/FileHandler" method="POST" enctype="multipart/form-data">
<h4 class="card-title">Files</h4>
<div class="container-fluid fileupload-buttonbar">
<div class="row">
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="col-auto mr-auto">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-sm btn-outline-secondary fileinput-button">
<i class="fa fa-plus"></i>
<span>Add files...</span>
<input type="file" name="files[]" multiple>
</span>
<!-- The global file processing state -->
<span class="fileupload-process"></span>
</div>
<div class="col-auto">
<button type="button" class="btn btn-sm btn-outline-secondary delete">
<i class="fa fa-trash"></i>
<span>Delete</span>
</button>
<div class="form-check" style="margin-left: 10px; white-space: nowrap;">
<input class="form-check-input toggle" type="checkbox" name="selectCheck" id="selectCheck">
<label class="form-check-label" for="selectCheck">Select all</label>
</div>
</div>
</div>
</div>
<!-- The global progress state -->
<div class="row fileupload-progress fade">
<!-- The global progress bar -->
<div class="progress progress-bar-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar bg-success" style="width: 0%;"></div>
</div>
<!-- The extended global progress state -->
@*<div class="progress-extended">&nbsp;</div>*@
</div>
@Html.Partial("_ValidationField", "Files")
<!-- The table listing the files available for upload/download -->
<div class="table-responsive">
<table role="presentation" class="table table-sm table-striped"><tbody class="files"></tbody></table>
</div>
</form>
@using (Html.BeginUmbracoForm<LeafInputController>("Submit", null, new { id = "create" }))
{
@Html.EditorFor(m => m.PhotosynthesisType)
@Html.EditorFor(m => m.Identifier)
@Html.EditorFor(m => m.SiteId)
if (user == null)
{
@Html.EditorFor(m => m.Name)
@Html.EditorFor(m => m.Email)
@Html.EditorFor(m => m.EmailConfirm)
}
else
{
@Html.HiddenFor(m => m.Name)
@Html.HiddenFor(m => m.Email)
@Html.HiddenFor(m => m.EmailConfirm)
}
@Html.EditorFor(m => m.TermsOfService)
<input type="submit" id="submit-form" class="d-none" />
}
<div class="container"><div class="row">
<label for="submit-form" class="btn btn-primary col-6 offset-6 col-sm-5 offset-sm-7 col-md-4 offset-md-8">Submit...</label>
</div></div>
</div>
</div>
</div>
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td>
<p class="name">{%=file.name%}</p>
<strong class="error text-danger"></strong>
</td>
<td>
<p class="size">Processing...</p>
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div class="progress-bar progress-bar-success" style="width:0%;"></div>
</div>
</td>
<td>
{% if (!i && !o.options.autoUpload) { %}
<button class="btn btn-sm btn-primary start" disabled>
<i class="fa fa-upload"></i>
<span>Start</span>
</button>
{% } %}
{% if (!i) { %}
<button class="btn btn-sm btn-warning cancel">
<i class="fa fa-ban"></i>
<span>Cancel</span>
</button>
{% } %}
</td>
</tr>
{% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-download fade">
<td>
<p class="name">
{% if (file.url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}">{%=file.name%}</a>
{% } else { %}
<span>{%=file.name%}</span>
{% } %}
</p>
{% if (file.error) { %}
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
{% } %}
</td>
<td>
<span class="size">{%=o.formatFileSize(file.size)%}</span>
</td>
<td>
{% if (file.deleteUrl) { %}
<button class="btn btn-sm btn-outline-secondary delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}" {% if (file.deletewithcredentials) { %} data-xhr-fields='{"withCredentials":true}' {% } %}>
<i class="fa fa-trash"></i>
<span>Delete</span>
</button>
<input type="checkbox" name="delete" value="1" class="toggle">
{% } else { %}
<button class="btn btn-sm btn-warning cancel">
<i class="fa fa-ban"></i>
<span>Cancel</span>
</button>
{% } %}
</td>
</tr>
{% } %}
</script>