webpin
webpin copied to clipboard
Fix #85 - Invalid icon & validation improvements
Well - first, the 'edit' view showed "create new web app".
Then the bug:
When no icon is found / selected, the icon_name is empty, but later the on_accept code checks File.new_for_path ("").query_exist ()
- which will just resolve to the working directory, and as that exists, it tries to load the working directory as icon:
WARNING **: Editor.vala:503: Failed to open file “”: No such file or directory
I fixed that by wrapping with icon.has_prefix("/")
And I also worked on the UX for invalid fields (https://github.com/TeNNoX/webpin/commit/0d82f02bd3acd7da8c94ded02da6da2bfa24cda4)
In some cases, the UI didn't show if fields are invalid - so the user doesn't know why the Save button is greyed out. That's the UX problem of e.g. #85 (you don't see the icon is considered 'invalid')
I refactored so that Form field error status is updated in .validate
(now called updateFormStatus
), and the change listeners only set the validity boolean.
Other things I fixed along the way
-
update the icon back to default if the name field is cleared.
-
I also added validation feedback for the image button (although it feels weird to set class 'destructive-action', I found it to be the easiest :P)
-
I also changed path detection from
.contains ("/")
to.has_prefix ("/")
as I think we always have absolute paths. And I'm not sure if theme icon names could contain a '/'.