aboutsummaryrefslogtreecommitdiff
path: root/views/default/js
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/js')
-rw-r--r--views/default/js/admin.php4
-rw-r--r--views/default/js/elgg.php6
-rw-r--r--views/default/js/initialize_elgg.php1
-rw-r--r--views/default/js/walled_garden.php40
4 files changed, 47 insertions, 4 deletions
diff --git a/views/default/js/admin.php b/views/default/js/admin.php
index 253a73887..d4dd06822 100644
--- a/views/default/js/admin.php
+++ b/views/default/js/admin.php
@@ -42,7 +42,7 @@ elgg.admin.init = function () {
});
// draggable profile field reordering.
- $('#sortable_profile_fields').sortable({
+ $('#elgg-profile-fields').sortable({
items: 'li',
handle: 'span.elgg-state-draggable',
stop: elgg.admin.moveProfileField
@@ -143,7 +143,7 @@ elgg.admin.editProfileField = function(value, settings) {
* @return void
*/
elgg.admin.moveProfileField = function(e, ui) {
- var orderArr = $('#sortable_profile_fields').sortable('toArray');
+ var orderArr = $('#elgg-profile-fields').sortable('toArray');
var orderStr = orderArr.join(',');
elgg.action('profile/fields/reorder', {
diff --git a/views/default/js/elgg.php b/views/default/js/elgg.php
index 76388f80c..133e128a4 100644
--- a/views/default/js/elgg.php
+++ b/views/default/js/elgg.php
@@ -56,11 +56,13 @@ elgg.version = '<?php echo get_version(); ?>';
elgg.release = '<?php echo get_version(true); ?>';
elgg.config.wwwroot = '<?php echo elgg_get_site_url(); ?>';
elgg.security.interval = 5 * 60 * 1000; <?php //@todo make this configurable ?>
+elgg.config.domReady = false;
+elgg.config.languageReady = false;
//After the DOM is ready
$(function() {
- elgg.trigger_hook('init', 'system');
- elgg.trigger_hook('ready', 'system');
+ elgg.config.domReady = true;
+ elgg.initWhenReady();
});
<?php
diff --git a/views/default/js/initialize_elgg.php b/views/default/js/initialize_elgg.php
index 09e0b27bc..f8234f84f 100644
--- a/views/default/js/initialize_elgg.php
+++ b/views/default/js/initialize_elgg.php
@@ -41,6 +41,7 @@ if ($user instanceof ElggUser) {
$user_json['subtype'] = $user->getSubtype();
$user_json['url'] = $user->getURL();
+ $user_json['admin'] = $user->isAdmin();
echo 'elgg.session.user = new elgg.ElggUser(' . json_encode($user_json) . ');';
}
diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php
new file mode 100644
index 000000000..46c2934ff
--- /dev/null
+++ b/views/default/js/walled_garden.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Walled garden JavaScript
+ *
+ * @todo update for new JS lib
+ */
+
+$cancel_button = elgg_view('input/button', array(
+ 'value' => elgg_echo('cancel'),
+ 'class' => 'elgg-button-cancel mlm',
+));
+$cancel_button = trim($cancel_button);
+
+?>
+
+$(document).ready(function() {
+
+ // add cancel button to inline forms
+ $(".elgg-walledgarden-password").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
+ $('.elgg-walledgarden-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
+
+ $(".forgot_link").click(function(event) {
+ event.preventDefault();
+ $(".elgg-walledgarden-password").fadeToggle();
+ });
+
+ $(".registration_link").click(function(event) {
+ event.preventDefault();
+ $(".elgg-walledgarden-register").fadeToggle();
+ });
+
+ $('input.elgg-button-cancel').click(function(event) {
+ if ($(".elgg-walledgarden-password").is(':visible')) {
+ $(".forgot_link").click();
+ } else if ($('.elgg-walledgarden-register').is(':visible')) {
+ $(".registration_link").click();
+ }
+ event.preventDefault();
+ });
+}); \ No newline at end of file