diff options
author | Sem <sembrestels@riseup.net> | 2011-12-31 20:14:45 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2011-12-31 20:14:45 +0100 |
commit | 9f4da6d87f2c520b975f968cedbcde4f3dce1a25 (patch) | |
tree | fee953cf498b6083faf56c61042d3bee07110331 /js | |
parent | a22660e997611fe2afb97689ea23774578ee80db (diff) | |
parent | e49df853b2cc3a6a9bc2dd527a64951050142eb9 (diff) | |
download | elgg-9f4da6d87f2c520b975f968cedbcde4f3dce1a25.tar.gz elgg-9f4da6d87f2c520b975f968cedbcde4f3dce1a25.tar.bz2 |
Merge git://github.com/Elgg/Elgg
Diffstat (limited to 'js')
-rw-r--r-- | js/lib/languages.js | 26 | ||||
-rw-r--r-- | js/lib/pageowner.js | 8 | ||||
-rw-r--r-- | js/lib/ui.userpicker.js | 2 | ||||
-rw-r--r-- | js/lib/ui.widgets.js | 14 |
4 files changed, 27 insertions, 23 deletions
diff --git a/js/lib/languages.js b/js/lib/languages.js index ae7ba63e2..bfa858364 100644 --- a/js/lib/languages.js +++ b/js/lib/languages.js @@ -26,16 +26,22 @@ elgg.add_translation = function(lang, translations) { elgg.reload_all_translations = function(language) { var lang = language || elgg.get_language(); - elgg.getJSON('ajax/view/js/languages', { - data: { - language: lang - }, - success: function(json) { - elgg.add_translation(lang, json); - elgg.config.languageReady = true; - elgg.initWhenReady(); - } - }); + var url, options; + if (elgg.config.simplecache_enabled) { + url = 'cache/js/default/languages/' + lang + '.' + elgg.config.lastcache + '.js'; + options = {}; + } else { + url = 'ajax/view/js/languages'; + options = {data: {language: lang}}; + } + + options['success'] = function(json) { + elgg.add_translation(lang, json); + elgg.config.languageReady = true; + elgg.initWhenReady(); + }; + + elgg.getJSON(url, options); }; /** diff --git a/js/lib/pageowner.js b/js/lib/pageowner.js index 825898416..c695c41c3 100644 --- a/js/lib/pageowner.js +++ b/js/lib/pageowner.js @@ -6,9 +6,13 @@ */ /** - * @return {number} The GUID of the logged in user + * @return {number} The GUID of the page owner entity or 0 for no owner */ elgg.get_page_owner_guid = function() { - return elgg.page_owner.guid || 0; + if (elgg.page_owner !== undefined) { + return elgg.page_owner.guid; + } else { + return 0; + } }; diff --git a/js/lib/ui.userpicker.js b/js/lib/ui.userpicker.js index 8287ba91c..7298da114 100644 --- a/js/lib/ui.userpicker.js +++ b/js/lib/ui.userpicker.js @@ -93,7 +93,7 @@ elgg.userpicker.viewUser = function(info) { html += "<div class='elgg-image'>" + info.icon + "</div>"; html += "<div class='elgg-image-alt'>" + deleteLink + "</div>"; html += "<div class='elgg-body'>" + info.name + "</div>"; - html += "</div"; + html += "</div>"; return html; }; diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index 6435d2147..47e43c876 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -107,7 +107,7 @@ elgg.ui.widgets.move = function(event, ui) { * @return void */ elgg.ui.widgets.remove = function(event) { - var $widget = $(this).parent().parent(); + var $widget = $(this).closest('.elgg-module-widget'); // if widget type is single instance type, enable the add buton var type = $widget.attr('class'); @@ -124,15 +124,9 @@ elgg.ui.widgets.remove = function(event) { $widget.remove(); - // elgg-widget-delete-button-<guid> - var id = $(this).attr('id'); - id = id.substr(id.indexOf('elgg-widget-delete-button-') + "elgg-widget-delete-button-".length); + // delete the widget through ajax + elgg.action($(this).attr('href')); - elgg.action('widgets/delete', { - data: { - widget_guid: id - } - }); event.preventDefault(); }; @@ -196,7 +190,7 @@ elgg.ui.widgets.equalHeight = function(selector) { maxHeight = $(this).height(); } }) - $(selector).css('min-height', maxHeight); + $(selector).css('min-height', maxHeight + 'px'); }; elgg.register_hook_handler('init', 'system', elgg.ui.widgets.init); |