aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views/default/js
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-12-17 10:37:25 -0500
committerCash Costello <cash.costello@gmail.com>2011-12-17 10:37:25 -0500
commit3d8ca76d4b8b9e69a92f5f5b034609b410c9ee8c (patch)
tree0b8f597061fd63d52b8c37139c8c0340ea018609 /mod/embed/views/default/js
parentc529671a522dea0dcfc280815092ee1f5127b92b (diff)
downloadelgg-3d8ca76d4b8b9e69a92f5f5b034609b410c9ee8c.tar.gz
elgg-3d8ca76d4b8b9e69a92f5f5b034609b410c9ee8c.tar.bz2
Fixes #4086 handling containers for embed uploading
Diffstat (limited to 'mod/embed/views/default/js')
-rw-r--r--mod/embed/views/default/js/embed/embed.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php
index 54b9c391d..5fd534a09 100644
--- a/mod/embed/views/default/js/embed/embed.php
+++ b/mod/embed/views/default/js/embed/embed.php
@@ -80,9 +80,13 @@ elgg.embed.submit = function(event) {
if (response.status >= 0) {
var forward = $('input[name=embed_forward]').val();
var url = elgg.normalize_url('embed/tab/' + forward);
+ url = elgg.embed.addContainerGUID(url);
$('.embed-wrapper').parent().load(url);
}
}
+ },
+ error: function(xhr, status) {
+ // nothing for now
}
});
@@ -98,8 +102,27 @@ elgg.embed.submit = function(event) {
* @return void
*/
elgg.embed.forward = function(event) {
- $('.embed-wrapper').parent().load($(this).attr('href'));
+ // make sure container guid is passed
+ var url = $(this).attr('href');
+ url = elgg.embed.addContainerGUID(url);
+
+ $('.embed-wrapper').parent().load(url);
event.preventDefault();
};
+/**
+ * Adds the container guid to a URL
+ *
+ * @param {string} url
+ * @return string
+ */
+elgg.embed.addContainerGUID = function(url) {
+ if (url.indexOf('container_guid=') == -1) {
+ var guid = $('input[name=embed_container_guid]').val();
+ return url + '?container_guid=' + guid;
+ } else {
+ return url;
+ }
+};
+
elgg.register_hook_handler('init', 'system', elgg.embed.init);