aboutsummaryrefslogtreecommitdiff
path: root/views/default/js/admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/js/admin.php')
-rw-r--r--views/default/js/admin.php101
1 files changed, 40 insertions, 61 deletions
diff --git a/views/default/js/admin.php b/views/default/js/admin.php
index 603d0f066..e8aa0d2ed 100644
--- a/views/default/js/admin.php
+++ b/views/default/js/admin.php
@@ -4,23 +4,24 @@
*
* @since 1.8
*/
+
+if (0) { ?><script><?php }
?>
elgg.provide('elgg.admin');
elgg.admin.init = function () {
- // display manifest info
- <?php //@todo Use elgg-toggler pattern ?>
- $('a.manifest_details.link').click(function() {
- elgg_slide_toggle($(this), '.elgg-plugin', '.manifest_file');
- });
- // plugin screenshot modal
- $('.elgg-plugin-screenshot a').click(elgg.admin.displayPluginScreenshot);
+ // system messages do not fade in admin area, instead slide up when clicked
+ $('.elgg-system-messages li').stop(true);
+ $('.elgg-system-messages li').die('click');
+ $('.elgg-system-messages li').live('click', function() {
+ $(this).stop().slideUp('medium');
+ });
// draggable plugin reordering
- $('#elgg-plugin-list').sortable({
- items: 'div.elgg-state-draggable',
- handle: 'h3.elgg-head',
+ $('#elgg-plugin-list > ul').sortable({
+ items: 'li:has(> .elgg-state-draggable)',
+ handle: '.elgg-head',
forcePlaceholderSize: true,
placeholder: 'elgg-widget-placeholder',
opacity: 0.8,
@@ -29,6 +30,7 @@ elgg.admin.init = function () {
});
// in-line editing for custom profile fields.
+ // @note this requires jquery.jeditable plugin
$(".elgg-state-editable").editable(elgg.admin.editProfileField, {
type: 'text',
onblur: 'submit',
@@ -38,12 +40,15 @@ 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
});
-}
+
+ // admin notices delete ajax
+ $('a.elgg-admin-notice').click(elgg.admin.deleteNotice);
+};
/**
* Save the plugin order after a move event.
@@ -53,9 +58,9 @@ elgg.admin.init = function () {
* @return void
*/
elgg.admin.movePlugin = function(e, ui) {
- // get guid from id like elgg-plugin-<guid>
- var pluginGuid = ui.item.closest('.elgg-plugin').attr('id');
- pluginGuid = pluginGuid.replace('elgg-plugin-', '');
+ // get guid from id like elgg-object-<guid>
+ var pluginGuid = ui.item.attr('id');
+ pluginGuid = pluginGuid.replace('elgg-object-', '');
elgg.action('admin/plugins/set_priority', {
data: {
@@ -67,48 +72,6 @@ elgg.admin.movePlugin = function(e, ui) {
};
/**
- * Display a plugin screenshot.
- *
- * @param {Object} e The event object.
- * @return void
- */
-elgg.admin.displayPluginScreenshot = function(e) {
- e.preventDefault();
- var lb = $('.elgg-plugin-screenshot-lightbox');
-
- if (lb.length < 1) {
- $('body').append('<div class="elgg-plugin-screenshot-lightbox"></div>');
- lb = $('.elgg-plugin-screenshot-lightbox');
-
- lb.click(function() {
- lb.hide();
- });
-
- $(document).click(function(e) {
- var target = $(e.target);
- if (target.is('a') && target.hasClass('elgg-plugin-screenshot-lightbox')) {
- lb.hide();
- e.preventDefault();
- }
- });
- }
-
- var html = '<img class="pas" src="' + $(this).attr('href') + '">';
- var desc = $(this).find('img').attr('alt');
-
- if (desc) {
- html = '<h2 class="pam">' + desc + '</h2>' + html;
- }
-
- lb.html(html);
-
- top_pos = $(window).scrollTop() + 10 + 'px';
- left_pos = $(window).scrollLeft() + 5 + 'px';
-
- lb.css('top', top_pos).css('left', left_pos).show();
-};
-
-/**
* In-line editing for custom profile fields
*
* @param string value The new value
@@ -126,7 +89,7 @@ elgg.admin.editProfileField = function(value, settings) {
elgg.action('profile/fields/edit', data);
return value;
-}
+};
/**
* Save the plugin profile order after a move event.
@@ -136,12 +99,28 @@ 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', {
fieldorder: orderStr
});
-}
+};
+
+/**
+ * Fires the ajax action to delete the admin notice then hides the notice.
+ *
+ * @return void
+ */
+elgg.admin.deleteNotice = function(e) {
+ e.preventDefault();
+ var $container = $(this).closest('p');
+
+ elgg.action($(this).attr('href'), {
+ success: function(json) {
+ $container.slideUp('medium');
+ }
+ });
+};
-elgg.register_event_handler('init', 'system', elgg.admin.init); \ No newline at end of file
+elgg.register_hook_handler('init', 'system', elgg.admin.init, 1000); \ No newline at end of file