File diff suppressed because one or more lines are too long
@@ -11,6 +11,8 @@ MaterioFlag = function(){
|
||||
function init(){
|
||||
trace('init MaterioFlag');
|
||||
$(document).bind('flagGlobalAfterLinkUpdate', onFlaging);
|
||||
$(document).bind('resultscompleted', onResultsUpdated);
|
||||
ajaxifyLinks();
|
||||
};
|
||||
|
||||
function onFlaging(event){
|
||||
@@ -37,6 +39,60 @@ MaterioFlag = function(){
|
||||
|
||||
};
|
||||
|
||||
function onResultsUpdated(event){
|
||||
trace('onResultsUpdated', event);
|
||||
|
||||
ajaxifyLinks(event.container);
|
||||
};
|
||||
|
||||
function ajaxifyLinks(cont){
|
||||
trace('ajaxifyLinks');
|
||||
var container = cont || 'body';
|
||||
$('a.flag-lists-create:not(.ajax)', container)
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax');
|
||||
|
||||
};
|
||||
|
||||
function onClickCreatLink(event){
|
||||
event.preventDefault();
|
||||
var $link = $(event.currentTarget);
|
||||
var type = $link.attr('href').match(/[^\/]*$/);
|
||||
// trace('type', type);
|
||||
var url = 'materioflag/createlist/form/'+type[0];
|
||||
|
||||
$.getJSON(url, function(json){
|
||||
trace('json', json);
|
||||
showCreateListForm(json);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function showCreateListForm(json){
|
||||
var $modal = $('<div id="modal"/>').appendTo('body');
|
||||
$modal
|
||||
.css({
|
||||
position:'absolute',
|
||||
top:'40%', left:'50%',
|
||||
marginLeft:'-200px', width:'400px',
|
||||
zIndex:"99999"
|
||||
})
|
||||
.append(json.return);
|
||||
// .find('#flag-lists-form').bind('submit', function(event) {
|
||||
// trace('submit',event);
|
||||
// var title = $(this).find('input[name*="title"]').val();
|
||||
// createList(title);
|
||||
// return false;
|
||||
// });
|
||||
};
|
||||
|
||||
function createList(title){
|
||||
var url = 'materioflag/createlist/'+title;
|
||||
$.getJSON(url, function(json){
|
||||
trace('json', json);
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user