Browse Source

test

master
Pascal Gloor 5 years ago
parent
commit
7cab1fec41
3 changed files with 64 additions and 27 deletions
  1. 12
    0
      www/css/autodoc.css
  2. 13
    7
      www/index.html
  3. 39
    20
      www/js/autodoc.js

+ 12
- 0
www/css/autodoc.css View File

margin-top: 60px; margin-top: 60px;
margin-bottom: 60px; margin-bottom: 60px;
} }

.autodoc_upload_zone {
border: 2px dashed #999;
border-radius: 20px;
padding-top: 20px;
padding-bottom: 20px;
}

.autodoc_upload_zone_highlight {
background-color: #6C757D;
border-color: #333;
}

+ 13
- 7
www/index.html View File

<div class="container d-none" id="autodoc_tab_upload"> <div class="container d-none" id="autodoc_tab_upload">
<h3>upload</h3> <h3>upload</h3>
<div class="row"> <div class="row">
<div class="col lead bg-secondary text-center autodoc_upload_zone">
<div class="col">

<div class="lead">Upload Zone</div> <div class="lead">Upload Zone</div>
<div>
Drag & Drop files (png, jpeg, pdf) into this zone to attach them to a single new document
</div>
<div>
Files can be uploaded at once or separately. A long as the page is not refreshed or the new document button
<div class="text-center autodoc_upload_zone">
Drag & Drop files (png, jpeg, pdf) into this zone to attach them to a single new document<br/>
Files can be uploaded at once or separately. A long as the page is not refreshed or the new document
button
is pushed, they will all be attached to the same document is pushed, they will all be attached to the same document
</div> </div>



</div>

<div class="col">
<div class="lead">Upload Status</div>
</div> </div>
</div>


</div>
</div> </div>


<!-- Tags --> <!-- Tags -->

+ 39
- 20
www/js/autodoc.js View File

} }
}; };


$(document).ready(function() {
$(document).ready(function () {

change_page(); change_page();
$(document).scroll(function() {
upload_zone_init();

$(document).scroll(function () {
page_home_scroll(); page_home_scroll();
}); });
$('#autodoc_upload_zone').change(function() {
console.log(this);
});
}); });


$(window).bind("hashchange", function() {
$(window).bind("hashchange", function () {
change_page(); change_page();
}); });


/* change menu highlights and content visibility */ /* change menu highlights and content visibility */
$("#autodoc_navbar") $("#autodoc_navbar")
.find("a") .find("a")
.each(function(id, obj) {
.each(function (id, obj) {
var curhash = $(obj) var curhash = $(obj)
.attr("href") .attr("href")
.substr(1); .substr(1);


$.getJSON( $.getJSON(
conf.openapi + conf.openapi +
"/documents?pageSize=" +
conf.home.width +
"&pageIndex=" +
conf.home.curpage,
"/documents?pageSize=" +
conf.home.width +
"&pageIndex=" +
conf.home.curpage,
null, null,
function(data, textStatus, jqXHR) {
function (data, textStatus, jqXHR) {
// last document was loaded, stop scrolling // last document was loaded, stop scrolling
if (data.length < conf.home.width) { if (data.length < conf.home.width) {
conf.home.end = 1; conf.home.end = 1;
} }
$.each(data, function(id, doc) {
$.each(data, function (id, doc) {
var col = $(tmpl) var col = $(tmpl)
.find(".autodoc_template_home_col") .find(".autodoc_template_home_col")
.clone(); .clone();
.attr( .attr(
"src", "src",
conf.openapi + conf.openapi +
"/documents/" +
doc.id +
"/image?maxWidth=" +
Math.floor(1000 / conf.home.width)
"/documents/" +
doc.id +
"/image?maxWidth=" +
Math.floor(1000 / conf.home.width)
); );


$(col) $(col)
.find(".autodoc_template_home_name") .find(".autodoc_template_home_name")
.html(doc.name); .html(doc.name);


$.each(doc.tags, function(id, tag) {
$.each(doc.tags, function (id, tag) {
$(col) $(col)
.find(".autodoc_template_home_tag") .find(".autodoc_template_home_tag")
.after( .after(
} }
} }


function file_upload() {
console.log(this.files);
function upload_zone_init() {
$('.autodoc_upload_zone').on('dragenter', upload_zone_highlight);
$('.autodoc_upload_zone').on('dragleave', upload_zone_normal);
$('.autodoc_upload_zone').on('drop', upload_zone_drop);
}

function upload_zone_highlight(e) {
$(e.target).addClass('autodoc_upload_zone_highlight');
}

function upload_zone_normal(e) {
$(e.target).removeClass('autodoc_upload_zone_highlight');
}

function upload_zone_drop(e) {

e.dataTransfer.effectAllowed = "none";
e.dataTransfer.dropEffect = "none";

console.log(e);
return true;
} }

Loading…
Cancel
Save