Commit Graph

9 Commits

Author SHA1 Message Date
Thomas M Steenholdt
6c8a3ac36c Move setting definitions into code (rather than database).
For a setting to be useful, the code has to be able to make sense of it anyway. For this reason it makes sense, that the available settings are defined within the code, rather than in the database, where a missing row has previously caused problems. Instead, settings are now written to the database, when they are changed.

So instead of relying on the database initialization process to create all available settings for us in the database, the supported settings and their defaults are now in a `defaults` dict in the Setting class. With this in place, we can stop populating the `setting` table as a part of database initialization and it will be much easier to support new settings in the future (we no longer need to do anything to the database, to achieve that).

Another benefit is that any changes to default values will take effect automatically, unless the admin has already modified that setting to his/her liking.

To make it easier to get the value of a setting, falling back to defaults etc, a new function `get` has been added to the Setting class. Call it as `Setting().get('setting_name'), and it will take care of returning a setting from the database or return the default value for that setting, if nothing was found.

The `get` function returns `None`, if the setting passed to the function, does not exist in the `Setting.defaults` dict - Indicating that we don't know of a setting by that name.
2018-06-21 22:06:38 -02:00
Ivan Filippov
ea79c01aff Added SCRIPT_ROOT parameter. Fixes #52.
Adds a new javascript parameter that holds the webroot of the app. This
allows the the javascript calls to properly identify that they're
running in a subfolder/different webroot and direct their queries there.
2016-07-05 21:34:21 -06:00
Ivan Filippov
9794e221aa Replace direct 'click' event binding with delegated binding. Fixes #58.
Direct binding only works for elements already in the DOM, delegated
binding works for all elements that match a filter even if created after
the DOM is fully loaded.
2016-07-01 16:31:14 -06:00
Khanh Ngo
d837e878e4 Convert tabs to spaces in HTML template files. 2016-06-18 11:41:01 +07:00
Ivan Filippov
39564f9c6e Add 'default_record_table_size' setting to allow changing table size.
Fixes #36.
2016-06-08 19:23:08 -06:00
Ivan Filippov
2cc5ee77d7 Removed unneeded modals from settings template. 2016-05-15 13:17:54 -06:00
Ivan Filippov
0c694816e2 Added 'record_helper' setting. New option for reload after applyChanges
This setting enabled a helper pop-up that assists with filling out MX
and SRV records. This option is toggleable on the Settings page.
2016-05-15 12:47:02 -06:00
Ivan Filippov
2b80339753 Standardize on btn-flat button style. 2016-05-10 18:11:17 -06:00
Ivan Filippov
98ddd7302b Add initial support for PDNS-Admin settings management. 2016-04-29 15:36:37 -06:00