Create new document. Ref #34

pull/1/head
Victor Dubiniuk 11 years ago
parent 6c05c370a6
commit d64f046e06

File diff suppressed because one or more lines are too long

@ -12,6 +12,11 @@
/**
* Document routes
*/
$this->create('documents_documents_create', 'ajax/documents/create')
->post()
->action('\OCA\Documents\DocumentController', 'create')
;
$this->create('documents_genesis', 'ajax/genesis/{es_id}')
->post()
->action('\OCA\Documents\DocumentController', 'serve')

@ -113,6 +113,15 @@ var documentsMain = {
documentsMain.initSession
);
},
onCreate: function(event){
event.preventDefault();
$.post(
OC.Router.generate('documents_documents_create'),
{},
documentsMain.show
);
},
/**
* FIXME
*
@ -186,6 +195,12 @@ var documentsMain = {
hideOverlay : function(){
$('#documents-overlay,#documents-overlay-below').fadeOut('slow');
},
show: function(){
jQuery.when(documentsMain.loadDocuments())
.then(function(){
documentsMain.renderDocuments();
});
},
loadDocuments: function () {
var self = this;
var def = new $.Deferred();
@ -242,7 +257,7 @@ var documentsMain = {
$(document).ready(function() {
"use strict";
$('.documentslist').on('click', 'li', function(event) {
$('.documentslist').on('click', 'li:not(.add-document)', function(event) {
event.preventDefault();
if (documentsMain.isEditorMode){
return;
@ -265,6 +280,8 @@ $(document).ready(function() {
$(this).remove();
});
$('.add-document').on('click', '.add', documentsMain.onCreate);
$('#inivite-input').autocomplete({
minLength: 1,
source: function(search, response) {
@ -296,10 +313,7 @@ $(document).ready(function() {
}
});
jQuery.when(documentsMain.loadDocuments())
.then(function(){
documentsMain.renderDocuments();
});
documentsMain.show();
//TODO show "no docs, please upload"
//TODO when ending a session as the last user close session?

@ -11,9 +11,9 @@
<div id="documents-content">
<ul class="documentslist">
<li class="add-document">
<!-- <a class="add svg" target="_blank" href="">
<a class="add svg" target="_blank" href="">
<label><?php p('Add') ?></label>
</a> -->
</a>
<a class="upload svg" target="_blank" href="">
<label><?php p('Upload') ?></label>
</a>

Loading…
Cancel
Save