Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress bar widget #23

Open
sergeyglazyrindev opened this issue Jan 9, 2022 · 0 comments
Open

Progress bar widget #23

sergeyglazyrindev opened this issue Jan 9, 2022 · 0 comments
Labels

Comments

@sergeyglazyrindev
Copy link
Owner

We should add progress bar widget as it is exists in the old uadmin implementation.
An example of its configuration:

get_schema_test.go:                     // P1           int     `uadmin:"progress_bar"`
get_schema_test.go:                     // P2           float64 `uadmin:"progress_bar"`
get_schema_test.go:                     // P3           float64 `uadmin:"progress_bar:1.0"`
get_schema_test.go:                     // P4           float64 `uadmin:"progress_bar:1.0:red"`
get_schema_test.go:                     // P5           float64 `uadmin:"progress_bar:1.0:#f00"`
get_schema_test.go:                     // P6           float64 `uadmin:"progress_bar:0.3:red,0.7:yellow,1.0:lime"`
server_test.go: P1           int     `uadmin:"progress_bar"`
server_test.go: P2           float64 `uadmin:"progress_bar"`
server_test.go: P3           float64 `uadmin:"progress_bar:1.0"`
server_test.go: P4           float64 `uadmin:"progress_bar:1.0:red"`
server_test.go: P5           float64 `uadmin:"progress_bar:1.0:#f00"`
server_test.go: P6           float64 `uadmin:"progress_bar:0.3:red,0.7:yellow,1.0:lime"`

Corresponding html from previous implementation:

progress bar widget
                 {{else if or (eq $type "number") (eq $type "progress_bar")}}
                  <td style="width:80%;" class="search">
                    <label class="col-sm-12 control-label form_label visible-xs" data-toggle="tooltip" data-placement="bottom" title="{{ .Help }}"><span class="camelcaseFix">{{.DisplayName}}</span>{{ if eq .Help "" }}{{ else }}<span class="text-muted" style="font-size:12px;"> <i class="fa fa-question-circle"></i>{{end}}:{{ if .Required }}<span style="color:#f00;font-weight:bold;">&nbsp;*</span>{{end}}</label>
                    <div class="col-sm-12">
                      <div class="input-group col-sm-12">
                        {{if and (eq .ApprovalAction 0) (ne .ChangedBy "")}}
                        <div class="input-group-addon" style="font-family:monospace;;overflow:hidden;max-width:200px;text-overflow:ellipsis;" title="{{.ChangedBy}} {{.ChangeDate.Format "2006-01-02 15:04"}}">
                          <a href="{{$RootURL}}approval/{{.ApprovalID}}" style="text-decoration:none;"><i class="fa fa-exclamation-triangle" style="color:#ffc028"></i> {{.NewValue}}</a>
                        </div>
                        {{else if eq .ApprovalAction 1}}
                        <div class="input-group-addon" style="font-family:monospace;" title="{{.ApprovalBy}} {{.ApprovalDate.Format "2006-01-02 15:04"}}">
                          <i class="fa fa-check" style="color:lime"></i>
                        </div>
                        {{else if eq .ApprovalAction 2}}
                        <div class="input-group-addon" style="font-family:monospace;" title="{{.ApprovalBy}} {{.ApprovalDate.Format "2006-01-02 15:04"}}">
                          <i class="fa fa-times" style="color:red"></i>
                        </div>
                        {{end}}
                        <input class="form-control" name="{{.Name}}" type="number" step="0.01" value="{{.Value}}"{{if .Required}} required {{end}}{{if ne .Max ""}} max="{{.Max}}" {{end}}{{if ne .Min ""}} min="{{.Min}}" {{end}}{{if $is_readonly}} readonly {{end}}{{if ne .Pattern ""}} pattern="{{.Pattern}}" {{if ne .PatternMsg ""}}oninvalid="setCustomValidity('{{.PatternMsg}}')" {{end}}{{end}} style="border-radius:{{if ne .ChangedBy ""}}0px 4px 4px 0px{{else}}4px;{{end}}">
                      </div>
                      {{ if eq .Help "" }}{{ else }}<span class="text-muted" style="font-size:12px;"><i class="fa fa-question-circle"></i> {{.Help}}</span>{{ end }}
                      {{if ne "" (.ErrMsg)}}<span class="text-muted" style="font-size:12px; color:red;"><i class="fa fa-question-circle"></i> {{.ErrMsg}}</span>{{ end }}
                    </div>
                  </td>

temp := template.HTML(fmt.Sprintf("<div style='border:solid 1px;'><div style='width:%d%%; background-image:linear-gradient(%s,%s); text-align:center;'>%.2f</div></div>", int(tempProgressWidth), tempGradient1, tempGradient2, tempProgressValue))


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant