diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-18 16:13:34 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-18 16:13:34 +0000 |
commit | c5854870424d87372bcc86a7edf75b9bf8841825 (patch) | |
tree | 99dc5d53e82ba6decf27846e574ac9826f5743b2 /js | |
parent | 522fccf9ed173e3a5a68b3a616a3b7e1961bc22b (diff) | |
download | elgg-c5854870424d87372bcc86a7edf75b9bf8841825.tar.gz elgg-c5854870424d87372bcc86a7edf75b9bf8841825.tar.bz2 |
Refs #1793 added ability to add widgets to layout through ajax
git-svn-id: http://code.elgg.org/elgg/trunk@7338 36083f99-b078-4883-b0ff-0f9b5a30f544
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");
|