mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-27 12:24:43 +03:00
add, web: suggest implied and declared account names also
This commit is contained in:
parent
ddef7d722d
commit
3f124cf123
@ -364,7 +364,7 @@ addform _ vd@VD{..} = [hamlet|
|
|||||||
defdate = "" :: String -- #322 don't set a default, typeahead(?) clears it on tab. See also hledger.js
|
defdate = "" :: String -- #322 don't set a default, typeahead(?) clears it on tab. See also hledger.js
|
||||||
dates = ["today","yesterday","tomorrow"] :: [String]
|
dates = ["today","yesterday","tomorrow"] :: [String]
|
||||||
descriptions = sort $ nub $ map tdescription $ jtxns j
|
descriptions = sort $ nub $ map tdescription $ jtxns j
|
||||||
accts = sort $ journalAccountNamesUsed j
|
accts = journalAccountNamesDeclaredOrImplied j
|
||||||
escapeJSSpecialChars = regexReplaceCI "</script>" "<\\/script>" -- #236
|
escapeJSSpecialChars = regexReplaceCI "</script>" "<\\/script>" -- #236
|
||||||
listToJsonValueObjArrayStr as = preEscapedString $ escapeJSSpecialChars $ encode $ JSArray $ map (\a -> JSObject $ toJSObject [("value", showJSON a)]) as
|
listToJsonValueObjArrayStr as = preEscapedString $ escapeJSSpecialChars $ encode $ JSArray $ map (\a -> JSObject $ toJSObject [("value", showJSON a)]) as
|
||||||
numpostings = 4
|
numpostings = 4
|
||||||
|
@ -262,7 +262,7 @@ accountWizard EntryState{..} = do
|
|||||||
flip evalState esJournal $ runParserT (accountnamep <* eof) "" (T.pack s) -- otherwise, try to parse the input as an accountname
|
flip evalState esJournal $ runParserT (accountnamep <* eof) "" (T.pack s) -- otherwise, try to parse the input as an accountname
|
||||||
where
|
where
|
||||||
validateAccount :: Text -> Maybe Text
|
validateAccount :: Text -> Maybe Text
|
||||||
validateAccount t | no_new_accounts_ esOpts && not (t `elem` journalAccountNames esJournal) = Nothing
|
validateAccount t | no_new_accounts_ esOpts && not (t `elem` journalAccountNamesDeclaredOrImplied esJournal) = Nothing
|
||||||
| otherwise = Just t
|
| otherwise = Just t
|
||||||
dbg1 = id -- strace
|
dbg1 = id -- strace
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ descriptionCompleter :: Journal -> String -> CompletionFunc IO
|
|||||||
descriptionCompleter j = completer (map T.unpack $ journalDescriptions j)
|
descriptionCompleter j = completer (map T.unpack $ journalDescriptions j)
|
||||||
|
|
||||||
accountCompleter :: Journal -> String -> CompletionFunc IO
|
accountCompleter :: Journal -> String -> CompletionFunc IO
|
||||||
accountCompleter j = completer (map T.unpack $ journalAccountNamesUsed j)
|
accountCompleter j = completer (map T.unpack $ journalAccountNamesDeclaredOrImplied j)
|
||||||
|
|
||||||
amountCompleter :: String -> CompletionFunc IO
|
amountCompleter :: String -> CompletionFunc IO
|
||||||
amountCompleter = completer []
|
amountCompleter = completer []
|
||||||
|
Loading…
Reference in New Issue
Block a user