From a1a6ef940906b93364e682621f095bfbc10ff041 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 21 Mar 2013 22:41:44 +0100 Subject: [PATCH 1/3] share autocomplete - improve group appearance highlight groups with markup (bold font) instead of "(group)" postfix ref owncloud/core#173 --- core/js/share.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/js/share.js b/core/js/share.js index 8e767663f12..36b5f6bdd7a 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -235,7 +235,19 @@ OC.Share={ }); return false; } - }); + }) + // customize internal _renderItem function to display groups and users differently + .data("ui-autocomplete")._renderItem = function( ul, item ) { + var insert = ''; + if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') { + // current label is group + insert = ' style="font-weight:bold;"'; + item.label = item.label.substring(0, item.label.length-8) + } + return $( "
  • " ) + .append( $( "" ).text( item.label ) ) + .appendTo( ul ); + }; } else { html += ''; html += ''; From 8871629db577395e1f9d018ba1b62b5be8114620 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 21 Mar 2013 23:19:59 +0100 Subject: [PATCH 2/3] replace hardcoded css style with css class - ref owncloud/core#173 --- core/css/share.css | 4 ++++ core/js/share.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/css/share.css b/core/css/share.css index 2d6849b4bb1..c97f27c2816 100644 --- a/core/css/share.css +++ b/core/css/share.css @@ -97,3 +97,7 @@ overflow-y:auto; overflow-x:hidden; } + +.ui-menu-item a.ocGroup { + font-weight: bold; +} diff --git a/core/js/share.js b/core/js/share.js index 36b5f6bdd7a..ca9c8f04eae 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -241,7 +241,8 @@ OC.Share={ var insert = ''; if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') { // current label is group - insert = ' style="font-weight:bold;"'; + insert = ' class="ocGroup"'; // attribute to insert + // remove "(group)" item.label = item.label.substring(0, item.label.length-8) } return $( "
  • " ) From 79d99b9c967b4f8880b1ad76b2b5d72805fea907 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 22 Mar 2013 09:59:19 +0100 Subject: [PATCH 3/3] use simple markup to highlight groups in share autocomplete --- core/css/share.css | 4 ---- core/js/share.js | 10 ++++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/core/css/share.css b/core/css/share.css index c97f27c2816..2d6849b4bb1 100644 --- a/core/css/share.css +++ b/core/css/share.css @@ -97,7 +97,3 @@ overflow-y:auto; overflow-x:hidden; } - -.ui-menu-item a.ocGroup { - font-weight: bold; -} diff --git a/core/js/share.js b/core/js/share.js index ca9c8f04eae..73eb686abb0 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -238,15 +238,13 @@ OC.Share={ }) // customize internal _renderItem function to display groups and users differently .data("ui-autocomplete")._renderItem = function( ul, item ) { - var insert = ''; + var insert = $( "" ).text( item.label ); if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') { - // current label is group - insert = ' class="ocGroup"'; // attribute to insert - // remove "(group)" - item.label = item.label.substring(0, item.label.length-8) + // current label is group - wrap "strong" element + insert = insert.wrapInner(''); } return $( "
  • " ) - .append( $( "" ).text( item.label ) ) + .append( insert ) .appendTo( ul ); }; } else {