mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Add Default fill specific time switch to database date field https://github.com/siyuan-note/siyuan/issues/12089
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
e6a9db0253
commit
0147a6573d
18 changed files with 77 additions and 9 deletions
|
|
@ -2147,15 +2147,15 @@ func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, er
|
|||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewColDate(operation *Operation) (ret *TxErr) {
|
||||
err := setAttributeViewColDate(operation)
|
||||
func (tx *Transaction) doSetAttrViewColDateFillCreated(operation *Operation) (ret *TxErr) {
|
||||
err := setAttributeViewColDateFillCreated(operation)
|
||||
if err != nil {
|
||||
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func setAttributeViewColDate(operation *Operation) (err error) {
|
||||
func setAttributeViewColDateFillCreated(operation *Operation) (err error) {
|
||||
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -2172,7 +2172,35 @@ func setAttributeViewColDate(operation *Operation) (err error) {
|
|||
}
|
||||
|
||||
key.Date.AutoFillNow = operation.Data.(bool)
|
||||
err = av.SaveAttributeView(attrView)
|
||||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewColDateFillSpecificTime(operation *Operation) (ret *TxErr) {
|
||||
err := setAttrViewColDateFillSpecificTime(operation)
|
||||
if err != nil {
|
||||
return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func setAttrViewColDateFillSpecificTime(operation *Operation) (err error) {
|
||||
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
keyID := operation.ID
|
||||
key, _ := attrView.GetKey(keyID)
|
||||
if nil == key || av.KeyTypeDate != key.Type {
|
||||
return
|
||||
}
|
||||
|
||||
if nil == key.Date {
|
||||
key.Date = &av.Date{}
|
||||
}
|
||||
|
||||
key.Date.FillSpecificTime = operation.Data.(bool)
|
||||
err = av.SaveAttributeView(attrView)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue