Issue and Pulls lists rework (#13594)
* Issue and Pulls lists rework Reorganized and restyled the issue and pull request lists. * color and layout tweaks * use new issue list on dashboard as well * move pagination into template * misc tweaks * fix label hover * fix milestone list * fix discrepancies between issue and milestone list, add new 'merge' helper * fmt * simplify merge helper * remove whitespace * fix startIndex * further simplify dict merging * rename helper to 'mergeinto' for clarity * allow bottom-row to wrap Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
00ec651270
commit
6d93a3ab18
12 changed files with 342 additions and 479 deletions
|
@ -6,6 +6,7 @@ package util
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -100,3 +101,26 @@ func NormalizeEOL(input []byte) []byte {
|
|||
}
|
||||
return tmp[:pos]
|
||||
}
|
||||
|
||||
// MergeInto merges pairs of values into a "dict"
|
||||
func MergeInto(dict map[string]interface{}, values ...interface{}) (map[string]interface{}, error) {
|
||||
for i := 0; i < len(values); i++ {
|
||||
switch key := values[i].(type) {
|
||||
case string:
|
||||
i++
|
||||
if i == len(values) {
|
||||
return nil, errors.New("specify the key for non array values")
|
||||
}
|
||||
dict[key] = values[i]
|
||||
case map[string]interface{}:
|
||||
m := values[i].(map[string]interface{})
|
||||
for i, v := range m {
|
||||
dict[i] = v
|
||||
}
|
||||
default:
|
||||
return nil, errors.New("dict values must be maps")
|
||||
}
|
||||
}
|
||||
|
||||
return dict, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue