Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method='POST' enctype="multipart/form-data" autocomplete="off"> {% csrf_token %}
- <div class="form-container" style="box-shadow: 0 0 5px black;">
- <div class="container">
- <div class="row">
- <div class="file-input col-md-6">
- <fieldset>
- <legend>Files</legend>
- <div class="field-wrapper-video field-wrapper">
- {% if form.media.errors %}
- {% for error in form.media.errors %}
- <small class = "error-element-video error-element"><strong>{{ error|escape }}</strong></small>
- {% endfor %}
- {% endif %}
- <label class="label-video form-label" for="{{ form.media.id_for_label }}">Video:</label>
- <div>
- <div id="dropContainerVideo" style="border:1px dashed grey;height:16vh;">
- <input type="file" id="fileInputVideo" name="media" style="display:none; z-index:1;"/>
- <div id="video-drop-text" style="z-index:0; text-align:center; vertical-align: middle; line-height: 16vh;">
- <small unselectable="on" class="non-select"> Drop File Here </small>
- </div>
- </div>
- </div>
- <div class="progess-bar">
- <div class="progress-bar-container">
- <progress id="progressbar" value="0" max ="100" style="width:30vw"></progress><br>
- <p id="status"></p><br>
- <p id="loaded"></p>
- </div>
- </div>
- <script>
- dropContainerVideo.addEventListener("click", clickFile)
- function clickFile(){
- document.getElementById("fileInputVideo").click();
- }
- dropContainerVideo.ondragover = dropContainerVideo.ondragenter = function(evt) {
- dropContainerVideo.setAttribute("contenteditable", true);
- evt.preventDefault();
- };
- dropContainerVideo.ondrop = function(evt) {
- evt.preventDefault();
- fileInputVideo.files = evt.dataTransfer.files;
- var fullPath = document.getElementById('fileInputVideo').value;
- if (fullPath) {
- var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
- var filename = fullPath.substring(startIndex);
- if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) {
- filename = filename.substring(1);
- }
- }
- document.getElementById('video-drop-text').innerHTML = "<small>"+ filename +"</small>";
- dropContainerVideo.removeAttribute("contenteditable", true);
- };
- fileInputVideo.onchange = function(evt){
- fileInputVideo.files = evt.dataTransfer.files;
- var fullPath = document.getElementById('fileInputVideo').value;
- if (fullPath) {
- var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
- var filename = fullPath.substring(startIndex);
- if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) {
- filename = filename.substring(1);
- }
- }
- document.getElementById('video-drop-text').innerHTML = "<small>"+ filename +"</small>";
- }
- </script>
- </div>
- <div class="field-wrapper-thumbnail field-wrapper">
- {% if form.thumbnail.errors %}
- {% for error in form.thumbnail.errors %}
- <small class = "error-element-thumbnail error-element"><strong>{{ error|escape }}</strong></small>
- {% endfor %}
- {% endif %}
- <label class="label-thumbnail form-label" for="{{ form.thumbnail.id_for_label }}">Thumbnail:</label>
- <!-- <input id="thumbnail" type="file" name="thumbnail" class="input input-thumbnail form-control"> -->
- <div>
- <div id="dropContainerThumbnail" style="border:1px dashed grey;height:16vh;">
- <input type="file" id="fileInputThumbnail" name="thumbnail" style="display:none; z-index:1;"/>
- <div id="thumbnail-drop-text" style="z-index:0; text-align:center; vertical-align: middle; line-height: 16vh;">
- <small unselectable="on" class="non-select"> Drop File Here </small>
- </div>
- </div>
- </div>
- <script>
- dropContainerThumbnail.addEventListener("click", clickFile)
- function clickFile(){
- document.getElementById("fileInputThumbnail").click();
- }
- dropContainerThumbnail.ondragover = dropContainerThumbnail.ondragenter = function(evt) {
- dropContainerThumbnail.setAttribute("contenteditable", true);
- evt.preventDefault();
- };
- dropContainerThumbnail.ondrop = function(evt) {
- evt.preventDefault();
- fileInputThumbnail.files = evt.dataTransfer.files;
- var fullPath = document.getElementById('fileInputThumbnail').value;
- if (fullPath) {
- var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
- var filename = fullPath.substring(startIndex);
- if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) {
- filename = filename.substring(1);
- }
- }
- document.getElementById('thumbnail-drop-text').innerHTML = "<small>"+ filename +"</small>";
- dropContainerThumbnail.removeAttribute("contenteditable", true);
- };
- fileInputThumbnail.onchange = function(evt){
- var fullPath = document.getElementById('fileInputThumbnail').value;
- if (fullPath) {
- var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
- var filename = fullPath.substring(startIndex);
- if (filename.indexOf('\\') === 0 || filename.indexOf('/') === 0) {
- filename = filename.substring(1);
- }
- }
- document.getElementById('thumbnail-drop-text').innerHTML = "<small>"+ filename +"</small>";
- }
- </script>
- </div>
- <small>
- Show list of thumbnails chosen at random from uploaded video file
- </small>
- </fieldset>
- </div>
- <div class="detail-input col-md-6">
- <fieldset>
- <legend>Details</legend>
- <div class="field-wrapper-title field-wrapper">
- {% if form.title.errors %}
- <ol class="error-list-title error-list">
- {% for error in form.title.errors %}
- <li class = "error-list-element-title error-list-element"><strong>{{ error|escape }}</strong></li>
- {% endfor %}
- </ol>
- {% endif %}
- <div class="row">
- <div class="col-md-4">
- <label class="label-title form-label" for="{{ form.title.id_for_label }}">Title:</label>
- </div>
- <div class="col-md-4">
- <input id="title" type="textfield" name="title" class="input input-title form-control" autocomplete="off" placeholder="Video Title">
- </div>
- </div>
- </div>
- <br>
- <div class="field-wrapper-description field-wrapper">
- {% if form.description.errors %}
- <ol class="error-list-description error-list">
- {% for error in form.description.errors %}
- <li class = "error-list-element-description error-list-element"><strong>{{ error|escape }}</strong></li>
- {% endfor %}
- </ol>
- {% endif %}
- <div class="row">
- <div class="col-md-4">
- <label class="label-description form-label" for="{{ form.description.id_for_label }}">Description:</label>
- </div>
- <div class="col-md-4">
- <textarea id="description" name="description" class="input input-description form-control" autocomplete="off" placeholder="Description shown in view page"></textarea>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-4">
- </div>
- <div class="col-md-8">
- <small>checkbox for copying description to list</small>
- </div>
- </div>
- <div class="field-wrapper-description_short field-wrapper">
- {% if form.description_short.errors %}
- <ol class="error-list-description_short error-list">
- {% for error in form.description_short.errors %}
- <li class = "error-list-element-description_short error-list-element"><strong>{{ error|escape }}</strong></li>
- {% endfor %}
- </ol>
- {% endif %}
- <div class="row">
- <div class="col-md-4">
- <label class="label-description_short form-label" for="{{ form.description_short.id_for_label }}">Search Description:</label>
- </div>
- <div class="col-md-4">
- <textarea id="description_short" onkeyup="textCounter(this,'counter-description_short',300);" maxlength="300" name="description_short" class="input input-description_short form-control" autocomplete="off" placeholder="Description shown in search page"></textarea>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-4">
- </div>
- <div class="col-md-8">
- <small id="counter-label-description_short">Characters remaining: </small><small id="counter-description_short">300</small>
- </div>
- </div>
- <script>
- function textCounter(field,field2,maxlimit)
- {
- var countfield = document.getElementById(field2);
- if ( field.value.length > maxlimit ) {
- field.value = field.value.substring( 0, maxlimit );
- return false;
- } else {
- document.getElementById("counter-description_short").innerHTML = maxlimit - field.value.length;
- }
- if (maxlimit - field.value.length < 50){
- document.getElementById("counter-description_short").style.color = "darkred";
- document.getElementById("counter-label-description_short").style.color = "darkred";
- } else {
- document.getElementById("counter-description_short").style.color = "black";
- document.getElementById("counter-label-description_short").style.color = "black";
- }
- }
- </script>
- <div class="field-wrapper-category field-wrapper">
- {% if form.category.errors %}
- <ol class="error-list-category error-list">
- {% for error in form.category.errors %}
- <li class = "error-list-element-category error-list-element"><strong>{{ error|escape }}</strong></li>
- {% endfor %}
- </ol>
- {% endif %}
- <div class="row">
- <div class="col-md-4">
- <label class="label-category form-label" for="{{ form.category.id_for_label }}">Category:</label>
- </div>
- <div class="col-md-4">
- <select id="category" name="category" class="input input-category form-control">
- {% for obj in categories%}
- <option value="{{obj.pk}}">{{ obj.description.capitalize }}</option>
- {% endfor %}
- </select>
- </div>
- </div>
- </div>
- <br>
- <div class="field-wrapper-time field-wrapper">
- {% if form.time.errors %}
- <ol class="error-list-time error-list">
- {% for error in form.time.errors %}
- <li class = "error-list-element-time error-list-element"><strong>{{ error|escape }}</strong></li>
- {% endfor %}
- </ol>
- {% endif %}
- <div class="row">
- <div class="col-md-4">
- <label class="label-time form-label" for="{{ form.time.id_for_label }}">Time:</label>
- </div>
- <div class="col-md-4">
- <input id="time" type="number" name="time" class="input input-time form-control" autocomplete="off">
- </div>
- </div>
- </div>
- <br>
- <div class="field-wrapper-type field-wrapper">
- {% if form.type.errors %}
- <ol class="error-list-type error-list">
- {% for error in form.type.errors %}
- <li class = "error-list-element-type error-list-element"><strong>{{ error|escape }}</strong></li>
- {% endfor %}
- </ol>
- {% endif %}
- <div class="row">
- <div class="col-md-4">
- <label class="label-type form-label" for="{{ form.type.id_for_label }}">Type:</label>
- </div>
- <div class="col-md-4">
- <select id="type" name="type" class="input input-type form-control">
- <option value="0" selected>Public</option>
- <option value="1">Private</option>
- <option value="2">Linkable</option>
- </select>
- </div>
- </div>
- </div>
- <br>
- {{ form.non_field_errors }}
- </fieldset>
- </div>
- </div>
- <div class="row">
- <div class="col-md-8">
- <small>here we will say something like accept the fucking terms and agreements when uploading </small>
- </div>
- <div class="col-md-2">
- <button type="submit" class="submit-button btn btn-primary" >Save</button>
- </div>
- </div>
- <br>
- </div>
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement