aboutsummaryrefslogtreecommitdiff
path: root/views/default/js
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-07 05:10:11 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-07 05:10:11 +0000
commitea28c2c55c689be25a2212dfbdffd840c88921aa (patch)
treedf452e639f62dbf3994bcf81c5622bd82d79016b /views/default/js
parent59ae2874efb59aeb48265c16b785756025221fb8 (diff)
downloadelgg-ea28c2c55c689be25a2212dfbdffd840c88921aa.tar.gz
elgg-ea28c2c55c689be25a2212dfbdffd840c88921aa.tar.bz2
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
Diffstat (limited to 'views/default/js')
-rw-r--r--views/default/js/admin.php53
1 files changed, 53 insertions, 0 deletions
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