aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/admin/appearance/profile_fields/list.php78
-rw-r--r--views/default/css/admin.php69
-rw-r--r--views/default/js/admin.php53
3 files changed, 142 insertions, 58 deletions
diff --git a/views/default/admin/appearance/profile_fields/list.php b/views/default/admin/appearance/profile_fields/list.php
index d14452f47..0b27da3ed 100644
--- a/views/default/admin/appearance/profile_fields/list.php
+++ b/views/default/admin/appearance/profile_fields/list.php
@@ -1,5 +1,7 @@
<?php
-
+/**
+ * Profile fields.
+ */
// List form elements
$n = 0;
@@ -19,70 +21,30 @@ if ($fieldlist = elgg_get_config('profile_custom_fields')) {
}
}
?>
-
-<script language="javascript" type="text/javascript" src="<?php echo elgg_get_site_url()?>vendors/jquery/jquery.jeditable.mini.js"></script>
-<script language="javascript" type="text/javascript">
-var reorderURL = '<?php echo elgg_add_action_tokens_to_url(elgg_get_site_url() . 'action/profile/fields/reorder', FALSE); ?>';
-function sortCallback(event, ui) {
- var orderArr = $('#sortable_profile_fields').sortable('toArray');
- var orderStr = orderArr.join(',');
- jQuery.post(reorderURL, {'fieldorder': orderStr});
-}
-
-$(document).ready(function() {
- $('#sortable_profile_fields').sortable({
- items: 'li',
- handle: '.handle',
- stop: sortCallback
- });
-});
-
-</script>
-
<div id="list">
<ul id="sortable_profile_fields">
<?php
- $save = elgg_echo('save');
- $cancel = elgg_echo('cancel');
- $edit_url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/profile/editdefault/editfield", FALSE);
-
- foreach($items as $item) {
- echo <<< END
-
-<script language="javascript" type="text/javascript">
-
- $(function() {
- $(".{$item->shortname}_editable").editable("$edit_url ", {
- type : 'text',
- submitdata: { _method: "post", 'field': '{$item->shortname}' },
- onblur: 'submit',
- width:'300px',
- height:'none',
- style:'display:inline;',
- tooltip:'Click to edit label'
- });
- });
-
-</script>
-
-END;
-
- echo elgg_view("profile/", array('value' => $item->translation));
-
- //$even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
- $url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/profile/fields/delete?id={$item->shortname}");
- echo "<li id=\"{$item->shortname}\"><div class='delete-button'><a href=\"$url\">" . elgg_echo('delete') . "</a></div>";
- echo "<img width='16' height='16' class='handle' alt='move' title='Drag here to reorder this item' src='".elgg_get_site_url()."mod/profile/graphics/drag-handle.png'/>";
- echo "<b class=\"profile_field_editable\"><span class=\"{$item->shortname}_editable\">$item->translation</span></b>: [".elgg_echo($item->type)."]";
- echo "</li>";
-
- }
+$save = elgg_echo('save');
+$cancel = elgg_echo('cancel');
+
+foreach ($items as $item) {
+ echo elgg_view("profile/", array('value' => $item->translation));
+
+ //$even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ $url = elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/profile/fields/delete?id={$item->shortname}");
+ $type = elgg_echo($item->type);
+ echo <<<HTML
+<li id="$item->shortname" class="clearfix"><span class="elgg-icon elgg-icon-dragger elgg-state-draggable"></span>
+<b><span id="elgg-profile-field-{$item->shortname}" class="elgg-state-editable">$item->translation</span></b> [$type]
+<a href="$url"><span class="elgg-icon elgg-icon-delete"></a></span>
+</li>
+HTML;
+}
?>
</ul>
</div>
<div id="tempList"></div>
-<input name="sortableListOrder" type="hidden" id="sortableListOrder" value="<?php echo $fieldlist; ?>" />
-
+<input name="sortableListOrder" type="hidden" id="sortableListOrder" value="<?php echo $fieldlist; ?>" /> \ 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(<?php echo elgg_get_site_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