github.com/kotovmak/go-admin@v1.1.1/template/types/display/loading.go (about)

     1  package display
     2  
     3  import (
     4  	"html/template"
     5  
     6  	"github.com/kotovmak/go-admin/template/types"
     7  )
     8  
     9  type Loading struct {
    10  	types.BaseDisplayFnGenerator
    11  }
    12  
    13  func init() {
    14  	types.RegisterDisplayFnGenerator("loading", new(Loading))
    15  }
    16  
    17  func (l *Loading) Get(args ...interface{}) types.FieldFilterFn {
    18  	return func(value types.FieldModel) interface{} {
    19  		param := args[0].([]string)
    20  
    21  		for i := 0; i < len(param); i++ {
    22  			if value.Value == param[i] {
    23  				return template.HTML(`<i class="fa fa-refresh fa-spin text-primary"></i>`)
    24  			}
    25  		}
    26  
    27  		return value.Value
    28  	}
    29  }