]> source.dussan.org Git - nextcloud-server.git/commitdiff
share autocomplete - improve group appearance
authorMorris Jobke <morris.jobke@gmail.com>
Thu, 21 Mar 2013 21:41:44 +0000 (22:41 +0100)
committerMorris Jobke <morris.jobke@gmail.com>
Thu, 21 Mar 2013 21:45:36 +0000 (22:45 +0100)
highlight groups with markup (bold font) instead of "(group)" postfix

ref owncloud/core#173

core/js/share.js

index 8e767663f1285ca34e4bc63308b1905ed557ad87..36b5f6bdd7a5725f62a2a8865499185310914307 100644 (file)
@@ -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 $( "<li>" )
+                                       .append( $( "<a" + insert + ">" ).text( item.label ) )
+                                       .appendTo( ul );
+                       };
                } else {
                        html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Resharing is not allowed')+'" style="width:90%;" disabled="disabled"/>';
                        html += '</div>';