From ea28c2c55c689be25a2212dfbdffd840c88921aa Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 7 Feb 2011 05:10:11 +0000 Subject: Pulled elgg-icon and elgg-icon-* into the admin css. Pulled out profile field JS into elgg.admin obj. Fixed editing profile field names. git-svn-id: http://code.elgg.org/elgg/trunk@8061 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/profile/fields/add.php | 2 +- actions/profile/fields/edit.php | 20 ++++++ engine/lib/admin.php | 4 ++ .../admin/appearance/profile_fields/list.php | 78 ++++++---------------- views/default/css/admin.php | 69 +++++++++++++++++++ views/default/js/admin.php | 53 +++++++++++++++ 6 files changed, 167 insertions(+), 59 deletions(-) create mode 100644 actions/profile/fields/edit.php diff --git a/actions/profile/fields/add.php b/actions/profile/fields/add.php index 15bd7024a..b35df1549 100644 --- a/actions/profile/fields/add.php +++ b/actions/profile/fields/add.php @@ -20,7 +20,7 @@ if (!$fieldlist) { $id = max($fieldlistarray) + 1; } -if (($label) && ($type)){ +if (($label) && ($type)) { if (!empty($fieldlist)) { $fieldlist .= ','; } diff --git a/actions/profile/fields/edit.php b/actions/profile/fields/edit.php new file mode 100644 index 000000000..5fc84ff11 --- /dev/null +++ b/actions/profile/fields/edit.php @@ -0,0 +1,20 @@ + - - - -
- - + \ No newline at end of file diff --git a/views/default/css/admin.php b/views/default/css/admin.php index 9d1c5d23c..39fce2928 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -1120,3 +1120,72 @@ ul.admin_plugins { .elgg-col-5of6 { width: 83.33%; } + +/* *************************************** + Icons +*************************************** */ +.elgg-icon { + background: transparent url(_graphics/elgg_sprites.png) no-repeat left; + width: 16px; + height: 16px; + display: block; + float: left; + margin: 0 2px; +} +.elgg-icon-settings { + background-position: -302px -44px; +} +.elgg-icon-friends { + background-position: 0 -300px; + width: 36px; +} +.elgg-icon-friends:hover { + background-position: 0 -340px; +} +.elgg-icon-help { + background-position: -302px -136px; +} +.elgg-icon-delete { + background-position: -199px 1px; +} +.elgg-icon-delete:hover { + background-position: -199px -15px; +} +.elgg-icon-likes { + background-position: 0px -101px; + width: 20px; + height: 20px; +} +.elgg-icon-likes:hover { + background-position: 0px -131px; +} +.elgg-icon-liked { + background-position: 0px -131px; + width: 20px; + height: 20px; +} +.elgg-icon-arrow-s { + background-position: -146px -56px; +} +.elgg-icon-arrow-s:hover { + background-position: -146px -76px; +} +.elgg-icon-following { + background-position: -35px -100px; + width: 22px; + height: 20px; +} +.elgg-icon-rss { + background-position: -249px 1px; +} +.elgg-icon-hover-menu { + background-position: -150px 0; +} +.elgg-icon-hover-menu:hover { + background-position: -150px -32px; +} +.elgg-icon-dragger { + background-position: -302px -186px; + width: 21px; + height: 21px; +} \ No newline at end of file diff --git a/views/default/js/admin.php b/views/default/js/admin.php index 46e82c71b..ca690c876 100644 --- a/views/default/js/admin.php +++ b/views/default/js/admin.php @@ -13,6 +13,7 @@ elgg.admin.init = function () { elgg_slide_toggle($(this), '.plugin_details', '.manifest_file'); }); + // plugin screenshot modal $('.elgg-plugin-screenshot a').click(elgg.admin.displayPluginScreenshot); // draggable plugin reordering @@ -25,6 +26,22 @@ elgg.admin.init = function () { revert: 500, stop: elgg.admin.movePlugin }); + + // in-line editing for custom profile fields. + $(".elgg-state-editable").editable(elgg.admin.editProfileField, { + type: 'text', + onblur: 'submit', + width: '300px', + height: 'none', + style: 'display:inline;' + }); + + // draggable profile field reordering. + $('#sortable_profile_fields').sortable({ + items: 'li', + handle: 'span.elgg-state-draggable', + stop: elgg.admin.moveProfileField + }); } /** @@ -90,4 +107,40 @@ elgg.admin.displayPluginScreenshot = function(e) { lb.css('top', top_pos).css('left', left_pos).show(); }; +/** + * In-line editing for custom profile fields + * + * @param string value The new value + * @param {Object} settings The settings used for editable + * @return void + */ +elgg.admin.editProfileField = function(value, settings) { + var id = $(this).attr('id'); + id = id.replace('elgg-profile-field-', ''); + + var data = { + id: id, + label: value + }; + + elgg.action('profile/fields/edit', data); + return value; +} + +/** + * Save the plugin profile order after a move event. + * + * @param {Object} e Event object. + * @param {Object} ui jQueryUI object + * @return void + */ +elgg.admin.moveProfileField = function(e, ui) { + var orderArr = $('#sortable_profile_fields').sortable('toArray'); + var orderStr = orderArr.join(','); + + elgg.action('profile/fields/reorder', { + fieldorder: orderStr + }); +} + elgg.register_event_handler('init', 'system', elgg.admin.init); \ No newline at end of file -- cgit v1.2.3