Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Athozus
Copy link
Member

@Athozus Athozus commented Sep 9, 2023

This PR contains all from the new settings management. Let's explain a bit how it works :

  • init.lua : here you defines the settings
    • mail.settings : the whole list of settings with setting = { -- data } structure
    • mail.settings_groups : the list of groups of settings (for settings page)
    • then it generates selected_idxs sub-tables for each settings
  • settings.lua : the redesigned ui page
    • first of all, it defines a base of x and y values
    • after that, it creates a temporary table for ordering settings depending on their index value (for the selected group)
    • then it iterates through the settings and generate UI for each type of settings
    • when the player sends fields, it saves in selected_idxs the temporary value

Info for settings definition :

  • required : type (supported : string, index (for dropdowns), bool (for checkboxes)), default, group, label
  • additional :
    • index (recommended) : used to defines the order of the settings in the group on the UI
    • tooltip : additional info at hovering
    • dataset :
      • required for index types (dropdown), for example default sorting field (From/To, ...)
      • using for giving predefined values for string (show a dropdown alongside)
    • format : for dataset, preview predefined values (for example format current date with %X ...)

Hope there's not too much bugs, I fixed all those I noticed. I'm surprised that it not contains too much new lines, and new settings implementation is now much easier.

And, as usual, a small screenshot :
screenshot_20230909_205628

Athozus added 3 commits August 3, 2023 23:03
Add saving, generate selection idxs from settings list, order settings via index value in each group of settings
@Athozus Athozus added the Enhancement New feature or request label Sep 9, 2023
@Athozus Athozus added this to the 1.4.0 milestone Sep 9, 2023
@S-S-X
Copy link
Member

S-S-X commented Sep 9, 2023

For now didn't really go through code but for formatting use spaces instead of tabs if you want specific alignment.
Basically tabs for indentation and spaces for alignment.

edit: reasoning: tab width isn't defined anywhere and can be anything which in turn breaks alignment if done with tabs.

Copy link
Member

@BuckarooBanzay BuckarooBanzay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't test but LGTM 👍

Athozus and others added 2 commits September 13, 2023 20:04
No code change, only format

Co-authored-by: SX <[email protected]>
Use spaces instead

Co-authored-by: SX <[email protected]>
@Athozus
Copy link
Member Author

Athozus commented Sep 13, 2023

Committed your suggestions. Good for you ?

Copy link
Member

@S-S-X S-S-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test but seems fine.

Using inline instead of multiples lines to add tooltip attached to setting into formspec

Co-authored-by: SX <[email protected]>
@Athozus Athozus merged commit e599646 into master Sep 14, 2023
@Athozus Athozus deleted the reworked-settings branch April 15, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants