Elgg  Version 3.0
Functions
add_panel.js File Reference

Go to the source code of this file.

Functions

 define (['jquery', 'elgg/Ajax'], function($, Ajax){var ajax=new Ajax();var add=function(event){var $item=$(this).closest('li');if(!$item.is('.elgg-widget-multiple')){$item.toggleClass('elgg-state-unavailable elgg-state-available');}ajax.path($(this).attr('href')).done(function(output){$('#elgg-widget-col-1').prepend(output);});event.preventDefault();};$(document).on('click', '.elgg-widgets-add-panel.elgg-widgets-add-actions.elgg-button-submit', add);})
 

Function Documentation

define ( function($, Ajax){var ajax=new Ajax();var add=function(event){var $item=$(this).closest('li');if(!$item.is('.elgg-widget-multiple')){$item.toggleClass('elgg-state-unavailable elgg-state-available');}ajax.path($(this).attr('href')).done(function(output){$('#elgg-widget-col-1').prepend(output);});event.preventDefault();};$(document).on('click', '.elgg-widgets-add-panel.elgg-widgets-add-actions.elgg-button-submit', add);}  )
Parameters
function($,Ajax){varajax=new Ajax();var add=function(event){var $item=.closest('li');if(!$item.is('.elgg-widget-multiple')){$item.toggleClass('elgg-state-unavailable elgg-state-available');}ajax.path(.attr('href')).done(function(output){$('elgg-widget-col-1').prepend(output);});event.preventDefault();};.on('click', '.elgg-widgets-add-panel.elgg-widgets-add-actions.elgg-button-submit', add);} Adds a new widget

Makes Ajax call to add new widget and inserts the widget html

Parameters
{Object}event
Returns
void