From 85edbb08c1768237e005fea3a763deff2c859c29 Mon Sep 17 00:00:00 2001 From: Ramiro Aparicio Date: Mon, 21 Oct 2013 15:31:31 +0200 Subject: [PATCH] fix user displayName not being shown after add, added class for improved styling, fix strong for groups when english is not being used --- core/ajax/share.php | 7 ++++--- core/js/share.js | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/ajax/share.php b/core/ajax/share.php index dbad8f2e971..7dd89deb8e5 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -305,8 +305,9 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo && $uid != OC_User::getUser()) { $shareWith[] = array( 'label' => $displayName, - 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, - 'shareWith' => $uid) + 'value' => array( + 'shareType' => OCP\Share::SHARE_TYPE_USER, + 'shareWith' => $uid) ); $count++; } @@ -324,7 +325,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) { $shareWith[] = array( - 'label' => $group.' ('.$l->t('group').')', + 'label' => $group, 'value' => array( 'shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group diff --git a/core/js/share.js b/core/js/share.js index 6ec15f01c1e..5494f6ce2e3 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -293,7 +293,7 @@ OC.Share={ // Default permissions are Edit (CRUD) and Share var permissions = OC.PERMISSION_ALL; OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, function() { - OC.Share.addShareWith(shareType, shareWith, selected.item.value.shareWith, permissions, possiblePermissions); + OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions); $('#shareWith').val(''); OC.Share.updateIcon(itemType, itemSource); }); @@ -302,12 +302,14 @@ OC.Share={ }) // customize internal _renderItem function to display groups and users differently .data("ui-autocomplete")._renderItem = function( ul, item ) { - var insert = $( "" ).text( item.label ); - if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') { - // current label is group - wrap "strong" element - insert = insert.wrapInner(''); + var insert = $( "" ); + var text = (item.value.shareType == 1)? item.label + ' ('+t('core', 'group')+')' : item.label; + insert.text( text ); + if(item.value.shareType == 1) { + insert = insert.wrapInner(''); } return $( "
  • " ) + .addClass((item.value.shareType == 1)?'group':'user') .append( insert ) .appendTo( ul ); };