personal-notes display for card medium and cardfull is ok
This commit is contained in:
@@ -76,7 +76,7 @@ MaterioPersonalNotes = function(){
|
||||
if(json.new_note_nid){
|
||||
updateNoteLink($link, json.new_note_nid);
|
||||
}
|
||||
showNoteForm(json);
|
||||
showNoteForm($link, json);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
@@ -87,7 +87,7 @@ MaterioPersonalNotes = function(){
|
||||
$link.attr('href', Drupal.settings.pathPrefix+'node/'+new_note_nid+'/edit');
|
||||
};
|
||||
|
||||
function showNoteForm(json){
|
||||
function showNoteForm($link, json){
|
||||
trace('MaterioPersonalNotes :: showNoteForm');
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
@@ -96,32 +96,64 @@ MaterioPersonalNotes = function(){
|
||||
action: 'show create form'
|
||||
});
|
||||
|
||||
var $modal = $('<div id="modal" class="modal note-modal"/>').appendTo('body');
|
||||
$modal
|
||||
.css({
|
||||
position:'absolute',
|
||||
top:'40%', left:'50%',
|
||||
marginLeft:'-150px', width:'500px',
|
||||
zIndex:"99999"
|
||||
})
|
||||
.append($('<div class="close"></i><div>')
|
||||
.bind('click', function(){
|
||||
trace('close note');
|
||||
$(this).parents('#modal').remove();
|
||||
})
|
||||
);
|
||||
$modal
|
||||
.append(json.rendered_form)
|
||||
var $card = $link.parents('.node-materiau');
|
||||
|
||||
if($card.is('.vm-cardmedium') || $card.is('.vm-cardbig')){
|
||||
var $note = $('<div class="note-wrapper"/>')
|
||||
.append($('<div class="close"></i><div>')
|
||||
.bind('click', function(){
|
||||
trace('close note');
|
||||
$(this).parents('.node-materiau').removeClass('note-opened');
|
||||
setTimeout((function(that){
|
||||
$(that).parents('.note-wrapper').remove();
|
||||
})(this), 300);
|
||||
})
|
||||
);
|
||||
$note
|
||||
.append(json.rendered_form)
|
||||
.find('textarea')
|
||||
.focus()
|
||||
.bind('change keyup paste', function(event){
|
||||
// trace('text changed', $(this).val());
|
||||
var note_nid = $(this).parents('form').find('input[name="note_nid"]').val();
|
||||
saveNote($(this).val(), note_nid);
|
||||
});
|
||||
$note
|
||||
.find('input[type="submit"], .homepage-textfield').hide();
|
||||
$note
|
||||
.appendTo($card.addClass('note-opened'));
|
||||
$note
|
||||
.find('textarea')
|
||||
.focus()
|
||||
.bind('change keyup paste', function(event){
|
||||
// trace('text changed', $(this).val());
|
||||
var note_nid = $(this).parents('form').find('input[name="note_nid"]').val();
|
||||
saveNote($(this).val(), note_nid);
|
||||
});
|
||||
$modal
|
||||
.find('input[type="submit"], .homepage-textfield').hide();
|
||||
// TODO: esc keypressed close the form
|
||||
.focus();
|
||||
}else{
|
||||
|
||||
// var $note = $('<div id="modal" class="modal note-modal"/>').appendTo('body');
|
||||
// $note
|
||||
// .css({
|
||||
// position:'absolute',
|
||||
// top:'40%', left:'50%',
|
||||
// marginLeft:'-150px', width:'500px',
|
||||
// zIndex:"99999"
|
||||
// })
|
||||
// .append($('<div class="close"></i><div>')
|
||||
// .bind('click', function(){
|
||||
// trace('close note');
|
||||
// $(this).parents('#modal').remove();
|
||||
// })
|
||||
// );
|
||||
// $note
|
||||
// .append(json.rendered_form)
|
||||
// .find('textarea')
|
||||
// .focus()
|
||||
// .bind('change keyup paste', function(event){
|
||||
// // trace('text changed', $(this).val());
|
||||
// var note_nid = $(this).parents('form').find('input[name="note_nid"]').val();
|
||||
// saveNote($(this).val(), note_nid);
|
||||
// });
|
||||
// $note
|
||||
// .find('input[type="submit"], .homepage-textfield').hide();
|
||||
// // TODO: esc keypressed close the form
|
||||
}
|
||||
};
|
||||
|
||||
function saveNote(text, note_nid){
|
||||
@@ -133,7 +165,6 @@ MaterioPersonalNotes = function(){
|
||||
|
||||
$.post(url, {'content':text}, function(data, status){
|
||||
trace('MaterioPersonalNotes :: save : status', status);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user