angular-multi-select icon indicating copy to clipboard operation
angular-multi-select copied to clipboard

Format button label with CSS

Open fifonik opened this issue 10 years ago • 0 comments

I think it is a good idea to remove commas and nbsp; manipulations from js:

js:

  $scope.refreshButton = function() {
  ...
  if ( ctr < tempMaxLabels ) {
-     $scope.varButtonLabel += ( $scope.varButtonLabel.length > 0 ? '</div>, <div class="buttonLabel">' : '<div class="buttonLabel">') + $scope.writeLabel( value, 'buttonLabel' );
+     $scope.varButtonLabel += '<div class="buttonLabel">' + $scope.writeLabel( value, 'buttonLabel' ) + '</div>';
  }

  ...

  $scope.writeLabel = function( item, type ) {
  ...
  angular.forEach( temp, function( value, key ) {                    
-     item[ value ] && ( label += '&nbsp;' + value.split( '.' ).reduce( function( prev, current ) {
+     item[ value ] && ( label += value.split( '.' ).reduce( function( prev, current ) {
            return prev[ current ]; 

css:

/* labels on the button */
.multiSelect .buttonLabel {
    display: inline-block;
    padding: 5px 0px 5px 0px; 
}

+.multiSelect .buttonLabel + .buttonLabel:before {
+   content: ',\2009'; // &thinsp;
+}


/* item labels */
.multiSelect .multiSelectItem {
    display: block;
-    padding: 3px;
+    padding: 3px 3px 3px 8px;

Thanks.

fifonik avatar Oct 30 '15 01:10 fifonik