diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/lib/ui.widgets.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index f4fa4b256..b1e7b2a99 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -14,9 +14,26 @@ elgg.ui.widgets.init = function() { event.preventDefault();
});
-
+ $('.widgets_add a').bind('click', function(event) {
+ elgg.action('widgets/add', {
+ data: {
+ handler: $(this).attr('id'),
+ user: elgg.get_loggedin_userid(),
+ context: $("input[name='widget_context']").val()
+ },
+ success: function(json) {
+ elgg.ui.widgets.insert(json.output);
+ }
+ });
+ event.preventDefault();
+ });
};
+// insert a widget into the layout
+elgg.ui.widgets.insert = function(html) {
+ $('.widget_first_col').prepend(html);
+}
+
//List active widgets for each page column
elgg.ui.widgets.outputList = function(forElement) {
return $("input[name='handler'], input[name='guid']", forElement).makeDelimitedList("value");
|