Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Development and Code Review
(Moderator:
fabian
) »
Layout development
« previous
next »
Print
Pages: [
1
]
Author
Topic: Layout development (Read 3753 times)
agh1467
Newbie
Posts: 2
Karma: 0
Layout development
«
on:
December 25, 2021, 06:07:02 pm »
Hey all. I've been working on a plugin for dnscrypt-proxy, and in working on it I've reworked some parts of the "layout_partials" templates. I'm not sure if it's any good, and I'd like some opinions on it. I'm hoping someone here is familiar with MVC, and how OPNsense has built it around their layout_partials templates.
I did this because it was the only way I knew to build the UI using MVC without having to make upstream changes in Core. The tutorials have large sections of HTML code to copy and paste, and I didn't like having to copy/paste re-type so many things. There's just too much room for error, and headache. So I automated the process following what the existing layout_partials do, but extending it further to support different types of fields including bootgrids themselves.
To accomplish this I had to modify the ControllerBase XML parser since the one in Core doesn't walk the whole tree. This modification was was necessary to take advantage of XML element attributes, and nested elements. Without these it would make for a lot of extra structures in the form XMLs to convey information.
My plugin is located here:
https://github.com/agh1467/plugins/tree/dnscrypt-proxy-ng/dns/dnscrypt-proxy-ng
The volt templates are here:
https://github.com/agh1467/plugins/tree/dnscrypt-proxy-ng/dns/dnscrypt-proxy-ng/src/opnsense/mvc/app/views/OPNsense/Dnscryptproxy
I also have developer notes which (attempt to) describe reasoning, and design in a detailed and coherent manner:
https://github.com/agh1467/plugins/blob/dnscrypt-proxy-ng/dns/dnscrypt-proxy-ng/DEVELOPMENT.md
What I'd like to do, ultimately, is integrate these layout changes into Core, because they're making this plugin too big to review, it won't get accepted currently. I think many of these layout features could be used by other plugins, to help accelerate migration to the MVC model. Some of the layouts were even based on existing legacy pages with intent to ease their migration. As it stands, the bulk of the code of this plugin is in the layouts themselves. If these changes can be integrated into Core, that will mean a smaller plugin for the OPNsense folks to review. If, however, how I've modified everything is dumb then there is no chance to getting it into Core. Any advice, pointers, or guidance is welcome.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Development and Code Review
(Moderator:
fabian
) »
Layout development