Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some more stuffs

  • Loading branch information...
commit c72a92ccfc87ae01a357467a5521567722671061 1 parent 58f27a0
t8g authored
View
5 app.js
@@ -227,8 +227,9 @@ app.put('/documents/:id', function(req, res) {
// @TODO upload pj + regeneration thumb (option)
// @TODO upload thumb
-
- doc.set(req.body);
+console.log(req.body);
+ //doc.set(req.body);
+doc.created_at = new Date();
doc.save(function(err) {
res.respond(err || doc, err ? 500 : 200);
});
View
4 models.js
@@ -98,6 +98,7 @@ function define(mongoose, fn) {
type: Date,
default: Date.now,
set: function(v) {
+console.log('created at');
if (!this.created_at) return Date.now();
return this.created_at;
}
@@ -109,6 +110,9 @@ function define(mongoose, fn) {
'_keywords': [String]
})
.pre('save', function(next) { // A tester
+
+console.log('pre save');
+
if (!this.created_at) {
this.created_at = this.updated_at = new Date;
} else {
View
19 public/js/dir-selector.js
@@ -27,13 +27,17 @@
$.get('/tags', { subdirsof: dir || '/'}, function(data) {
var ul = li.find('ul');
+
+ // ajoute {label:''} au début de data
+ data.unshift({label: dir || '/'});
data.forEach(function(item) {
- //ul.append()
if (fulldirname !== item.label)
- ul.append($('<li><a href="#' + item.label + '">' + item.label.replace(dir, '') + '</a></li>')).find('a').on('click', function(ev) {
+ ul.append($('<li><a href="#' + item.label + '">' + (item.label.replace(dir, '') || '---') + '</a></li>')).find('a').on('click', function(ev) {
ev.preventDefault();
plugin.el.empty();
- addSelect(this.hash.substr(1));
+ var newdir = this.hash.substr(1);
+ if (plugin.settings.input) plugin.settings.input.val(newdir);
+ addSelect(newdir);
});
});
});
@@ -43,11 +47,10 @@
if (dir.length) addSelect(dirs.join('/'), '/' + dirname);
}
-/*
- plugin.foo_public_method = function() {
- // code goes here
- }
-*/
+ // plugin.foo_public_method = function() {
+ // // code goes here
+ // }
+
init();
}
View
39 public/js/main.js
@@ -372,41 +372,12 @@ $(function() {
});
$documentEditContent.html(render);
- var myplugin = new $.dirSelector($documentEditContent.find('ul.dir_select'), {
- dir: '/rep1/rep1_1'
- });
+ // dir selector
+ var myplugin = new $.dirSelector($documentEditContent.find('ul.dir_select'), {
+ dir: '/rep1/rep1_1',
+ input: $documentEditContent.find('#repertoire')
+ });
-//$documentEditContent.find('.dir_select').dirSelector();
-//console.log($documentEditContent.find('.dir_select'));
-/*
- <li class="dropdown" data-dropdown="dropdown" >\
- <a href="#" class="dropdown-toggle">Dropdown</a>\
- <ul class="dropdown-menu">\
- <li><a href="#">Secondary link</a></li>\
- <li><a href="#">Something else here</a></li>\
- <li class="divider"></li>\
- <li><a href="#">Another link</a></li>\
- </ul>\
- </li>\
- <li class="dropdown" data-dropdown="dropdown" >\
- <a href="#" class="dropdown-toggle">Dropdown</a>\
- <ul class="dropdown-menu">\
- <li><a href="#">Secondary link</a></li>\
- <li><a href="#">Something else here</a></li>\
- <li class="divider"></li>\
- <li><a href="#">Another link</a></li>\
- </ul>\
- </li>\
- <li class="dropdown" data-dropdown="dropdown" >\
- <a href="#" class="dropdown-toggle">Dropdown</a>\
- <ul class="dropdown-menu">\
- <li><a href="#">Secondary link</a></li>\
- <li><a href="#">Something else here</a></li>\
- <li class="divider"></li>\
- <li><a href="#">Another link</a></li>\
- </ul>\
- </li>\
-*/
$documentEditContent.find('button.delete').on('click', function(e) {
e.preventDefault();
Please sign in to comment.
Something went wrong with that request. Please try again.